CVE-2026-25723: Claude Code Vulnerable to Command Injection via Piped sed Command Bypasses File Write Restrictions
Claude Code before 2.0.55 did not validate piped `sed` commands combined with `echo`. With "accept edits" enabled, that let a command write to the `.claude` folder and to paths outside the project, bypassing the file write restrictions. Fixed in 2.0.55.
Published Feb 6, 2026 · Analysis Nov 1, 2026
What an attacker can do
In "accept edits" mode, Claude Code allows certain file edit commands without a prompt but restricts where they may write. The check on a pipeline of echo into sed failed to see the real write target. A crafted command of that form could write into sensitive directories such as .claude, or to any path outside the project scope, without the restriction firing.
The advisory says exploitation requires the ability to execute commands through Claude Code with "accept edits" turned on. In practice that means a model steered by a prompt injection in a repository file, web page or tool output, or a user who already has access to the session. The .claude folder holds settings, hooks and commands, and a write outside the project can touch shell startup files or other configs. That is how a file-write bypass becomes code execution later, though the advisory only describes the write bypass. CVSS 4.0 rates it 7.7.
Who is affected
@anthropic-ai/claude-code versions before 2.0.55, when "accept edits" is enabled. Auto-update users received the fix. Manual installs and pinned container images may still run an older build.
claude --version
npm ls -g @anthropic-ai/claude-code@anthropic-ai/claude-code
- Ecosystem
- npm
- Affected
- < 2.0.55
- Fixed in
- 2.0.55
- Check
npm ls @anthropic-ai/claude-code
How to fix it
Upgrade to 2.0.55 or later:
npm install -g @anthropic-ai/claude-code@latestThe advisory names no workaround. Until you upgrade, the exposure depends on the "accept edits" setting, so avoid that mode in sessions that read untrusted content.
How to tell if you were hit
Look for unexpected files in .claude folders and in locations outside your projects, such as shell startup files, with modification times inside agent sessions. Review session history for commands that pipe echo into sed and redirect to a path outside the working tree. Beam logs the shell commands and file access of agents and its rules flag risky ones, which includes writes to agent config folders.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Claude Code failed to properly validate commands using piped sed operations with the echo command, allowing attackers to bypass file write restrictions. This vulnerability enabled writing to sensitive directories like the .claude folder and paths outside the project scope. Exploiting this required the ability to execute commands through Claude Code with the "accept edits" feature enabled.
Users on standard Claude Code auto-update received this fix automatically. Users performing manual updates are advised to update to the latest version.
Claude Code thanks hackerone.com/nil221 for reporting this issue!
Questions
- Is CVE-2026-25723 exploitable without accept edits?
The advisory says exploitation required the ability to execute commands through Claude Code with the "accept edits" feature enabled.
- What can be written?
Files in sensitive directories like
.claudeand paths outside the project scope, which the write restrictions should have blocked.- Which version fixes it?
2.0.55. Check with
claude --version; auto-update installs received it automatically.
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
More Claude Code vulnerabilities
All Claude Code entriesCVE-2026-88968
Claude Code: TOCTOU Race in Edit Tool Allows File Writes Outside the Workspace
high7.7Nov 9, 2026CVE-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, 2026
