AI agent permissions, sandboxing and sandbox escapes

Permissions and sandboxing decide what an AI agent can run or touch, and most controls cover only part of the agent. This page explains what the MCP spec, OS-level sandboxes and a published escape do and do not contain.

On this page

Can AI agent permissions and sandboxing contain what an agent runs?

Containment of an AI agent is partial, and it depends on each tool. The Model Context Protocol (MCP) specification says there should always be a human in the loop with the ability to deny tool invocations, and it treats tools as arbitrary code execution. That denial right is a control you must confirm in the client you approve, not something the protocol enforces on its own. Sandboxing is available only where the client or vendor provides it. For example, Claude Code's Bash sandbox is optional, off by default, and covers only Bash commands. Its built-in file and web tools, hooks and local MCP servers fall outside it and run under permission rules or with full access. Before approving a coding agent or MCP setup that runs commands and reads files, ask the vendor which execution paths the sandbox covers and which run unsandboxed.

The practical question is therefore a capability question for each tool and each plan or edition. For every candidate, confirm three things: whether approval prompts can be enforced by an administrator or only set by the user, which operating-system sandbox applies and to which tools, and whether network access is limited to listed domains. The MCP security best practices page recommends running local MCP server commands in a sandboxed environment with minimal default privileges, using containers, chroot or application sandboxes, so ask who in your environment is responsible for that setup. Settings that users can relax, such as auto-approve modes, change the answer, so record the configuration you intend to allow.

This page covers only how an agent's actions are contained, including one published sandbox escape, which shows why the agent's configuration and the repositories it opens need controls. The risk categories a reviewer should check are covered on the sibling page on the OWASP agentic top 10, and the policy frameworks and approval processes are covered on the sibling page on AI agent governance frameworks and policy. Use those pages to decide what the agent may be allowed to do, and use this one to test whether the tool can hold that line.

Containment controls by tool, edition and option

This table compares containment controls for MCP and Claude Code across what ships by default, what needs a paid edition or an outside component, and what the control does not cover. Read each row as a question to confirm with the vendor and your own endpoints. The main takeaway is that a sandbox on one execution path does not contain the agent as a whole.

ControlBuilt inPaid edition or outside componentNot covered or to confirm
MCP human-in-the-loop denialThe MCP tools spec says a human should always be able to deny tool invocations.Depends on the host client. Confirm the client shows approval prompts and cannot skip them.Clients must treat tool annotations as untrusted unless they come from trusted servers.
MCP client sandboxing for local serversThe MCP security best practices say to run local server commands in a sandbox with minimal default privileges.Containers, chroot or application sandboxes supplied and operated by your platform team.This is guidance. Verify whether each client actually applies a sandbox to local servers.
Claude Code Bash sandboxSeatbelt on macOS and bubblewrap on Linux and WSL2. Off by default, so it must be enabled.Confirm with Anthropic whether admins can enforce the setting on managed devices.Network access passes through a proxy that allows only listed domains. Review the domain list.
Claude Code permission rules for file and web toolsPermission rules govern built-in file and web tools.Confirm how admins distribute and lock permission rules across developer machines.The Bash sandbox does not cover built-in file and web tools. They run under permission rules.
Hooks and local MCP servers in Claude CodeHooks and local MCP servers run under permission rules or with full access.Container or VM isolation your team provides and operates.Outside the Bash sandbox. A local server can act with the full access of the user account.
Sandbox escape fix in version 2.1.163Fixed in 2.1.163 (GHSA-7835-87q9-rgvv, CVE-2026-55607, CVSS 7.7).Confirm every endpoint runs 2.1.163 or later and track future advisories.The escape required a malicious repository and prompt injection. The fix does not close the gaps above.

How approval rules and OS sandboxes divide the work

Containment for an AI agent comes from two separate layers, and a reviewer should not treat one as a substitute for the other. The first is the host consent and approval step that sits before a tool call. The MCP tools specification says there should always be a human in the loop with the ability to deny tool invocations, and it says clients must treat tool annotations as untrusted unless they come from trusted servers. A readOnlyHint or similar label written by a server is therefore a hint for the client to display, not a guarantee that a call is safe to run without a prompt. The second layer is the OS-level sandbox wrapped around a process such as a shell command. The MCP security best practices page asks clients to run local server commands in a sandboxed environment with minimal default privileges, using containers, chroot or application sandboxes. Confirm which of these layers each tool in your environment uses, and whether auto-approve or equivalent settings can skip the first one.

