Technical impact
Claude Code’s Edit tool suffered a time‑of‑check to time‑of‑use race condition whereby the target path was validated using pathname and symlink resolution that was not tied to the underlying directory inode or file descriptor. An attacker who can run code within the sandbox can atomically replace a normal parent directory inside the workspace with a symlink after validation. The unsandboxed Edit implementation then performs the file write and overwrites a file outside the workspace scope. The flaw maps to TFTOC and path‑traversal weaknesses (CWE‑367 and CWE‑59) and can result in arbitrary file modification, potentially enabling privilege escalation or remote code execution if critical files are overwritten.
Affected Systems
All releases of the Claude Code agent before version 2.1.251 are affected. The issue has been fixed in the 2.1.251 release and later. The product vendor is Anthropics, offering the Claude Code coding tool via the anthropics:claude-code series.
Risk and Exploitability
The vulnerability carries a CVSS score of 7.7 and no EPSS score is available. The issue is not listed in the CISA KEV catalog. Exploitation requires attacker‑controlled code already executing inside the sandbox, such as malicious repository content or a dependency script, after which the race can be triggered to target an arbitrary external file. While the attack is confined to sandboxed environments, the resulting outside‑workspace writes can lead to serious compromise if overwritten files are critical.
Github GHSA