CVE-2026-88968: Claude Code: TOCTOU Race in Edit Tool Allows File Writes Outside the Workspace
Claude Code before 2.1.251 has a race condition in its Edit tool. On macOS, code running inside the Bash sandbox can swap a workspace directory for a symlink after the path check, so the unsandboxed Edit overwrites a user-writable file outside the workspace. Upgrade to 2.1.251; auto-update users already have it.
Published Nov 9, 2026 · Analysis Nov 10, 2026
What an attacker can do
The Edit tool checked that a target path was inside the workspace by resolving the path and symlinks once. That check was not tied to the directory inodes or file descriptors used for the write. This leaves a time-of-check to time-of-use window.
On macOS, a process inside Claude Code's Bash sandbox can wait for the Edit tool to validate an in-workspace path, then atomically replace a parent directory with a symlink that points outside the workspace. The Edit implementation runs unsandboxed, so it writes through the symlink into a file the attacker chose.
The attacker must already run code in the sandbox, for example through a malicious repository or a dependency script, and must win the timing race. The result is an overwrite of any file the user can write, such as shell startup files or SSH config, which can lead to code execution later. That makes the sandbox boundary weaker than it appears. The advisory scores it high (CVSS 4.0 of 7.7).
Who is affected
The npm package @anthropic-ai/claude-code, all versions below 2.1.251. The advisory describes the exploit on macOS. Check your version:
claude --version
npm ls -g @anthropic-ai/claude-code@anthropic-ai/claude-code
- Ecosystem
- npm
- Affected
- < 2.1.251
- Fixed in
- 2.1.251
- Check
npm ls @anthropic-ai/claude-code
How to fix it
Upgrade to 2.1.251. The advisory says standard auto-update users received the fix automatically. If you update by hand:
npm install -g @anthropic-ai/claude-code@latestThe advisory lists no workaround. Until you update, avoid opening untrusted repositories or running their dependency scripts in a Claude Code session.
How to tell if you were hit
Look for unexpected changes to files outside the project directory around the time of a Claude Code session, especially shell profiles, SSH config and other dotfiles in your home directory. Look for a project directory that was replaced by a symlink. Beam records agent file access and shell commands, so its logs show what a session ran and which files it touched, and its rules flag risky shell commands.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
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.
Questions
- Is Claude Code 2.1.251 affected by CVE-2026-88968?
No. 2.1.251 is the patched version. Versions below it are affected.
- Does this affect Linux or Windows?
The advisory describes the exploit on macOS only. The package range is not limited by platform, so update every install.
- What does an attacker need?
Code running inside Claude Code's Bash sandbox, such as from a malicious repository or dependency script, plus winning a timing race against the Edit tool's path check.
- Do I need to update manually?
Not if you use standard auto-update, which already delivered the fix. If you update manually, install 2.1.251 or later.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
Coverage on the Beam blog
- External Sandboxes: Run Claude Code and Codex Commands in Linux, Not on Your Mac
- Claude Code VS Code Symlink Prompt: Hidden Paths Outside Your Workspace
- Claude Code Projects Parallel Workers: Security Checks Before Hands-Free Coordination
- CVE Volume Hit a Record in 2026: Why It Is Spiking and What to Do
- Git Project LLM Policy: Community Vote Process and What Coding-Agent Teams Should Watch
More Claude Code vulnerabilities
All Claude Code entriesCVE-2026-86063
Claude Code: Plugin Hash Pin Bypass Allows Bypass of Hash Pinning
high7.5Oct 15, 2026CVE-2026-55607
Claude Code: Sandbox Escape via Git Worktree Path Confusion Allows Unsandboxed Code Execution
high7.7Jul 24, 2026CVE-2026-46406
@anthropic-ai/claude-code has an Insecure Temporary File in /copy Command that Enables Response Disclosure and Symlink-Based File Write
medium4.4Jun 25, 2026CVE-2026-54316
Claude Code: Out-of-Band Data Exfiltration via Pre-Approved HuggingFace Domain in WebFetch
medium9.1Jun 17, 2026CVE-2026-40068
Claude Code: Trust Dialog Bypass via Git Worktree Spoofing Allows Arbitrary Code Execution
high7.7Apr 24, 2026CVE-2026-39861
Claude Code: Sandbox Escape via Symlink Following Allows Arbitrary File Write Outside Workspace
high10.0Apr 21, 2026