The sandbox boundary is narrower than the approval boundary, and the gap matters. Claude Code's optional Bash sandbox, which uses Seatbelt on macOS and bubblewrap on Linux and WSL2, is off by default and routes network traffic through a proxy that permits only listed domains. Anthropic's documentation states that the sandbox does not cover the built-in file and web tools, hooks or local MCP servers, which run under permission rules or with full access. A file read or write can therefore sit outside the kernel-level boundary even when shell commands are contained. Ask the vendor which of its tools fall inside the sandbox in your configuration, and whether the proxy's domain list is set centrally or per user.

The practical decision is where to enforce policy for each capability. Shell execution is a good candidate for the OS sandbox, while file access, outbound web calls and local MCP servers may need permission rules, deny lists or managed settings that an administrator controls. Record which control answers each question: who approves a call, what the process can reach, and what happens to a file tool that the sandbox does not wrap. The published sandbox escape described in GHSA-7835-87q9-rgvv, tracked as CVE-2026-55607 with a CVSS score of 7.7 and fixed in version 2.1.163, required a malicious repository and prompt injection content, which is why pinning versions and reviewing repositories an agent may open belong in the same rollout plan as the permission settings.

Decisions to make before approving containment

Containment for a coding agent is a set of settings, and each one decides how far the agent can reach without a person stopping it. The cards below cover the choices a reviewer should settle in writing before approval, because the default position on several of them is permissive.

Which tools run without approval

The MCP tools specification expects a human in the loop who can deny tool invocations, and it treats tool annotations as untrusted unless they come from trusted servers. Any tool, command or edit that a product lets the agent run without a prompt is an action no reviewer approved in the moment. Ask which tools are pre-approved, who can add to that list, and whether an auto-approve or unattended mode exists and can be disabled for your staff.

MCP tools spec

Whether the Bash sandbox is on

In Claude Code, the Bash sandbox is an optional feature and it is off by default. When it is on, shell commands run inside an OS-level sandbox (Seatbelt on macOS, bubblewrap on Linux and WSL2). When it is off, shell commands fall back to the permission rules alone. Confirm whether the setting can be enforced centrally across all staff devices, or whether each user chooses it for themselves.

Sandboxing docs

Network domain allowlist

The sandbox proxy allows only the network domains a team lists, so the allowlist determines where an agent can send data or fetch instructions. Each domain added for convenience, such as a package registry or a general documentation site, is a path for exfiltration if the agent is manipulated by hostile content. Ask who maintains the list, how changes are reviewed, and whether the agent can reach web fetch tools that sit outside the sandbox.

Local MCP servers and their isolation

The MCP security best practices say clients should run local MCP server commands in a sandboxed environment with minimal default privileges, using containers, chroot or application sandboxes. Claude Code's sandbox does not cover local MCP servers, which run under permission rules or with full access. Inventory every local server, decide which ones run in a container or application sandbox, and deny those that cannot be isolated.

MCP security practices

Which repositories the agent may open

The agent's reach follows the repositories and directories it is allowed to open. A repository that contains hostile instructions in its files, issues or configuration can change what the agent does once it opens. The published escape GHSA-7835-87q9-rgvv required running the agent on a malicious repository with prompt injection content and was fixed in 2.1.163. Set a rule for which repositories are trusted, and treat untrusted code as untrusted input.

Published advisory

Who owns approval rule changes

Permission rules, sandbox settings and MCP server lists change over time, and each change alters containment for every user it reaches. Name one owner in IT or security who approves changes, record them in version control, and review them on a set schedule. Confirm whether managed settings can stop users from overriding the rules on their own machines, because a rule that a developer can edit locally is a suggestion, not a control.

What the Claude Code git worktree escape shows

