A Claude Code race between the sandboxed shell and the file tools
A high-severity Claude Code advisory shows code inside the Bash sandbox steering the unsandboxed Edit tool. What it means for how you isolate coding agents.
Sandboxing a coding agent is usually described as one boundary: the agent is either inside it or not. A Claude Code advisory published on 26 October 2026 is a useful reminder that the boundary has a shape. GHSA-5xjx-9qx6-jcrv describes code running inside the Bash sandbox on macOS steering the Edit tool, which runs outside it, into overwriting a file beyond the workspace. The fix is in Claude Code 2.1.251. The lesson applies to any agent that splits its tools between a sandbox and the host.
What the advisory says
According to the advisory, Claude Code checked where an Edit was going to write using "point-in-time pathname and symlink resolution that was not bound to the underlying directory inodes or file descriptors." That leaves a gap between the check and the write. A process inside the sandbox could use it by "atomically swapping an in-workspace parent directory with a symlink after validation completed", so that the Edit implementation, which is not sandboxed, overwrote a user-writable file of the attacker's choosing outside the workspace.
The key facts:
- Affected: Claude Code versions below 2.1.251, on macOS.
- Fixed in: 2.1.251. Users on the standard auto-update received the fix automatically; anyone who updates manually is advised to move to the latest version.
- Severity: rated high, with a CVSS 4.0 score of 7.7. The weaknesses listed are improper link resolution (CWE-59) and a time-of-check to time-of-use race (CWE-367).
- Precondition: the attacker needs to run code inside the sandbox, which the advisory says could happen "through a malicious repository or dependency script".
- Credit: reported by Sunder Singh.
The advisory does not give a release date for 2.1.251. As we noted with earlier Claude Code advisories, the fix may have shipped some time before the advisory appeared, so check versions rather than assuming you are exposed or safe based on the publication date.
Why this one is different
We covered a similar-sounding issue, GHSA-5j29-h97v-84ch, in that earlier article: a symlink swapped into the workspace by someone with write access to it. The new advisory has a different and more interesting attacker. It is not another user of a shared folder. It is the code the agent itself was asked to run, from inside the sandbox that was supposed to contain it.
The sandboxing documentation explains why that is possible. The sandbox applies to the Bash, PowerShell and Monitor tools. The Read, Edit, Write and WebFetch tools are governed by permission rules, not by the sandbox, and hooks, MCP servers and language servers also run outside it. So a session has two kinds of code: commands confined by the operating system, and file tools that act with the user's full rights but are pointed at paths the confined code can influence.
That split is a deliberate design choice, and permission rules can be precise about which files the tools may touch. But wherever confined and unconfined code share a directory, the confined side can try to change what the unconfined side sees between a check and an action. A symlink race is the classic way to do it.
What the sandbox does and doesn't cover
The sandboxing documentation gives the settings that matter here:
- The sandbox is off by default. If you have not turned it on, this advisory's precondition is easier to meet, not harder: dependency scripts already run with the user's rights.
failIfUnavailablemakes Claude Code stop rather than run unsandboxed when the sandbox can't start.allowUnsandboxedCommands: falseremoves the option for commands to run outside the sandbox.- Protected paths and the handling of symlinks for protected settings files limit what file writes can reach.
The documentation also makes a broader point: for strong isolation, run the whole Claude Code process inside a container or virtual machine. That is the configuration in which this class of bug matters least, because an unsandboxed file tool can only reach what the container holds.
We set out the general options in sandboxing coding agents. This advisory adds a specific design question to that list: which of the agent's tools are inside the boundary, and which are outside it acting on the same files?
What it means for engineering and security leaders
There are two readings of an advisory like this, and both are right. The narrow one is that a specific race on macOS was found and fixed, and auto-update delivered it. The broad one is that tool-level sandboxing gives weaker guarantees than process-level isolation, because the agent's own tools straddle the boundary.
For most teams the practical conclusion is not to abandon the built-in sandbox, which raises the cost of many attacks. It is to stop describing it as isolation of the agent. It isolates the agent's shell. If your risk assessment says "the agent runs in a sandbox", check whether that sentence is true of the file tools, hooks and MCP servers too. In Claude Code, by its own documentation, it isn't.
The precondition also deserves attention. Running code from a repository or a dependency is not an exotic step; it is what coding agents do all day when they install packages and run tests. Treat any repository the agent opens as able to run code, and design for that.
Practical takeaways
- Confirm that every macOS computer running Claude Code is on 2.1.251 or later, especially any where auto-update is disabled or installs are managed by hand.
- If you rely on the sandbox, set
failIfUnavailableandallowUnsandboxedCommands: false, so commands can't end up running outside it. - Keep protected paths configured, including shell profiles and the agent's own settings files.
- For untrusted repositories, run the whole agent in a container or virtual machine rather than relying on tool-level sandboxing.
- Review where your agent's hooks and MCP servers run. They are outside the sandbox too.
- In internal guidance, describe the built-in sandbox as a shell sandbox, so nobody assumes it covers file edits.