7.7high
Claude Code Vulnerable to Command Injection via Directory Change Bypasses Write Protection
- Severity
- 7.7high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.51% (higher than 44% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-66q4-vfjg-2qhh
Description
Claude Code is an agentic coding tool. Prior to version 2.0.57, Claude Code failed to properly validate directory changes when combined with write operations to protected folders. By using the cd command to navigate into sensitive directories like .claude, it was possible to bypass write protection and create or modify files without user confirmation. Reliably exploiting this required the ability to add untrusted content into a Claude Code context window. This issue has been patched in version 2.0.57.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| anthropics claude-code | < 2.0.57 | CVE List |
| @anthropic-ai/claude-code (npm) | before 2.0.57 | GitHub Advisory Database |
| anthropic claude_code | before 2.0.57 | NVD |
All scores
| GitHub_M | 7.7high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
| NVD | 9.1critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H |
Classification
What each source says
CVE List
Claude Code is an agentic coding tool. Prior to version 2.0.57, Claude Code failed to properly validate directory changes when combined with write operations to protected folders. By using the cd command to navigate into sensitive directories like .claude, it was possible to bypass write protection and create or modify files without user confirmation. Reliably exploiting this required the ability to add untrusted content into a Claude Code context window. This issue has been patched in version 2.0.57.
GitHub Advisory Database
Claude Code failed to properly validate directory changes when combined with write operations to protected folders. By using the cd command to navigate into sensitive directories like .claude, it was possible to bypass write protection and create or modify files without user confirmation. Reliably exploiting this required the ability to add untrusted content into a Claude Code context window.
Users on standard Claude Code auto-update received this fix automatically. Users performing manual updates are advised to update to the latest version.
About Claude Code thanks hackerone.com/nil221 for reporting this issue!
NVD (es)
Claude Code es una herramienta de codificación agéntica. Antes de la versión 2.0.57, Claude Code no validaba correctamente los cambios de directorio cuando se combinaba con operaciones de escritura en carpetas protegidas. Al usar el comando cd para navegar a directorios sensibles como .claude, era posible eludir la protección contra escritura y crear o modificar archivos sin confirmación del usuario. La explotación fiable de esto requería la capacidad de añadir contenido no confiable en una ventana de contexto de Claude Code. Este problema ha sido parcheado en la versión 2.0.57.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-25722 changed 2026-02-06 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-66q4-vfjg-2qhh changed 2026-02-06 | CC-BY-4.0 |
| NVD | CVE-2026-25722 changed 2026-06-17 | Public domain |