The published advisory GHSA-7835-87q9-rgvv (CVE-2026-55607, CVSS 7.7) is the clearest recent case that a sandbox is only as reliable as the code paths it covers. It describes a Claude Code sandbox escape caused by git worktree path confusion. The attack needed two conditions: the agent had to run on a malicious repository, and that repository had to carry prompt injection content that steered the agent. The fix shipped in version 2.1.163. For a reviewer, the lesson is that the attacker did not need to break the operating system sandbox directly. They needed the agent to read untrusted repository content and act on it, which is the pattern OWASP's ASI05 Unexpected Code Execution describes as a core agentic risk.

Several controls would have limited the impact. First, pin the Claude Code version that engineers run and require that upgrades pass review, so that a known fixed release is deployed everywhere and an unreviewed version cannot quietly reach laptops. Second, define a policy for which repositories an agent may open, and require explicit approval before the agent works in a repository from an external or unreviewed source. Third, apply least privilege: the agent's credentials, network reach and writable paths should be limited to what the task needs, so that a successful escape reaches less. Confirm with the vendor which settings in managed configuration enforce version and permission rules, since the sandbox itself is optional and does not cover built-in file and web tools or local MCP servers.

Version control of agent configuration and agent versions matters for the same reason. Illustrative scenario: a team stores its permission rules, hook definitions and MCP server list in a repository, and a change to those files is reviewed like any other code change. When an advisory appears, the security team can see which version each developer ran, which configuration was active and when it changed, and can roll back a risky change without relying on memory. Ask the vendor how its advisories map to affected versions and whether managed settings can be held in a reviewed source of truth.

Gaps that outside controls must cover

The built-in sandbox of a coding agent is one layer, and it is often optional or narrow in scope. The cards below cover the gaps a reviewer should expect and the outside control that usually closes each one, so that permissions, approvals and patching do not depend on the agent vendor's defaults alone.

Built-in tools and local servers sit outside

The Claude Code sandbox does not cover its built-in file and web tools, hooks or local MCP servers. Those run under permission rules or with full access. Ask which of the agent's tools fall inside the OS-level sandbox and which do not. Usual outside control: run the whole agent process inside a container or VM, and treat local MCP server commands as code that needs the same isolation.

Sandboxing docs

Sandbox may be off by default

The optional Bash sandbox in Claude Code is off by default, so a team that installs the agent without changing settings may run shell commands with no OS-level containment. Confirm whether the sandbox is enabled in every managed configuration and whether users can switch it off. Usual outside control: managed settings review on each device, plus a baseline that enforces the sandbox before the agent reaches company code.

Sandboxing docs

Approval fatigue under auto-approve modes

Auto-approve and YOLO-style modes remove the human step that the MCP tools spec expects, which requires a human in the loop able to deny tool invocations. When prompts arrive constantly, users tend to approve them without reading. Ask which modes are allowed for staff and whether the platform can block them. Usual outside control: restrict approval modes through managed policy and log every approval decision centrally.

MCP tools spec

Prompt injection reaching tool annotations

The MCP tools spec says clients must treat tool annotations as untrusted unless they come from trusted servers. A malicious server or repository can still shape what a tool claims to do, such as calling itself read-only, and a reviewer should not rely on that label to skip approval. Usual outside control: allowlist which MCP servers the client may load, and require a human check for any tool that writes, deletes or sends data.

MCP tools spec

No containment for agent-run credentials

A sandbox limits what a process can touch on disk and on the network, but credentials the agent already holds, such as cloud keys, deploy tokens or a logged-in git account, may still be usable from inside the session. Confirm which secrets are present in the environment the agent runs in and whether they are scoped to read-only or short-lived access. Usual outside control: use dedicated low-privilege identities for agent work and keep production secrets out of the agent's environment.

Sandbox escapes depend on patch level

The published escape in GHSA-7835-87q9-rgvv (CVE-2026-55607, CVSS 7.7) used git worktree path confusion and needed a malicious repository with prompt injection content. It was fixed in 2.1.163, so an unpatched install stays exposed even when the sandbox is on. Usual outside control: track the vendor's advisories, pin approved agent versions, and check that every developer machine runs the fixed release.

Security advisory

How the answer changes by environment

