CVE-2026-88968: Claude Code: TOCTOU Race in Edit Tool Allows File Writes Outside the Workspace
Claude Code is an agentic coding tool. Prior to 2.1.251, the Edit tool validates a target using pathname and symlink resolution that is not bound to the underlying directory inode or file descriptor. On macOS, attacker-controlled code running in the Bash sandbox can atomically replace an in-workspace parent directory with a symlink after validation, causing the unsandboxed Edit implementation to overwrite a user-writable file outside the workspace. Exploitation requires attacker-controlled code to run inside the sandbox, such as from a malicious repository or dependency script. This issue is fixed in version 2.1.251.
Other sources
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.
— GitHub
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/@anthropic-ai/claude-codeto a version that resolves this vulnerability.Fixed in 2.1.251 - Upgrade
Upgrade
Claude Codeto a version that resolves this vulnerability.Fixed in 2.1.251
Event History
Frequently Asked Questions
Which environments are exposed to this issue?
The described exploit applies on macOS. It requires Claude Code versions prior to 2.1.251 and attacker-controlled code executing inside the Bash sandbox.
What must an attacker control to exploit the race condition?
An attacker needs code that runs in the Bash sandbox, such as code supplied through a malicious repository or dependency script. That code must atomically replace an in-workspace parent directory with a symlink after the Edit tool has validated the path.
What is the practical impact of successful exploitation?
Successful exploitation can cause the unsandboxed Edit implementation to overwrite a user-writable file outside the workspace. The vulnerability affects confidentiality, integrity, and availability according to the supplied severity vector.
What is the remediation?
Upgrade Claude Code to version 2.1.251, which fixes the issue. If upgrading is not immediately possible, avoid running untrusted repositories or dependency scripts that could execute attacker-controlled code in the Bash sandbox.