Claude Code: TOCTOU Race in Edit Tool Allows File Writes Outside the Workspace
Claude Code validated Edit tool targets using point-in-time pathname and symlink resolution that was not bound to the underlying directory inodes or file descriptors. On macOS, a process running inside Claude Code's Bash sandbox could exploit the resulting time-of-check to time-of-use (TOCTOU) window by atomically swapping an in-workspace parent directory with a symlink after validation completed, causing the unsandboxed Edit implementation to overwrite an attacker-selected user-writable file outside the workspace.
Exploiting this required the ability to run attacker-controlled code inside the sandbox, such as through a malicious repository or dependency script.
Claude Code thanks hackerone.com/mahoraga007 (Sunder Singh) for reporting this issue.
What to do
Users on standard Claude Code auto-update have received this fix automatically. Users performing manual updates are advised to update to version 2.1.251 or the latest version.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| npm package | @anthropic-ai/claude-code | < 2.1.251 | 2.1.251 |
References
- CVSS vector
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N- Weakness (CWE)
CWE-367, CWE-59- Platform
- npm
- Package
@anthropic-ai/claude-code- Disclosed
- 09.11.2026
- Updated
- 11.11.2026 10:00
Sources and licenses · Edited or translated by DockRay; source rights and applicable licenses are retained.
OSV / GitHub Advisory Database - GHSA-5xjx-9qx6-jcrv - CC BY 4.0
Vulnerability history: @anthropic-ai/claude-code
All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 30
- First → latest
- 06.2025 11.2026
- Without a fix
- 0
- Exploited in attacks
- 0
Severity breakdown
- High 24
- Medium 4
- Low 2
Disclosures per year
- 2025: 13
- 2026: 17
-
Claude Code: TOCTOU Race in Edit Tool Allows File Writes Outside the Workspace this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.