On a laptop, the most common containment layer is the tool's own OS-level sandbox. Claude Code's optional Bash sandbox, for example, uses Seatbelt on macOS and bubblewrap on Linux and WSL2, and it routes network traffic through a proxy that allows only listed domains. The sandbox is off by default, and the vendor documents that it does not cover built-in file and web tools, hooks or local MCP servers, which run under permission rules or with full access. The MCP security best practices page says clients should run local MCP server commands in a sandboxed environment with minimal default privileges, using containers, chroot or application sandboxes.

  • Confirm the sandbox is on: Check whether the sandbox is enabled by policy on managed devices, since it is off by default.
  • Scope the gaps: List which tools, hooks and local MCP servers sit outside the sandbox and set permission rules for each.
  • Restrict credentials: Keep cloud keys, SSH keys and tokens out of the developer's home directory where the agent can read them.
  • Control approvals: Decide whether auto-approve modes are allowed on company devices.
  • Patch the tool: Track vendor advisories and confirm the installed version includes each fix.

Ask the vendor which sandbox covers which tools on each operating system your staff use, and whether administrators can enforce the setting centrally.

Order of work before a containment control goes live

This sequence moves from knowing what an agent can reach, to setting the approval baseline, to enabling and testing each containment layer, and ends with evidence that the controls held. Each step closes with an output a reviewer can check before the tool is approved for staff use.

  1. Inventory tools and MCP servers

    The platform or security team lists every tool the agent can call, including built-in file and web tools, shell access, and each MCP server a client connects to, with the server's source and the credentials it holds. Ask the vendor which of these sit inside its sandbox and which run under permission rules or with full access, because that split decides where you need compensating controls. The step is done when every tool has an owner, a data scope and a sandbox status recorded in one register.

  2. Decide the approval baseline

    Security and engineering leaders set which actions run without a human decision and which require explicit approval. The MCP tools specification says there should always be a human in the loop with the ability to deny tool invocations, and that clients must treat tool annotations as untrusted unless they come from trusted servers, so the baseline should not rely on a server's own description of a tool's risk. The output is a written approval matrix that names who may change it and where the setting is enforced.

  3. Enable and test the OS sandbox where offered

    Where the coding agent provides an operating-system sandbox, the endpoint team turns it on in a test group and confirms it works on each operating system in use. Some sandboxes are off by default, so confirm the setting in managed configuration rather than trusting a developer's local choice. The step closes when a test run shows the agent cannot write outside the allowed project paths and that the setting is enforced on managed devices.

  4. Restrict network domains

    The team limits outbound traffic from the agent to a listed set of domains approved by security, using the vendor's proxy or an egress control the company already runs. Confirm which traffic the proxy does not see, such as tools that open their own connections, and close those paths or document them as accepted risk. The output is an egress test that shows requests to an unlisted domain fail and are logged.

  5. Containerize local MCP servers

    The MCP security best practices page says clients should run local MCP server commands in a sandboxed environment with minimal default privileges, using containers, chroot or application sandboxes. Engineering runs each local server in a container or equivalent with only the mounts and credentials it needs, and confirms it cannot reach host secrets or the wider network. The step is done when a documented configuration shows each server's privileges and a test confirms the restriction.

  6. Pin and track agent versions

    Platform engineering pins the agent client and each MCP server to a reviewed version through managed distribution, and records a process for reviewing security advisories and releases. A reported sandbox escape in Claude Code, GHSA-7835-87q9-rgvv (CVE-2026-55607), was fixed in version 2.1.163, so the team needs to confirm its installed version against each vendor's advisory list. The output is a version inventory with an owner who can block or roll back a release.

  7. Test with a prompt-injection scenario

    Security testers run a scripted scenario, in an isolated environment, where the agent works on a repository containing hostile instructions, such as a file that tries to make the agent change its own settings or read credentials. This matches the conditions in the published Claude Code escape, which required a malicious repository with prompt injection content. Testers record whether the sandbox, the approval prompts and the network rules each stopped the attempt. The step closes with a written result for each control, and any control that failed goes back to the baseline step.

  8. Review approval and action logs

    Before go-live, the security team reviews the approval records and tool-call logs from the test runs to confirm that denials, approvals and blocked network requests are all captured with the user, tool and time. Confirm which logs the vendor retains, for how long, and whether they can be exported to the company's SIEM. The step is done when a reviewer can reconstruct one test session end to end from the logs alone, and the findings are signed off before staff access is granted.

What a security reviewer asks to see

