How we contain Claude across products
打开互动全文版(逐段中英对照 + 针对本篇提问)→Anthropic 的工程团队历时两年,为三款智能体产品——claude.ai、Claude Code 和 Claude Cowork——构建了隔离管控架构,这三款产品面向不同用户群体,需要各自不同的隔离模式。文章认为,智能体的安全风险可分为三类(用户滥用、模型行为失当和外部攻击者),并且必须在三个层面加以防御:智能体运行的环境、模型本身,以及智能体可触及的外部内容。由于模型层防御具有概率性、永远无法完全可靠,环境层面的管控——沙箱、虚拟机、文件系统边界和出口控制——承担着最重要的作用。作者描述了 claude.ai 如何在服务端 gVisor 容器中运行代码并使用临时文件系统,而 Claude Code 则将操作系统级沙箱与人工介入审批相结合,不过遥测数据显示出审批疲劳现象,用户大约接受了 93%的提示。他们还记录了真实发生的故障,包括信任建立前的钩子执行漏洞以及一次红队钓鱼事件,并得出结论:各项防御必须相互重叠,且在获得用户同意之前,本地输入绝不应被隐式信任。
Anthropic's engineering teams have spent two years building containment architectures for three agentic products—claude.ai, Claude Code, and Claude Cowork—each serving different audiences and requiring distinct isolation patterns. The article argues that agent security risks fall into three categories (user misuse, model misbehavior, and external attackers) and must be defended at three layers: the environment in which the agent runs, the model itself, and the external content the agent can reach. Because model-layer defenses are probabilistic and never fully reliable, environmental containment—sandboxes, virtual machines, filesystem boundaries, and egress controls—carries the most weight. The authors describe how claude.ai runs code in server-side gVisor containers with ephemeral filesystems, while Claude Code combines OS-level sandboxing with human-in-the-loop approval, though telemetry revealed approval fatigue, with users accepting roughly 93% of prompts. They also document real failures, including pre-trust hook execution vulnerabilities and a red-team phishing incident, concluding that defenses must overlap and that local inputs should never be implicitly trusted before user consent.
* 01 三类风险与防御的三个组成部分
* 01 Three types of risk, three components of defense
2026 年 4 月 9 日 实践中的可信智能体
Apr 9, 2026 Trustworthy agents in practice
十二个月前,我们会毫不犹豫地拒绝授予 Claude 足以关停 Anthropic 内部服务的访问权限这一想法。如今,这种级别的访问权限已是常态,Anthropic 的开发者也因此提高了生产力。这些部署的风险有两个组成部分:失败的可能性,以及一次失败可能造成的损害。在安全保障和模型训练方面的进展已稳步降低了前者;而后者——理论上的影响半径(blast radius)——只会随着能力和访问权限的扩展而增大。然而,随着智能体能够完成过去需要一个人甚至一个团队才能完成的工作,_不_部署的代价变得足够大,以至于只要产品能够被做得安全,风险-收益的计算就会大幅倾向于采用。工程问题于是变成:如何限制影响半径。
Twelve months ago, we'd have rejected out of hand the idea of granting Claude access sufficient to take down an internal Anthropic service. Today that level of access is routine, and Anthropic developers are more productive for it. The risk of these deployments has two components: how likely a failure is, and how much damage one could do. Progress on safeguards and model training has steadily driven down the first; the second—the theoretical blast radius—only grows as capabilities and access expand. Yet as agents become capable of doing work that once required a person or even a team, the cost of _not_ deploying grows large enough that the risk-reward calculation tips heavily toward adoption, as long as products can be made safe. The engineering question becomes how to cap the blast radius.
第一种是通过人在回路(human-in-the-loop)来监督智能体的行为。Claude Code 此前通过在每个回合向用户请求许可,来防止智能体采取非预期行动。理论上这行得通,但我们发现这种方法并不可靠。我们的遥测数据显示,用户批准了大约 93% 的权限请求。用户看到的批准请求越多,对每一个请求投入的注意力就越少,久而久之其监督就变得远不如从前勤勉。我们最近构建了 Claude Code 自动模式(auto mode),将更安全的批准自动化,以减少这种批准疲劳。尽管如此,漏洞依然存在——任何概率性防御都有非零的漏检率。1
The first is to supervise the agent's behavior via a human-in-the-loop. Claude Code previously protected against agents taking unintended actions by asking users for permission at each turn. Theoretically that works, but we've found the approach to be fallible. Our telemetry showed users approved roughly 93% of permission prompts. The more approvals a user sees, the less attention they pay to each, becoming over time much less diligent in their supervision. We recently built Claude Code auto mode, which automates safer approvals in order to reduce this approval fatigue. Still, vulnerabilities remain—any probabilistic defense has a non-zero miss rate.1
限制影响范围的第二种方法——也是本文大部分内容的重点——是遏制。我们不是监督智能体做了什么,而是通过沙箱、虚拟机和出口控制等手段强制执行访问边界,从而监督它_能够_做什么。这正是 Anthropic 工程团队投入最多精力的地方,也是许多最令人意外的安全故障发生的地方。
The second approach to capping the blast radius—and the focus of much of this post—is containment. Rather than supervising what the agent does, we supervise what it is _able_ to do by enforcing access boundaries through, for example, sandboxes, virtual machines, and egress controls. This is where Anthropic engineering has devoted the most effort, and also where many of the most surprising security failures have occurred.
在过去两年中,我们推出了三款主要的智能体式产品:claude.ai、Claude Code 和 Claude Cowork。每款产品服务于不同的用户群体,需要不同的遏制架构。本文分享了哪些做法经受住了考验、哪些已经失效,以及我们在此过程中对智能体安全的认识。
Over the past two years, we've shipped three primary agentic products: claude.ai, Claude Code, and Claude Cowork. Each serves a different audience, requiring a different containment architecture. This article shares what's held up, what's broken, and what we've learned about agent security along the way.
智能体面临的安全风险可分为三类:
Security risks to agents fall into one of three categories:
**用户滥用:** 用户(出于恶意或疏忽)指示智能体执行有害操作。这包括从要求智能体绕过其认为烦人的检查,到运行其不理解的破坏性命令,再到指定故意伤害等一切行为。
**User misuse:** A user—either maliciously or through carelessness—directs the agent to do something harmful. This includes everything from asking the agent to bypass a check they find annoying, to running a destructive command they don’t understand, to specifying intentional harm.
**模型行为不当:** 智能体采取了无人要求的有害行动。随着模型能力提升,它们在大多数行为评估上已更加对齐,但这并不意味着风险必然减小。能力较弱的模型更容易误读情境并犯明显错误。能力更强的模型犯错更少,但也更擅长寻找实现目标的意外路径,通常通过绕过无人想到要写下的限制。
**Model misbehavior:** The agent takes a harmful action no one asked for. As our models have improved, they have become more aligned on most behavior evaluations, but this doesn’t mean risk necessarily shrinks. Less capable models are more likely to misread a situation and make obvious errors. More capable models make fewer mistakes, but they’re also better at finding unexpected paths to a goal, often by routing around restrictions nobody thought to write down.
在 Anthropic,我们观察到 Claude 模型曾“乐于助人地”逃离沙箱以完成任务、检查 git 历史以寻找编码测试的答案,并自发识别出正在运行的基准测试以解密其答案密钥。每个模型都带来一组新的能力,这些能力有时会以意想不到的方式被使用。
At Anthropic, we’ve seen Claude models “helpfully” escape a sandbox in order to complete a task, examine git history to find answers to a coding test, and spontaneously identify the benchmark it was being run on in order to decrypt its answer key. Each model brings a new set of capabilities that are sometimes put to work in unexpected ways.
**外部攻击者:** 智能体通过工具、文件或网络访问等外部途径受到攻击。此类别包括提示注入以及对智能体运行时、编排层或代理的常规攻击。
**External attackers:** The agent is attacked through external vectors such as tools, files, or network access. This category includes both prompt injection and conventional attacks on the agent's runtime, orchestration layer, or proxy.
在构建遏制与防御系统时,我们针对三个主要组成部分施加防御:
When building containment and defense systems, we apply defenses to three main components:
**智能体运行的环境。** 我们通过进程沙箱、虚拟机、文件系统边界和出站控制,来约束智能体可以在何处、以何种方式行动。目标是给智能体能够触及的范围设定一条硬边界。例如,如果凭据从未进入沙箱,它们就无法被窃取,无论起因是用户、模型找到了一条“有创意”的路径,还是攻击者。
**The environment in which the agent runs.** We constrain where and how an agent can act with process sandboxes, VMs, filesystem boundaries, and egress controls. The goal is to set a hard boundary on what an agent can reach. For example, if credentials never enter the sandbox, they can't be exfiltrated, regardless of whether the cause is a user, a model finding a "creative" path, or an attacker.
严密的边界也意味着可以放松监督。Claude Code 的参考 devcontainer 正是为此而存在:让智能体可以无人值守地运行,无需逐项操作审批。
A tight perimeter also means you can relax oversight. Claude Code's reference devcontainer exists precisely so that the agent can run unattended, without per-action approvals.
**智能体所咨询的模型。** 这里的机制包括系统提示、分类器、探针和训练修改。由于模型是概率性的,这些机制只塑造智能体*倾向于*做什么,而非它在理论上能够做什么。
**The model the agent consults.** The mechanisms here include system prompts, classifiers, probes, and training modifications. Because models are probabilistic, these shape only what the agent _tends_ to do, not what it is theoretically capable of doing.
这些防御很强。在 Gray Swan 的 Agent Red Teaming 基准测试(用于测试对提示注入的易感性)上,Claude Opus 4.7 在单次尝试中将攻击成功率控制在约 0.1%,在 100 次自适应尝试后约为 5–6%。Claude Code 的自动模式在执行前能捕获约 83% 的过度积极行为。然而,即便拥有同类最佳的防御,模型层的保护也永远不会 100% 有效,这就是它无法单独存在的原因。
These defenses are strong. On Gray Swan's Agent Red Teaming benchmark, which tests susceptibility to prompt injection, Claude Opus 4.7 holds attack success to roughly 0.1% on single attempts, and around 5–6% after 100 adaptive attempts. Claude Code auto mode catches roughly 83% of overeager behaviors before they execute. Yet even with best-in-class defenses, protection in the model layer will never be 100% effective, which is why it can't stand alone.
**智能体能够触及的外部内容。** MCP 服务器、第三方插件和网页搜索工具都会将来自你无法控制的来源的内容注入智能体的上下文窗口。经过审计的连接器并不等同于经过审计的数据——例如,一个 GitHub 连接器尽管通过了恶意软件检查,仍可能将一份被投毒的 README 直接加载进模型的上下文窗口。细粒度地限制工具权限有助于缩小影响范围。例如,一个仅具有只读数据库访问权限的智能体,其可部署范围远大于一个会写入生产环境的智能体。
**The external content the agent can reach.** MCP servers, third-party plugins, and web search tools all feed content into the agent's context from sources you don't control. An audited connector isn't the same as audited data—a GitHub connector, for instance, can load a poisoned README straight into the model's context despite passing malware checks. Granularly limiting tool permissions can help limit the blast radius. An agent with read-only DB access, for instance, can be deployed far more broadly than one that writes to prod.
各类防御应当相互重叠、彼此补充。当环境层面的防御不可用时,模型层就必须承担起弥补作用(这正是 Claude Code 的自动模式所设计的目的)。在本地,环境防御与模型防御可以共同防范恶意的工具输出;但也可以通过限制工具的能力与访问权限,在链条的更上层叠加防御。
Defenses should overlap and complement each other. When environmental defenses aren't available, the model layer has to pick up the slack (this is precisely what Claude Code's auto mode is designed for). Locally, the environment and model defenses can guard against malicious tool outputs, but defenses can be added higher up the chain by limiting the tool's capabilities and access.
聚焦于环境层,我们描述了三种隔离模式,以及它们如何针对每个 Claude 平台——claude.ai、Claude Code 和 Cowork——进行定制。每个设计都是我们逐步得出的,是在找到了我们所需智能体能力与用户所需干预程度之间的平衡之后。
Focusing on the environment layer, we describe three isolation patterns and how they are tailored for each Claude platform—claude.ai, Claude Code, and Cowork. We arrived at each design gradually, after finding the balance between the capabilities we need from the agent and the degree of intervention required from the user.
尽管 claude.ai 最为人熟知的是聊天界面,但它也能编写并运行代码、生成文件以及调用连接器。当 Claude 在 claude.ai 内运行代码时,它是在隔离基础设施上的 gVisor 容器中执行的。该智能体完全位于服务端;本地机器上不运行任何代码,且文件系统是临时的(按会话隔离)。爆炸半径极小,但 Claude 能做的事情上限也同样很低——既没有持久化工作区,也无法访问用户的文件系统。
Though best known as a chat interface, claude.ai also writes and runs code, generates files, and calls connectors. When Claude runs code inside claude.ai, it does so in a gVisor container on isolated infrastructure. The agent is entirely server-side; no code runs on the local machine, and the filesystem is ephemeral (per-session). The blast radius is minimal, but so is the ceiling on what Claude can do—there's no persistent workspace and no access to the user's filesystem.
这也使 claude.ai 面临一种更为传统的威胁模型。我们不是在保护用户机器免受智能体侵害,而是在保护我们自己的基础设施,并让各租户彼此隔离。我们在 claude.ai 发布前的工作,主要被网络配置、内部服务认证和编排等传统安全工作所占据。
This also makes claude.ai subject to a more traditional threat model. We're not protecting user machines from agents; we're protecting our own infrastructure and each tenant from one another. Our pre-launch work for claude.ai was dominated by traditional security work like network configuration, internal service auth, and orchestration.
这项工作再次印证了安全领域最古老的教训:最薄弱的环节正是你自己构建的那一层。gVisor 和 seccomp 针对资源充足的对手进行加固的时间,远比智能体式 AI 存在的时间更长,因此审查工作集中在我们围绕它们构建的较新组件上。我们稍后会回到这一点,因为我们的自定义代理也正是我们在最具影响的事故中出问题的那个组件。
That work reinforced the oldest lesson in security: the weakest layer is the one you built yourself. gVisor and seccomp have been hardened against well-resourced adversaries for far longer than agentic AI has existed, so the review effort went into the newer pieces we'd built around them. We'll come back to this later, since our custom proxy is also the piece that broke in our most consequential incident.
Claude Code 运行在用户自己的机器上,并可访问其文件系统、shell 和网络。若不具备这些访问权限,编程智能体的实用性将十分有限,因此必须找到一种安全授予这些访问权限的方式。
Claude Code runs on a user's machine and has access to their filesystem, shell, and network. Without this, coding agents have limited usefulness, so it's imperative to find a way to grant that access safely.
一种方法是依赖人在回路(human-in-the-loop)。对 Claude Code 而言,这之所以是一个可行的方案,是因为其普通用户本身就是熟悉编程环境的开发者:他们能读懂 bash,理解 rm -rf 的作用,而且每周都会多次从不受信任的来源运行 npm install。这意味着,当弹出“允许此操作”的对话框时,他们极有可能具备足够的专业能力,准确评估智能体试图做什么以及其中涉及的风险。基于这一点,Claude Code 上线时采用了最简单的防御策略:允许读取,而写入、bash 和网络访问则需经批准。
One approach is to rely on a human-in-the-loop. This is only a tractable solution for Claude Code because the average user is a developer who's familiar with coding environments: they can read bash, they understand what rm -rf does, and they already run npm install from untrusted sources several times a week. All that means that when an "allow this" dialog pops up, they are highly likely to have the expertise to accurately evaluate what the agent is attempting to do and the risk involved. Given this, Claude Code launched with the simplest possible defense: allow reads, require approval for write, bash, and network access.
然而,如前所述,审批疲劳在数周内便显现出来。颇具讽刺意味的是,这意味着一个原本旨在提供监督的功能,反而可能产生相反的效果——一些用户可能干脆不再关注。作为缓解轻率批准的第一步,我们发布了一个操作系统级沙箱(macOS 上的 Seatbelt,Linux 上的 bubblewrap),以加固边界:允许读取,允许在工作区内写入,但默认拒绝网络访问。在沙箱内,智能体基本可以不受打断地运行。结果是权限提示减少了 84%,并且我们将该运行时开源,因此这一边界是可审计的。
However, as mentioned, approval fatigue showed up within weeks. Ironically, this meant that a feature originally designed to provide oversight could arguably have the opposite effect—some users might simply stop paying attention. As a first step to mitigate incautious approvals, we shipped an OS-level sandbox (Seatbelt on macOS, bubblewrap on Linux) that hardens the boundary: reads are allowed, writes are allowed inside the workspace, but network is denied by default. Within the sandbox, the agent runs largely without interruption. The result was an 84% reduction in permission prompts, and we open-sourced the runtime, so the boundary is auditable.
我们的匿名使用数据还显示,经验丰富的用户自动批准的次数约为新用户的两倍,但他们也更频繁地在执行过程中打断智能体。经验丰富的用户并不对每个步骤逐一设卡,而是更倾向于仅在智能体偏离正轨时才进行监督。这或许是人们与智能体协作方式的一种自然演进,但同样容易出错,因为它要求用户具备足够的技术能力并保持足够的注意力,才能首先察觉到偏离。随着模型能力提升、智能体开始编写越来越复杂的 bash,察觉此类偏离变得更加困难。而随着用户转向多智能体系统,这种方法也更难成为一种有效的监督策略。
Our anonymized usage data also showed that experienced users auto-approve roughly twice as often as new users, but they also interrupt the agent mid-execution more frequently. Instead of gating individual steps, experienced users are more likely to supervise the agent only when it goes off track. While this may be a natural evolution in how people prefer to work with agents, this too is fallible, requiring users to be technical and attentive enough to notice drift in the first place. As model capabilities improve and agents begin writing increasingly ambitious bash, it becomes harder to notice any such drift. And as users move to multi-agent systems, this approach is also much less likely to be an effective oversight strategy.
在 2025 年中期至 2026 年 1 月期间,我们通过负责任披露计划收到了关于 Claude Code 漏洞的报告。其中三个漏洞针对的是在用户同意任何内容_之前_执行的代码。要理解这如何可能,考虑最直接的情况:开发者克隆一个仓库以审查拉取请求,而该仓库包含一个定义了钩子的.claude/settings.json 文件。由于 Claude Code 在启动期间读取项目设置——在呈现标准的“你信任此文件夹吗?”提示之前——攻击者编写并提交的钩子将自动执行。其余案例在结构上类似,即来自尚未信任目录的输入在信任边界建立之前就被解析。
Between mid-2025 and January 2026, we received reports of vulnerabilities in Claude Code through our responsible disclosure program. Three of these vulnerabilities targeted code that executes _before_ the user has consented to anything. To understand how this is possible, consider the most direct case: a developer clones a repository to review a pull request, and that repository contains a .claude/settings.json which defines a hook. Because Claude Code reads project settings during startup—before presenting the standard "Do you trust this folder?" prompt—the hook the attacker had authored and committed would execute automatically. The remaining cases looked structurally similar, in which input from the not-yet-trusted directory was parsed before the trust boundary had been established.
每个案例中的修复方法都具有相同的形式:将项目本地配置的解析和执行推迟到用户接受信任提示之后。如果你正在构建类似的东西,请像对待来自互联网的任何入站请求一样对待项目打开、配置加载和本地主机监听器。它们不应该仅仅因为感觉是本地且发生在用户同意之前就被隐式信任。
The fix in each case had the same shape: defer parsing and execution of project-local configuration until after the user accepts the trust prompt. If you're building something similar, treat project-open, config-load, and localhost listeners the way you'd treat any inbound request from the internet. They shouldn’t be implicitly trusted just because they feel local and arrive before the user has consented.
2026 年 2 月,在一次受控的内部红队演练中,一名研究员成功对一名员工实施了钓鱼,诱使其用恶意提示启动 Claude Code。这封钓鱼邮件看起来像普通的协作请求——一封写着“你能帮我运行一下这个吗?”的邮件,附带着一段可直接粘贴的提示——而提示本身读起来就像常规的任务说明。但在设置步骤的某处,它温和地要求 Claude 读取 ~/.aws/credentials,对内容进行编码,并将其 POST 到外部端点。对该提示进行 25 次重试,Claude 有 24 次完成了数据外泄。
In February 2026, during a controlled internal red-team exercise, a researcher successfully phished an employee into launching Claude Code with a malicious prompt. The phish looked like ordinary collaboration—a "can you run this for me?" email with a ready-to-paste prompt attached—and the prompt itself read like routine task instructions. But somewhere among the setup steps, it gently asked Claude to read ~/.aws/credentials, encode the contents, and POST them to an external endpoint. Across 25 retries of that prompt, Claude completed the exfiltration 24 times.
这是一次**直接**提示注入——攻击者的指令是通过用户传入的,而非通过工具输出或抓取的内容。我们的模型层防御以用户意图为锚点——当输入指令的是用户本人时,分类器就捕捉不到任何异常。把同样的脚本交给一个人工承包商,他也会做同样的事。
This is a _direct_ prompt injection—the attacker's instructions arrived through the user, not through tool output or fetched content. Our model-layer defenses anchor on user intent—when the user is the one typing the instruction, there's nothing anomalous for a classifier to catch. A human contractor handed the same script would have done the same thing.
在这种情况下唯一有效的防御是环境,具体而言是出口控制(无论意图如何都阻止该 POST)以及文件系统边界(从一开始就让 ~/.aws 不可触及)。
The only defense that holds in this situation is the environment, specifically egress controls that block the POST regardless of intent and filesystem boundaries that keep ~/.aws out of reach in the first place.
(当我们在内部 Slack 中分享这个可用的提示以供讨论时,有人指出某些内部智能体会**读取** Slack。此时载荷已处于环境之中。我们在该线程中加入了一个金丝雀字符串,以便在有任何东西读取它时能察觉。在一个智能体读取一切的世界里,调查工具本身也是攻击面。)
(When we shared the working prompt in internal Slack for discussion, someone pointed out that some internal agents _read_ Slack. The payload was now ambient. We added a canary string to the thread so we'd notice if anything picked it up. In a world where agents read everything, the investigation tooling is also an attack surface.)
Claude Cowork 在用户桌面上运行,可访问用户选定的工作区文件夹。由于该平台是为通用知识工作而非软件工程构建的,普通用户不太可能精通 bash。
Claude Cowork runs on a user's desktop with access to a workspace folder selected by the user. Because the platform is built for general knowledge work, not software engineering, the average user is much less likely to be fluent in bash.
因此,人在环中的沙箱策略可能不适用;不应期望非技术知识工作者判断诸如 \(find . -name "*.tmp" -exec rm {} \;\) 这样的 bash 咒语。当批准例外需要典型用户不具备的专业知识时,管理员应设置一个绝对且始终生效的边界。
As a result, the human-in-the-loop sandbox strategy may not transfer; a non-technical knowledge worker shouldn't be expected to judge bash incantations such as \(find . -name "*.tmp" -exec rm {} \;\). When approving an exception requires expertise the typical user doesn't have, admins should set a boundary that is absolute and always-on.
为实现这一点,我们的第一版 Claude Cowork 在完整虚拟机中运行,使用平台供应商的虚拟机监控程序(macOS 上的 Apple Virtualization 框架,Windows 上的 HCS)。虚拟机有自己的 Linux 内核、自己的文件系统和自己进程表。用户选定的工作区和 .claude 文件夹被挂载;主机上其他内容不可见。凭据保留在主机的钥匙串中,从不进入客户机。此设计防范 Claude 在某个时刻以不对齐方式行为的可能性。被攻陷的 Claude 仍可能损坏工作区文件夹内的内容,因此架构设计确保那是它唯一能触及的东西(直到用户添加连接器),并且用户控制那里挂载的内容。
To enable this, our first version of Claude Cowork ran inside a full virtual machine using the platform's vendor hypervisor (Apple's Virtualization framework on macOS, HCS on Windows). The VM has its own Linux kernel, its own filesystem, and its own process table. The user's selected workspace and .claude folder are mounted; nothing else on the host is visible. Credentials stay in the host's keychain and never enter the guest machine. This design protects against the possibility that Claude will, at some point, behave in a misaligned manner. A compromised Claude could still damage what's inside the workspace folder, so the architecture is designed to make sure that's the _only_ thing it can reach (until the user adds connectors), and that the user controls what's mounted there.
在原始架构——我们称之为全虚拟机模式——中,智能体循环本身在客户机内运行,因此 Claude 作为普通 Linux 用户执行,不知道自己被沙箱化。与 Claude Code 相比,后者有一个特权进程位于沙箱之外,逐命令决定是否强制执行;一个有说服力的注入提示或疲劳的批准点击可能让该进程运行未沙箱化的内容。在这里,没有外部进程持有逃生舱钥匙,因此没有组件有权授予例外。
In the original architecture—what we call full-VM mode—the agent loop itself ran inside the guest, so Claude executed as an ordinary Linux user with no awareness it was sandboxed. Compare this to Claude Code, where a privileged process sits outside the sandbox deciding per-command whether to enforce it; a persuasive injected prompt or a fatigued approval click can get that process to run something un-sandboxed. Here, there was no outer process holding an escape-hatch key, and so no component with the authority to grant an exception.
然而,我们很快意识到,以完整虚拟机模式运行整个智能体会带来实际问题:虚拟机启动过程中的任何失败都会使 Cowork 无法使用。将智能体循环移到虚拟机_外部_,同时将代码执行保留在虚拟机_内部_,使 Claude 仍能回应用户并帮助调试问题,而不是在出错时卡死。这一改动对安全性的影响极小,因为虚拟机仍会对智能体执行的代码实施文件系统和网络控制。
However, we soon realized that running the whole agent in full-VM mode caused practical problems: any failure during VM startup made Cowork unusable. Moving the agent loop _outside_ of the VM, while keeping code execution inside of it, allowed Claude to still respond to the user and help debug issues rather than freeze on an error. This change caused minimal security impact because the VM still enforces filesystem and network controls over code executed by the agent.
另外,我们还将本地 MCP 服务器移出了虚拟机。在虚拟机内运行它们会使其更难审计,在虚拟机更新时造成脆弱的依赖问题,并且不支持需要与数据库等本地进程交互的 MCP——此类服务器无论如何都必须在宿主机上运行。这一改动使 Claude Cowork 与 Claude Desktop 中本地 MCP 服务器已有的工作方式保持一致:将它们视为用户可能选择安装的普通软件,并交由管理员决定启用哪些本地 MCP(如果有的话)。远程 MCP 服务器不受影响,因为它们不在用户机器上运行。
Separately, we also moved local MCP servers outside the VM. Running them inside the VM made them harder to audit, created brittle dependency issues when the VM updated, and didn't support MCPs that required interaction with local processes such as databases—such servers had to run on the host regardless. The change brings Claude Cowork in line with how local MCP servers already work in Claude Desktop: treating them like any software a user might choose to install and entrusting admins to decide which local MCPs to enable (if any). Remote MCP servers are unaffected since they do not run on the user's machine.
文件系统控制是另一项重要的架构选择。Claude 需要能够访问宿主机上的_部分_文件才能发挥作用,但我们希望将影响范围降到最低,并向用户透明地展示本地文件访问情况。我们发现,提供不同的文件挂载模式有助于细粒度地控制风险;Claude Cowork 提供只读、读写和读写但不删除三种模式。这里的一个潜在陷阱是,符号链接解析必须在路径验证_之前_进行,而不是之后,否则授权文件夹内的符号链接可能指向外部并逃逸。对于企业客户,我们允许管理员通过 MDM 设置中的挂载路径允许列表来控制这一点。
Filesystem controls were another important architectural choice. Claude needs to be able to access _some_ files on the host in order to be useful, but we wanted to minimize the blast radius and provide transparency to the user about local file access. We found that offering different file-mount modes helps to granularly control risk; Claude Cowork offers read-only, read-write, and read-write-no-delete. One potential gotcha here is that symlink resolution has to happen _before_ path validation, not after, or a symlink inside an authorized folder can point outside and escape. For enterprise customers, we allow admins to control this via mount-path allowlists in MDM settings.
一个通过已批准域名进行数据外泄的清晰案例来自第三方披露。Claude Cowork 的出站允许列表正确地将流量放行至 api.anthropic.com——该产品若不调用我们自己的 API 便无法运行。在此案例中,一个被放置在用户挂载工作区中的恶意文件携带了隐藏指令,以及一个由攻击者控制的 API 密钥。Claude 遵照这些指令,读取了工作区中的其他文件,并使用攻击者的密钥调用了 Anthropic 的 Files API。出站代理检查了目标地址,看到 api.anthropic.com,便将其放行。这些文件被上传到了攻击者的 Anthropic 账户。沙箱运行得完美无缺,然而数据还是被外泄了。
A clear example of exfiltration through an approved domain came from a third-party disclosure. Claude Cowork's egress allowlist correctly passed traffic to api.anthropic.com—the product can't function without calling our own API. In this case, a malicious file placed in the user's mounted workspace carried hidden instructions along with an API key controlled by the attacker. Claude, following the instructions, read other files in the workspace and called Anthropic's Files API using the attacker's key. The egress proxy checked the destination, saw api.anthropic.com, and let it through. The files were uploaded to the attacker's Anthropic account. The sandbox worked perfectly, and yet the data was exfiltrated.
此前,我们将允许列表概念化为一种目标过滤器,即告诉 Claude _这些域名是可以与之通信的。_ 但或许将其概念化为一种能力授予会更好。通过允许列表中任一域名可达的每一个功能,如今都成为了攻击面。允许 api.anthropic.com 就意味着允许向任意 Anthropic 账户上传文件。
Previously, we'd conceptualized the allowlist as a destination filter, something that told Claude _these domains are okay to talk to._ But it may be better conceptualized as a capability grant. Every function reachable through any domain on an allowlist is now an attack surface. Allowing api.anthropic.com meant allowing file uploads to arbitrary Anthropic accounts.
我们通过在 VM 内部署一个防御性中间人代理来修复该问题,该代理会拦截发往我们 API 的流量。它只放行携带 VM 自身所配置会话令牌的请求;攻击者嵌入的密钥会被代理拒绝。它还会阻止那些会启用服务端抓取的请求头。该代理位于 VM 内部而非我们的服务器上,因为只有 VM 知道来源——从服务器的视角看,一个 Cowork 请求与任何其他 API 客户端无法区分。
We fixed it using a defensive man-in-the-middle proxy inside the VM that intercepts traffic to our API. It only passes requests carrying the VM's own provisioned session token; an attacker-embedded key is rejected by the proxy. It also blocks headers that would enable server-side fetch. The proxy sits inside the VM rather than on our servers because only the VM knows provenance—from the server's perspective, a Cowork request is indistinguishable from any other API client.
这也是“你自己构建的软件往往是最薄弱环节”这一原则的第二个实例。我们各产品中的 hypervisor、seccomp 和 gVisor 一直都很可靠。失败的那一环,正是我们自研的允许列表代理。
This is also a second instance of the principle that the software you build yourself is often the weakest. The hypervisor, seccomp, and gVisor across our products have been dependable. Our custom allowlist proxy was the piece that failed.
在评估 Claude Cowork 时,企业安全团队问道:“为什么我们的 EDR 看不到内部?”答案是:将 Claude 遏制住的同一层隔离,也把基于主机的端点检测与响应挡在了外面。从 EDR 的视角看,Claude Cowork 是一个不透明的 hypervisor 进程,它无法检查 guest。
When evaluating Claude Cowork, enterprise security teams asked, "Why can't our EDR see inside?" The answer was that the same isolation keeping Claude contained also kept host-based endpoint detection and response out. From the EDR's perspective, Claude Cowork is an opaque hypervisor process. It can't inspect the guest.
隔离会降低可见性,而对于合规态势依赖端点可见性的团队来说,不透明性是个问题。我们目前的缓解措施是使用基于拉取的 OTLP 导出,让管理员在事后检索事件日志,但这与实时监控并不等同。如果你正在构建类似的东西,请尽早为这场对话预留预算。
Isolation reduces visibility, and opacity is problematic for teams whose compliance posture depends on endpoint visibility. Our current mitigation is to use pull-based OTLP exports that let administrators retrieve event logs after the fact, but this is not the same as live monitoring. If you're building something similar, budget for this conversation early.
服务端容器(由 gVisor + 主机基础设施边界防护)
Server-side container (guarded by gVisor + host infra boundary)
挂载的工作区(由 vsock + hypervisor 边界防护)
Mounted workspace (guarded by vsock + hypervisor boundary)
企业经常问我们如何保障 MCP 连接的安全。这是个好问题,但真正恰当的问题比 MCP 本身更宽泛。提供给智能体的任何外部资源都同时带来两种风险:传统供应链意义上的代码执行风险,以及提示注入的攻击向量。传统的依赖审计(固定版本、验证签名、审查源码)能应对第一种风险,却遗漏了第二种。
Enterprises often ask us how to secure MCP connections. It's a good question, but the right one is broader than MCP specifically. Any external resource provided to an agent represents two risks at once: a code execution risk, in the traditional supply-chain sense, and a prompt injection vector. Traditional dependency auditing (pinning versions, verifying signatures, reviewing source) addresses the first, but misses the second.
**远程与本地之别比看上去更重要。** 本地安装的工具是可审计的。你可以阅读代码、固定版本,并确信它不会在你眼皮底下发生变化。而远程工具——托管的 MCP 服务器、云连接器——可能在你批准之后的任何时刻改变行为;你安装时的信任决策可能已不再适用。我们的连接器目录通过持续审查来应对这一点,但目录之外的任何东西都应被视为不可信。先让它针对假数据运行,并且要在恶意工具的影响范围(blast radius)受到控制的环境中进行。
**Remote versus local is more important than it seems.** A locally installed tool is auditable. You can read the code, pin the version, and know it won't change under you. A remote tool—a hosted MCP server, a cloud connector—can change behavior at any point after you've approved it; your install-time trust decision may no longer apply. Our connector directory addresses this through ongoing review, but anything outside it should be treated as untrusted. Run it against fake data first, in an environment where the blast radius of a malicious tool is contained.
**即便工具可信,工具输出仍是攻击面。** 前面提到的 GitHub README 例子正是这种情况;任何应用于网页的输入扫描,都必须以同样的严格程度应用于具备网络访问能力的工具返回结果。尽管这会增加延迟,且并非完美的防御,我们仍倾向于实时检查:一旦被投毒的工具返回结果已诱导智能体外泄数据,日志只会显示一次成功的、经授权的 API 调用。事后根本找不到任何信号。
**Tool output is an attack surface even when the tool is trusted.** The GitHub README example mentioned earlier is exactly this case; any input scanning applied to web pages needs to be applied to network-enabled tool results with the same rigor. Even though this adds latency and isn't a perfect defense, we err toward live inspection: once a poisoned tool return has steered the agent into exfiltrating data, the log just shows a successful, authorized API call. There's no after-the-fact signal to find.
在 Claude Code 和 Claude Cowork 中,工具调用经由代理转发,这些代理会强制执行网络与文件策略,并能在返回值进入模型上下文之前对其进行检查。执行检查的分类器可以是一个小而快的模型;它不必是负责推理的那个模型。
In Claude Code and Claude Cowork, tool calls route through proxies that enforce network and file policy and can inspect return values before they enter the model's context. The classifier that does the inspection can be a small, fast model; it doesn't need to be the one doing the reasoning.
模型和产品正在快速进步。随着它们的发展,风险也在变形和演化,我们的缓解措施必须跟上步伐以应对这些风险。
Models and products are advancing fast. As they do, risks morph and evolve, and our mitigations must keep pace to meet them.
**持久性内存投毒。** 智能体上下文中跨会话持久化的部分持续增长——包括产品内存、CLAUDE.md 文件、挂载的工作区,以及定时和长期运行智能体的状态目录。任何注入到这些位置的恶意内容都会在智能体每次启动时被重新加载。随着越来越多的智能体状态在会话结束后存活,我们受到经典后利用意义上的新型持久化机制的威胁。会话启动时的良好分类器将需要变得更加普遍。
**Persistent memory poisoning.** The share of agent context that persists across sessions keeps growing—this includes product memory, CLAUDE.md files, mounted workspaces, and the state directories of scheduled and long-running agents. An injection that lands in any of these is reloaded each time the agent starts. As more agent state survives the session, we are threatened by new persistence mechanisms in the classic post-exploitation sense. Good classifiers on session startup will need to become more commonplace.
**多智能体信任升级。** 一方面,子智能体可以隔离不可信内容,向主智能体返回结构化事实而非原始文本。另一方面,这可以被滥用:如果子智能体的输出被视为比原始工具结果更可信,因为此类输出来自“我们”,就引入了提示注入的新向量。在多智能体系统中,在分配不同信任级别与易于发生信任升级之间存在权衡。
**Multi-agent trust escalation.** On the one hand, sub-agents can isolate untrusted content, returning structured facts rather than raw text up to the main agent. On the other hand, this can be abused: if a sub-agent's output is treated as higher-trust than raw tool results, because such output came from “us,” a new vector for prompt injection is introduced. In multi-agent systems, there is a tradeoff between allocating differing trust levels and becoming liable to trust escalation.
**智能体身份。** Claude Cowork 对智能体身份的答案是具体的:凭证保留在主机钥匙串中,虚拟机获得每个会话的降权令牌,并且该令牌可以独立于用户令牌被撤销。然而,我们开始应对跨平台智能体身份这一更广泛的问题。智能体应该拥有自己的主体身份,还是应该作为用户的扩展并继承用户的权限?最终,答案可能是两者的融合。
**Agent identity.** Claude Cowork's answer to agent identity is concrete: credentials stay in the host keychain, the VM gets a per-session scoped-down token, and that token can be revoked independently of the user's. However, we are starting to grapple with the broader question of cross-platform agent identity. Should an agent possess its own principal identity, or should it act as an extension of the user and inherit the user’s permissions? Ultimately, the answer may be a blend of the two.
随着智能体能力增强,攻击面不断变化。我们所见过的故障类型可能会在各行业和实验室中重复出现。我们需要对智能体特定的安全态势进行集体投资,从共享基准和披露规范到通用身份标准和跨供应商红队演练。本文关注遏制,但这只是智能体安全图景的一部分。关于治理、可观测性及技术栈的其余部分,请参阅 NIST 关于 AI 智能体身份和授权的项目、由澳大利亚 ACSC 与 CISA 和英国 NCSC 领导的关于采用智能体式 AI 的六机构指南,以及 AI 管理标准 ISO/IEC 42001。我们的 Glasswing 倡议是一项贡献,但我们期待与合作伙伴和竞争对手在这个关键问题上合作。
As agents grow more capable, attack surfaces are constantly shifting. The types of failures we’ve seen are likely to be repeated across industries and labs. We need collective investment in agent-specific security posture, from shared benchmarks and disclosure norms to common identity standards and cross-vendor red-teaming. We focus on containment in this piece, but that's only one part of the security picture for agents. For governance, observability, and the rest of the stack, see NIST's project on AI agent identity and authorization, the six-agency guidance on adopting agentic AI led by Australia's ACSC with CISA and the UK's NCSC, and ISO/IEC 42001, the AI management standard. Our Glasswing initiative is one contribution, but we look forward to working with both partners and competitors on this critical issue.
简而言之,有几条原则是我们反复回到的:
In short, there are a few principles we keep returning to:
**首先在环境层设计遏制,然后在模型层引导行为。** 给我们教训最深的两起事件——员工钓鱼事件和第三方允许列表泄露事件——都是数据外泄(egress)的案例,即数据通过一条被允许的路径离开了系统。在这两起事件中,模型层都无能为力;没有任何异常可供它捕捉。当所有概率性手段都失效时,被触发的正是确定性边界。
**Design for containment at the environment layer first, then steer behavior at the model layer.** Two of the incidents that taught us the most—the employee phish and the third-party allowlist disclosure—were both cases of egress, in which data left through a permitted path. In each, the model layer couldn't help; there was nothing anomalous for it to catch. The deterministic boundary is what gets hit when everything probabilistic misses.
**让隔离强度与用户的监督能力相匹配。** 一个能读懂 bash 的开发者与一个读不懂的知识工作者,所面对的威胁模型并不相同。用户能否评估智能体即将做什么,这一问题应当有助于确定遏制策略;而无论朝哪个方向答错——对专家施加过多摩擦,或对非专家给予过多信任——本身就是一种失败。
**Match isolation strength to the user's capacity for oversight.** A developer who can read bash and a knowledge worker who can't are not running the same threat model. The question of whether a user can evaluate what an agent is about to do should help determine the containment strategy, and answering it wrong in either direction—too much friction for experts, too much trust for non-experts—is its own failure.
**警惕自定义组件。** 久经考验的 hypervisor、系统调用过滤器和容器运行时,所经受过的对抗性关注远超你将构建的任何东西。在本文描述的每一次部署中,标准原语都经受住了考验,而我们围绕它们所做的工作反而暴露了缺陷。
**Be wary of custom components.** Battle-tested hypervisors, syscall filters, and container runtimes have survived more adversarial attention than anything you'll build. Across every deployment described here, the standard primitives held while our own work around them exposed flaws.
归根结底,智能体或许是一类新的软件,但它们的系统级交互并不新。它们仍然要读取文件、打开套接字、创建进程;这使得借助成熟工具实施遏制成为一种至关重要且可行的防御手段。随着 AI 的发展,部署的风险—收益平衡将持续变化,但对爆炸半径施加硬性限制,往往能推动这一平衡朝正确的方向移动。
Ultimately, while agents may be a new category of software, their system-level interactions are not. They still read files, open sockets, and spawn processes; this makes containment with mature tooling a crucially viable defense. The risk-reward balance of deployments will keep shifting as AI develops, but placing a hard limit on blast radius often forces that balance into the right direction.