GHSA-5xjx-9qx6-jcrv
Claude Code: TOCTOU Race in Edit Tool Allows File Writes Outside the Workspace
Quick fix
GHSA-5xjx-9qx6-jcrv — @anthropic-ai/claude-code: upgrade to the fixed version with the command below.
npm install @anthropic-ai/claude-code@2.1.251Details
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.
Are you affected?
Enter the version of the package you're using.
Affected packages
0Fixed in: 2.1.251npm install @anthropic-ai/claude-code@2.1.251