7.7high
Claude Code arbitrary code execution via git worktree commondir trust dialog bypass
- Severity
- 7.7high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.31% (higher than 26% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-q5hj-mxqh-vv77
Description
In versions 2.1.63 through 2.1.83 of Claude Code, the folder trust determination logic used the git worktree commondir file without validating its contents. An attacker could craft a malicious repository with a commondir file pointing to a path the victim had previously trusted, causing Claude Code to bypass its trust confirmation dialog and immediately execute hooks defined in `.claude/settings.json`. Exploitation requires the victim to clone the malicious repository and run Claude Code within it, and the attacker must know or guess a path the victim had already trusted. This issue has been fixed in version 2.1.84.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| anthropics claude-code | >= 2.1.63, < 2.1.84 | CVE List |
| @anthropic-ai/claude-code (npm) | from 2.1.63 before 2.1.84 | GitHub Advisory Database |
| anthropic claude_code | from 2.1.63 before 2.1.84 | 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 | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
Classification
What each source says
CVE List
In versions 2.1.63 through 2.1.83 of Claude Code, the folder trust determination logic used the git worktree commondir file without validating its contents. An attacker could craft a malicious repository with a commondir file pointing to a path the victim had previously trusted, causing Claude Code to bypass its trust confirmation dialog and immediately execute hooks defined in `.claude/settings.json`. Exploitation requires the victim to clone the malicious repository and run Claude Code within it, and the attacker must know or guess a path the victim had already trusted. This issue has been fixed in version 2.1.84.
GitHub Advisory Database
Claude Code used the git worktree commondir file when determining folder trust but did not validate its contents. By crafting a repository with a commondir file pointing to a path the victim had previously trusted, an attacker could bypass the trust dialog and immediately execute malicious hooks defined in .claude/settings.json. Exploiting this required the victim to clone a malicious repository and run Claude Code within it, and for the attacker to know or guess a path the victim had already trusted.
Users on standard Claude Code auto-update have received this fix already. Users performing manual updates are advised to update to the latest version.
Claude Code thanks hackerone.com/masato_anzai for reporting this issue.
NVD (es)
En las versiones 2.1.63 a 2.1.83 de Claude Code, la lógica de determinación de confianza de carpetas utilizaba el archivo git worktree commondir sin validar su contenido. Un atacante podría crear un repositorio malicioso con un archivo commondir apuntando a una ruta en la que la víctima había confiado previamente, lo que haría que Claude Code omitiera su diálogo de confirmación de confianza y ejecutara inmediatamente los hooks definidos en '.claude/settings.json'. La explotación requiere que la víctima clone el repositorio malicioso y ejecute Claude Code dentro de él, y que el atacante conozca o adivine una ruta en la que la víctima ya había confiado. Este problema ha sido solucionado en la versión 2.1.84.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-40068 changed 2026-05-06 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-q5hj-mxqh-vv77 changed 2026-05-08 | CC-BY-4.0 |
| NVD | CVE-2026-40068 changed 2026-07-24 | Public domain |