This table lists the evidence a reviewer should request before approving a coding or workflow agent that can run commands, and where each item comes from. Read each row as a question to put to the vendor and to your own platform team, since a written policy alone does not show that sandboxing is enforced on every machine. The main takeaway is that the sandbox, the approval rules and the agent version each need their own record, because a sandbox escape shows that a contained tool can still be compromised.

Evidence itemWhy it mattersWhere it comes from
Written approval baselineShows which tool actions run without a human decision, such as reads, edits or shell commands, and who may widen that list.Tool permission rules and approval mode settings in the tool, plus the organization's signed policy for each team.
Sandbox setting and enforcement statusA sandbox that is optional or off by default protects only the machines where someone turned it on. The reviewer needs to know it is on everywhere.Vendor sandbox documentation for the exact platform (macOS, Linux or WSL2), and a managed configuration export from a sample of endpoints.
Network allowlistLimits which domains a sandboxed command can reach, which reduces data leaving the machine through commands the agent runs.The allowlist file or managed setting, the proxy configuration, and a log of blocked requests from a recent sample period.
MCP server isolation recordsLocal MCP servers can run outside the sandbox with full access, so each one needs a recorded owner, approved command and privilege level.An inventory of approved MCP servers, with launch commands and containment method, checked against the MCP security best practices.
Agent version and advisory trackingA known sandbox escape is only controlled if the deployed version is recorded and at or above the fixed release.The installed version reported on each endpoint, the vendor's security advisory list, and a dated patch record in your change system.
Test results for an escape scenarioShows that the controls hold when the agent reads hostile content, such as a repository with prompt injection text, instead of relying on the vendor's claim.An internal test plan run in a non-production environment, with the repository, prompts, permissions and results retained as evidence.
Version control of agent configurationChanges to permissions, sandbox settings and MCP servers should be reviewed and traceable, so a silent loosening is visible to the reviewer.The repository or managed settings history that stores agent configuration, with review approvals and the identity of each change author.

Questions buyers ask before approving agent containment

Is a sandbox enough on its own to contain a coding agent?

No. A sandbox limits what the agent's shell commands can reach, but it is one layer. Claude Code's optional Bash sandbox uses Seatbelt on macOS and bubblewrap on Linux and WSL2, with a proxy that allows only listed network domains. The same documentation states that the sandbox does not cover the built-in file and web tools, hooks or local MCP servers, which run under permission rules or with full access. The MCP security best practices page also asks clients to run local MCP server commands in a sandboxed environment with minimal default privileges. A reviewer should map every execution path the agent has, then confirm which layer covers each one: sandbox, permission rules, human approval, or none. The GHSA-7835-87q9-rgvv advisory, which involved a git worktree path confusion escape fixed in 2.1.163, is a reason to keep these layers and the agent's repository inputs under version control and review.

Does turning on agent sandboxing require a paid plan?

It depends on the product and the plan, so confirm it against the vendor's current plan matrix for the exact edition you will buy. For Claude Code, the supplied material establishes that the Bash sandbox is optional and off by default, which means an administrator or user must enable it. It does not establish which plan tiers include it, so ask the vendor to confirm that in writing. Also ask whether the setting can be enforced through managed settings so that individual users cannot switch it off. Those two questions, plan entitlement and enforceability, determine whether the control is a policy or a suggestion.

Who does the configuration work, and what makes it take longer?

The vendor provides the product settings, and the customer or its implementation partner writes the policy. Effort rises with the number of agent surfaces in use, the number of MCP servers that need local execution, the size of the allowlist for network domains, and whether developers already depend on broad shell access. Each permission rule needs an owner who can justify it. Teams that run agents on managed devices usually spend more time on device policy than on the sandbox flags themselves. Ask any partner for a written scope that lists the surfaces, the rules, the test cases and the evidence to be delivered, because that scope is what drives the quote.

Can our own security team do this internally?

Often yes, if the team already runs endpoint policy and can read the agent's permission model. The work divides into three parts: inventory of agent surfaces and tools, written permission and approval rules, and verification that the rules hold on real repositories. The verification step is where internal teams most often need outside help, especially for prompt injection scenarios such as a malicious repository. DeployOpen can plan and implement self-hosted platform controls and run security testing of AI systems and agents in your own environment, under a fixed written scope. It does not issue audit reports or certifications, so independent assessors remain necessary for formal assurance.

