Summary
Claude Code: TOCTOU Race in Edit Tool Allows File Writes Outside the Workspace
Advisory details
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 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.
Users on standard Claude Code auto-update have received this fix automatically. Users performing manual updates are advised to update to the latest version.
Claude Code thanks hackerone.com/mahoraga007 (Sunder Singh) for reporting this issue.
References
Related vulnerabilities
All Supply chain →- MEDIUMCVE-2026-35376
chcon: recursive relabel not anchored to traversal dirfd (TOCTOU)
- MEDIUMCVE-2026-35374
split: TOCTOU output-open allows truncating a swapped file
- HIGHCVE-2026-62336
qbee-agent: Local Privilege Escalation and Arbitrary File Tampering via Symlink Following in createFile helper
- HIGHCVE-2026-77313
Flyto2 Core: SSRF guard validates the resolved IP but connects by hostname, allowing DNS-rebinding TOCTOU
- HIGHCVE-2026-128135
NLTK: ZIP package extraction follows in-root hardlinks and overwrites files outside the NLTK data root
- MEDIUMCVE-2026-128137
NLTK corpus-reader view methods bypass the scoped root sandbox via intermediate-directory symlinks