NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Claude Code

CVE-2026-88968: Claude Code: TOCTOU Race in Edit Tool Allows File Writes Outside the Workspace

highCVSS 4.0 7.7GHSA-5xjx-9qx6-jcrv

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@latest

The 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

More Claude Code vulnerabilities

All Claude Code entries