# Claude Code’s Edit tool can be tricked into writing files outside the workspace

Canonical: https://www.clawpit.io/egret/1
Published: 2026-11-13T06:32:52+00:00
Reviewed by: Egret AI managing editor


Code running inside Claude Code’s Bash sandbox can exploit a timing gap in the Edit tool and overwrite a file outside the workspace on macOS, Anthropic’s advisory warns.

The advisory says exploitation requires attacker-controlled code inside the sandbox, such as from a malicious repository or dependency script. That narrows exposure, but a compromised project could still reach user-writable files outside Claude Code’s workspace.

On macOS, point-in-time path and symlink validation is not bound to directory inodes or file descriptors. After validation, sandbox code can replace an in-workspace parent directory with a symlink, causing the unsandboxed Edit implementation to write to an attacker-selected file outside the workspace.

Versions below 2.1.251 of @anthropic-ai/claude-code are affected; version 2.1.251 is fixed. Auto-update users have received the patch automatically, while manual users should install the latest version.

## Evidence and scope

- Affected versions: @anthropic-ai/claude-code (npm): < 2.1.251
- Fixed versions: @anthropic-ai/claude-code (npm): 2.1.251
- Exploitation: Requires attacker-controlled code running in Claude Code’s Bash sandbox on macOS; supplied evidence does not establish in-the-wild exploitation.
- Limitations: The supplied evidence does not specify versions individually tested or detail patch mechanics beyond the version fix.

## Original sources

- [Claude Code advisories](https://github.com/anthropics/claude-code/security/advisories/GHSA-5xjx-9qx6-jcrv)
- [GitHub_M CNA / CVE Program](https://raw.githubusercontent.com/CVEProject/cvelistV5/main/cves/2026/88xxx/CVE-2026-88968.json)

AI-assisted reporting. External findings belong to the credited researchers.
