CVE-2025-59041: Claude Code vulnerable to arbitrary code execution caused by maliciously configured git email
Claude Code before 1.0.105 built a shell command at startup that included the git user.email value of the current repository. A malicious .git/config could set user.email to a payload and run commands before the workspace-trust dialog was accepted. Upgrade to @anthropic-ai/claude-code 1.0.105.
Published Sep 10, 2025 · Updated Sep 25, 2025 · Analysis Nov 1, 2026
What an attacker can do
At launch, Claude Code ran a shell command that interpolated the output of git config user.email from the workspace, without escaping. Git config values come from the repository .git/config, so whoever supplies the repository controls that string. An email value containing shell syntax became part of the command.
The key detail is timing. The command ran before the user answered the workspace-trust prompt, the dialog meant to stop untrusted folders from running anything. Opening a cloned or downloaded repository with a crafted .git/config in Claude Code was enough. No prompt injection and no tool approval was needed.
The code runs with the developer permissions: it can read source, SSH keys, cloud credentials and environment variables and install persistence. The CVSS 4.0 vector is local with user interaction, because the victim has to launch Claude Code inside the hostile directory. The attack path is a repo handed over by a stranger, a shared zip, or a compromised dependency checkout that includes a .git folder.
Who is affected
Affected: @anthropic-ai/claude-code below 1.0.105. Check your version:
claude --versionFor npm installs, use npm ls -g @anthropic-ai/claude-code. Auto-updating installs have probably moved past the fix, but pinned CI images, dev containers and manual installs may not have. The risk applies when you start the tool in a repository you did not create.
@anthropic-ai/claude-code
- Ecosystem
- npm
- Affected
- < 1.0.105
- Fixed in
- 1.0.105
- Check
npm ls @anthropic-ai/claude-code
How to fix it
Upgrade to @anthropic-ai/claude-code 1.0.105 or later.
npm install -g @anthropic-ai/claude-code@latestThe fix stops building commands from untrusted configuration and validates or escapes inputs. Workarounds from the advisory, if you cannot update: open only trusted workspaces, inspect the repository .git/config before launching, and avoid inheriting untrusted Git configuration values.
How to tell if you were hit
Inspect .git/config in repositories you opened with an old version, and look at the user.email line for characters such as ;, $(, backticks, | or &. Run git config user.email yourself in suspect repos. Look for unexpected processes started at the time Claude Code launched, and for new files, cron entries or shell profile edits. Beam records agent shell commands, but this flaw fires at tool startup before the agent acts, so check shell history and process logs instead.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
At startup, Claude Code constructed a shell command that interpolated the value of git config user.email from the current workspace. If an attacker controlled the repository’s Git config (e.g., via a malicious .git/config) and set user.email to a crafted payload, the unescaped interpolation could trigger arbitrary command execution before the user accepted the workspace-trust dialog. The issue affects versions prior to 1.0.105. The fix in 1.0.105 avoids executing commands built from untrusted configuration and properly validates/escapes inputs.
- Patches: Update to
@anthropic-ai/claude-code1.0.105or later. - Workarounds: Open only trusted workspaces and inspect repository
.git/configbefore launch; avoid inheriting untrusted Git configuration values.
Thank you to the NVIDIA AI Red Team for reporting this issue!
Credited to cai0duque.
Questions
- Did the trust dialog protect me?
No. The advisory says the command could run before the user accepted the workspace-trust dialog.
- What fixes CVE-2025-59041?
@anthropic-ai/claude-code 1.0.105 or later. It no longer runs commands built from untrusted configuration.
- How do I check a repository for this?
Read .git/config before launching and check that user.email is a plain address with no shell characters. The advisory suggests inspecting the file and opening only trusted workspaces.
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