How long does a containment rollout take?

No duration is supplied for this work, so confirm it in a scoped quote. The timeline depends on how many agent surfaces are in scope, whether the approval model must be changed for existing users, and how much testing against hostile repositories the reviewers require. Ask for milestones tied to deliverables, such as an inventory, a policy draft, a test run and a sign-off meeting, rather than a single end date. Engagements are usually fixed-scope, so the scope document should state the timeline and what triggers a change to it.

How do the NIST AI RMF and the OWASP agentic list relate to these controls?

They supply the reasons and the vocabulary, while the controls are the mechanisms. The NIST AI Risk Management Framework 1.0, released on January 26, 2023, is intended for voluntary use and organizes AI risk work into functions that an organization can adapt. The OWASP Top 10 for Agentic Applications for 2026, published on December 9, 2025, lists risks such as ASI05 Unexpected Code Execution, which maps directly to the sandbox and approval questions on this page. A practical approach is to record each control here as the response to a named OWASP risk, then document the owner and the evidence under the NIST functions your governance program uses. Neither source certifies a product or substitutes for an independent assessment.

Primary sources to check each claim against

Before approving any claim about how an agent's actions are contained, read the primary source yourself. The MCP tools specification is the starting point: it states that a human should remain in the loop with the ability to deny tool invocations, and that clients should treat tool annotations as untrusted unless they come from trusted servers. Check that your vendor's approval prompts and deny controls match that wording, not the vendor's summary of it. The companion MCP security best practices page confirms that local MCP server commands should run in a sandboxed environment with minimal default privileges, using containers, chroot or an application sandbox.

For a coding agent's built-in sandbox, the Claude Code sandboxing documentation is the authority on scope. It confirms the Bash sandbox is optional and off by default, and that it does not cover built-in file and web tools, hooks or local MCP servers. Ask your administrator to confirm which settings are enforced at the organization level in your deployment, and which depend on each developer's choice. The GHSA-7835-87q9-rgvv advisory shows what a sandbox escape looked like in practice: a git worktree path confusion issue that required running the agent on a malicious repository with prompt injection content, fixed in version 2.1.163. Confirm that your installed version is at or above that fix and that your review process covers repositories the agent opens.

Finally, the OWASP announcement for the Top 10 for Agentic Applications places unexpected code execution (ASI05) among the top ten agentic risks, which is the category a sandbox is meant to contain. Use it to frame your review, and use the full OWASP Top 10 for Agentic Applications for 2026 document for the detailed risk descriptions. Record the version and date of each source you cite in your approval file, since guidance on this topic changes quickly.

How DeployOpen tests and hardens agent containment

DeployOpen plans, tests and hardens the containment around AI agents inside the client's own infrastructure, including permission rules, sandbox boundaries and the review of agent configuration that is kept under version control. The work is delivered as a fixed scope agreed in writing, with ongoing support available as a retainer.

How we scope

  • Written scope names each agent, tool and MCP server in the permission review and which actions each one may take.
  • Scope records which sandbox layers apply, such as the coding agent's shell sandbox, built-in file and web tools and local MCP servers.
  • Scope states which network destinations, repositories and credentials each agent can reach, and which must stay out of reach.

How we build

  • We configure permission rules, human approval settings and client allowlists to match the written scope for each agent.
  • We run adversarial tests against containment, including prompt injection through untrusted repositories and attempts to reach files outside the working directory.
  • We check that agent configuration, hooks and tool definitions are stored in version control with review before changes take effect.

How we hand over

  • Deliverables include the permission and sandbox configuration, test cases, results and the list of known gaps in each control.
  • Documentation explains which containment controls the tool vendor provides, which DeployOpen configured, and which remain the client's responsibility.
  • Handover includes a runbook for reviewing agent configuration changes and for responding when a sandbox or permission rule fails.

How we support

  • Ongoing support is available as a retainer for reviewing permission changes after tool upgrades and new sandbox releases.
  • Continuous testing can be added to the retainer to repeat containment tests as agents, MCP servers and advisories change.
  • Clients confirm vendor advisory fixes, such as those listed in the vendor's security advisories, are applied and retested in their own environment.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.