Skip to content
EventPast event

Claude Code fixes TOCTOU race condition vulnerability in Edit tool

2 reports2 reporting sourcesLatest report

Start here

AI overview

On November 9, 2026, an author pointed out through source code analysis and controlled experiments that when an Agent writes a file, after the path check passes, other processes in the shared workspace can replace the directory entry between the check and the actual operation, causing the write to land outside the authorized directory. The article mentions that in Claude Code's CVE-2026-103435 (affected versions < 2.1.129, fixed in 2.1.129), the permission check still passes a path string to the write stage; a controlled experiment with OpenClaw showed that the old version had already truncated files outside the directory before rejecting, while the fixed version rejects before modifying the file. The author recommends using openat2's RESOLVE_BENEATH to constrain resolution, and replacing assertions of exceptions alone with reading back the on-disk state. On November 10, a GitHub security advisory stated that Claude Code fixed a TOCTOU race condition vulnerability in the Edit tool, affecting npm package versions before 2.1.251, and fixed in 2.1.251. The tool originally validated the edit target using path name and symlink resolution at a single point in time, without binding to the underlying directory inode or file descriptor; on macOS, a process running inside the Claude Code Bash sandbox could, after validation completed, atomically replace a parent directory within the workspace with a symlink, causing the unsandboxed Edit implementation to overwrite an attacker-chosen, user-writable file outside the workspace. Exploiting this vulnerability requires the ability to run attacker-controlled code inside the sandbox, such as a malicious repository or dependency script. Users with standard automatic updates have automatically received the fix; users who update manually need to upgrade to the latest version.

Generated by AI from reports · Updated 18 days ago

Progress timeline

Nov 10
  1. GitHub Security AdvisoriesSelected
    Claude Code fixes TOCTOU race vulnerability in the Edit tool; versions before 2.1.251 could be made to write files outside the workspace

    Claude Code fixed a TOCTOU race vulnerability in the Edit tool. Versions of the npm package before 2.1.251 are affected, and it has been fixed in 2.1.251. The tool previously validated the edit target using pathname and symlink resolution at a single point in time, without binding to the underlying directory inode or file descriptor. On macOS, a process running inside the Claude Code Bash sandbox could, after validation completed, atomically replace a parent directory inside the workspace with a symlink, causing the unsandboxed Edit implementation to overwrite an attacker-chosen, user-writable file outside the workspace. Exploiting this vulnerability requires the ability to run attacker-controlled code inside the sandbox, for example a malicious repository or dependency script. Users using standard automatic updates have automatically received the fix; users who update manually need to upgrade to the latest version.

Nov 9
  1. Xianzhi Community (Aliyun)Selected
    When an Agent writes a file, why does it still cross the boundary after the path check passes?

    The author uses source code analysis and controlled experiments to show that after an Agent file write's path check passes, other processes in the shared workspace can replace the directory entry in the gap between the check and the actual operation, causing the write to land outside the authorized directory. In Claude Code's CVE-2026-103435 (affected versions < 2.1.129, fixed in 2.1.129), what the permission check passes to the write stage is still a path string. OpenClaw's GHSA-x82f-27x3-q89c controlled experiment shows that in the old version v2026.2.26, before a rejection was returned, O_TRUNC had already truncated an out-of-directory Canary from 4096 bytes to 0, and when the target was missing, O_CREAT first left a 0-byte file; the fixed version v2026.3.1 rejects before modifying the file. The author attributes the root cause to the check result not being bound to a file descriptor or a trusted parent directory, and recommends constraining resolution with openat2's RESOLVE_BENEATH, and replacing assertions of exceptions alone with reading back the on-disk state.