GitSpawn: Poisoned Repositories Run Code in Claude Code, Codex & 5 More AI Agents

·

GitSpawn is a class of eight flaws across seven command-line AI coding agents, disclosed by Manifold Security on September 1–2, 2026. A repository can carry an attacker command inside its own .git/config. When an agent quietly runs git status or git diff to gather project context, git executes that command as the logged-in user — outside the agent's sandbox and before any trust or approval prompt appears.

Three of the findings carry NVD-confirmed CVEs: CVE-2026-19592 (OpenAI Codex, CVSS 7.3), CVE-2026-72718 (goose, CVSS 7.0), and CVE-2026-55607 (Claude Code worktree confusion, CVSS 8.8). No in-the-wild exploitation has been reported, and CISA's KEV catalog held zero matching entries as of September 2. The technique is trivially weaponizable, so treat this as an urgent hunt-and-harden item, not a wait-and-see one.

◈ Table of Contents

01 What GitSpawn Is 02 Disclosure Timeline 03 The Git Config Attack Surface 04 Technical Deep Dive 05 Per-Agent Trigger Matrix 06 Affected Versions & Patches 07 The Distribution Vector 08 Artifact & Config Indicators 09 Detection & Hunt Queries 10 MITRE ATT&CK Mapping 11 Mitigation & Hardening 12 Sources & References
🧬

01 · What GitSpawn Is

PHASE 01

Modern AI coding agents are given a folder and told to "understand this project." To do that, they run ordinary git plumbing in the background — git status, git diff, index refreshes — before you have typed a single instruction. GitSpawn turns that convenience into a remote-code-execution primitive: the repository itself dictates a command that git faithfully runs on the agent's behalf. The attacker never needs the model to cooperate. They only need you to open the folder.

Manifold Security documented the class under the name GitSpawn, covering eight distinct flaws across seven agents. The severity is not in the payload — an attacker can run anything the user can — but in the absence of friction: the code fires with no prompt, no approval, no model call, and in several agents before the workspace-trust dialog is even shown. Sonar flagged the same sink class in April 2026, and a Cobalt red-team writeup in December 2025 framed it plainly: the abuse rides a legitimate git feature, not a memory-safety bug.

Bar chart: four agent code-paths patched versus four unpatched at GitSpawn disclosure
FIG.1 — GITSPAWN CODE-PATHS: PATCHED VS UNPATCHED AT PUBLICATION (SEP 2026)
AttributeDetail
Class nameGitSpawn (Manifold Security)
NatureCommand-execution via repository-local git config sinks
Scope8 flaws across 7 CLI AI coding agents
Confirmed CVEsCVE-2026-19592, CVE-2026-72718, CVE-2026-55607
Privilege gainedArbitrary command execution as the logged-in user
User interactionOpen a repo folder with an agent (no prompt / approval)
In-the-wild useNone reported as of Sep 2, 2026 (0 matches in CISA KEV)
Primary sourceManifold Security — "GitSpawn"

GitSpawn does not require a supply-chain compromise of any real project. An attacker crafts an ordinary-looking repo, plants the config, and ships it. The "code review this for me" or "help me build this take-home test" pretext is enough.

🗓️

02 · Disclosure Timeline

PHASE 02
T
From "known git footgun" to coordinated multi-vendor disclosure
  • 1Dec 2025 — A Cobalt red-team writeup documents core.fsmonitor abuse against tooling, characterising it as exploitation of a legitimate git feature rather than a defect.
  • 2Apr 2026 — Sonar reports the same sink class against AI coding agents; Anthropic had already moved Claude Code's startup sequence once to close it.
  • 3Jun 25, 2026 — Claude Code 2.1.193 ships; the core.fsmonitor exposure persists on this build per later analysis.
  • 4Jun 26 – Jul 20, 2026 — Manifold Security's GitSpawn findings are reported to the affected vendors across a coordinated window.
  • 5Aug 10, 2026 — CVE-2026-72718 (goose) is published in NVD; fix lands in goose 1.44.0.
  • 6Sep 1, 2026 — OpenAI publishes three independent CVEs for Codex covering the identical class, including CVE-2026-19592.
  • 7Sep 2, 2026 — Public GitSpawn writeup lands; CISA's KEV catalogue (1,687 entries) contains none of the GitSpawn CVEs.

The Sonar and Cobalt precedents matter for your risk narrative: this is not a novel zero-day surprise but a recurring, well-telegraphed sink that vendors kept re-introducing. Treat "we patched it once" as insufficient evidence that an agent is safe.

🎯

03 · The Git Config Attack Surface

PHASE 03

Git has several configuration keys whose value is a command git will run. They exist for legitimate performance and workflow reasons, but any of them, if read from a repository-local .git/config that an attacker controls, becomes a code-execution sink. GitSpawn abuses three primitives:

Git config keyLegitimate purposeWhy it executes code
core.fsmonitorSpeeds up status/diff by asking a helper program what changedIts value is a command git runs on every index refresh
core.hooksPathRelocates the hooks directory (pre-commit, post-checkout, etc.)Points git at attacker-supplied hook scripts that run on routine ops
attr.tree + clean/process filtersApplies content filters (e.g. LFS smudge/clean) per gitattributesFilter definitions invoke external commands during checkout/diff

A benign core.fsmonitor looks like this — it names a fast file-system-monitor daemon:

Benign fsmonitor configuration (illustrative)
# .git/config — legitimate performance hook [core] fsmonitor = rs-git-fsmonitor untrackedcache = true

Git makes no distinction between a trusted daemon name and an arbitrary shell command in that field. The moment the index is refreshed, whatever string sits there is handed to the shell. GitSpawn's insight is simply that AI agents refresh the index constantly and automatically, long before a human decides whether to trust the folder.

A normal git clone does NOT copy the source repo's local config into your new clone — so cloning from GitHub is not the risk here. The danger is receiving a repository as raw files with its .git/ directory intact.

🔬

04 · Technical Deep Dive — How the Agent Fires the Payload

PHASE 04

The execution chain has nothing to do with the language model. It lives entirely in the git plumbing the agent wraps. Walk it step by step:

1
Agent opens the folder and gathers context
Trigger
On startup — or on a review/build command — the agent shells out to git to learn the repo state. Typical calls are git status, git diff, or an explicit index refresh. This happens autonomously so the model has file context to reason over.
Representative background call the agent makes
$ git status --porcelain $ git diff --name-only HEAD # both refresh the on-disk index before returning
2
Index refresh consults core.fsmonitor
Sink
During an index refresh git checks whether an fsmonitor helper is configured. It reads the value from the repository-local .git/config — the file the attacker controls — and executes it to ask "what changed since last time?" Git does not sandbox, sign, or allow-list this value.
The malicious sink (structure only — payload withheld)
# attacker-planted .git/config in the shipped repo [core] fsmonitor = <attacker command runs here>

Manifold deliberately withheld weaponized payloads for the still-unpatched agents. The point is structural: the field is executed verbatim, so any command an operator could type, git will run for them.

3
Command runs as the user, outside the sandbox
Impact
The helper executes with the full privileges of the logged-in account, in the ordinary OS process context — not inside whatever container or permission wrapper the agent uses for tool calls. Any egress, credential theft, or persistence the user could perform, the payload can perform.
4
It fires before the trust prompt — the critical failure
No consent
In several agents the git context-gathering runs during initialisation, ahead of the workspace-trust dialog and even ahead of authentication. The safety UI most users rely on — "do you trust the authors of this folder?" — never gets a chance to gate the execution, because the code has already run by the time the dialog paints.

This is why "I always click 'don't trust' on unknown repos" is not a mitigation for GitSpawn. The trust decision arrives after the payload, not before it.

Related but distinct is CVE-2026-55607 in Claude Code (CVSS 8.8): its worktree handling allowed creating a worktree named .git and navigating to worktrees outside the sandbox, producing git-directory confusion (CWE-22/59/78). Different mechanic, same theme — the boundary between "the repo's git metadata" and "the agent's trusted execution context" is thinner than anyone assumed.

FIG.2 — GITSPAWN EXECUTION CHAIN
🤖

05 · Per-Agent Trigger Matrix

PHASE 05

The sink is the same; the trigger point differs per agent. What follows is drawn from Manifold's published matrix. The alarming column is "when" — several agents fire before any user consent gate.

AgentTrigger eventExecutes whenStatus at disclosure
goosegoose reviewDuring diff gathering — no prompt, model call or approvalPatched (1.44.0)
Claude Code (fsmonitor)Open project folderBefore workspace-trust promptPatched (2.1.196)
Claude Code (review path)Review commandBefore trust promptReported unpatched
Codex CLI / DesktopRepo metadata collectionOn context gatherPatched (0.131.0 / desktop builds)
CursorDocumented separately by ManifoldOn context gatherPatched
Hermes AgentFirst message sentBefore workspace-trust promptReported unpatched
Qwen CodeOpen folderBefore user authenticationReported unpatched
Grok BuildFirst keystrokeBefore message is even sentReported unpatched

A CVE was assigned to the Hermes Agent finding, but it was not yet published in NVD at the time of writing — so it is not enumerated here. Track the vendor advisory for Hermes, Qwen Code and Grok Build; those paths were still executing repo-supplied commands at publication.

📦

06 · Affected Versions & Patches

PHASE 06
ProductCVEAffectedFixedCVSS
OpenAI Codex CLICVE-2026-195920.102.0 – 0.130.00.131.07.3 High
Codex Desktop (macOS)CVE-2026-19592260202.0859 – 26.513.3131326.519.221367.3 High
Codex Desktop (Windows)CVE-2026-1959226.304.38 – 26.513.4082126.519.210417.3 High
gooseCVE-2026-72718< 1.44.01.44.07.0 High
Claude Code (worktree)CVE-2026-556072.1.38 – 2.1.162> 2.1.1628.8 High
Claude Code (fsmonitor)—2.1.1932.1.196See advisory
Hermes / Qwen Code / Grok Buildpending / unpublishedsee vendor advisoriespendingUnpatched

CVE-2026-19592 is classified CWE-15 (Improper Initialization) and CVE-2026-72718 is CWE-94 (Code Injection). The root cause is identical in spirit: the agent shelled out to git without first neutralising the repo-local config.

Pin your agent versions in a managed allow-list. Auto-updating CLIs mean "we're patched" can silently regress if a developer pulls an older pinned build or an unpatched sibling tool (Qwen, Grok Build) into the same workflow.

📮

07 · The Distribution Vector — Why Clone Is Safe, Files Are Not

PHASE 07

The exploit's one requirement is that the repository arrives with its .git/ directory — and therefore the malicious local config — intact. A fresh git clone builds a new .git/ and does not import the source's local config, so cloning from a forge is not the delivery path. Everything that copies raw files preserves the trap:

🗜️

ZIP / TAR ARCHIVE

"Here's the codebase as a .zip" — extraction preserves .git/config verbatim. A classic for take-home coding assessments and consultancy handoffs.

🗂️

SHARED DRIVE / NAS

A repo dropped on a team file share or SMB mount. Any developer who opens it with an agent inherits the payload.

☁️

SYNC FOLDER

Dropbox, OneDrive, Google Drive sync the whole tree including .git/. One poisoned upload propagates to every synced endpoint.

🔌

USB / REMOVABLE MEDIA

Physical handoff of a repo folder. No network artefacts, no clone log — the config is just there on mount.

🎣

FAKE RECRUITER TEST

The "complete this take-home in our starter repo" lure — already a live tradecraft for other actors targeting developers.

🤝

VENDOR / CONTRACTOR DROP

Third-party code delivered as an archive rather than a repo URL. Trust in the counterparty substitutes for provenance.

Hunt heuristic: any repository that entered the estate as an archive, share-copy or USB import — rather than via a git clone against a known remote — is a higher-risk candidate for a .git/config inspection sweep.

🧾

08 · Artifact & Configuration Indicators

PHASE 08

Because no in-the-wild campaign has been reported, there are no attacker hashes, IPs or domains to publish — inventing them would be malpractice. The durable indicators for GitSpawn are configuration artefacts and process behaviour. These are what your hunt should key on:

IndicatorWhereWhy it matters
core.fsmonitor set to a shell commandRepo-local .git/configLegit fsmonitor names a daemon; a full command or shell metacharacters are suspect
core.hooksPath pointing inside the repo treeRepo-local .git/configRedirects hooks to attacker-supplied scripts that run on routine ops
attr.tree + clean/process filter defs.git/config / .gitattributesFilter commands invoked during checkout/diff
git.exe spawning a shell childEDR process telemetrygit launching cmd/powershell/sh during status/diff is the execution signature
Agent binary → git → shell lineageEDR process treenode/claude/codex/goose/qwen as the grandparent of a shell spawn
Repos arriving as raw filesDownload / archive extraction logsThe only delivery path that preserves the malicious local config
Manual triage — inspect a suspect repo before opening it in any agent
$ git config --get core.fsmonitor $ git config --get core.hooksPath $ git config --local --list | grep -Ei 'fsmonitor|hookspath|filter\.|attr\.' # any output here on an untrusted, file-delivered repo = stop and investigate
🔎

09 · Detection & Hunt Queries

PHASE 09

Hunt 1 — git spawning a shell during index operations. This is the highest-fidelity behavioural signal: git itself launching a command interpreter while running status/diff/index work.

KQL — Microsoft Defender / Sentinel · what this finds: git.exe spawning a shell child
DeviceProcessEvents | where InitiatingProcessFileName == "git.exe" | where FileName in~ ("cmd.exe","powershell.exe","pwsh.exe","bash.exe","sh.exe","wscript.exe","cscript.exe") | where InitiatingProcessCommandLine has_any ("status","diff","fetch","refresh","add") | project Timestamp, DeviceName, AccountName, InitiatingProcessCommandLine, FileName, ProcessCommandLine
SPL — Splunk (Sysmon EID 1) · same behaviour
index=edr sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 parent_process_name="git.exe" (process_name IN ("cmd.exe","powershell.exe","pwsh.exe","bash.exe","sh.exe","wscript.exe","cscript.exe")) | stats count values(process) as child_cmd values(parent_process) as parent by host, user

Hunt 2 — AI agent as the ancestor of a shell. Catches the fuller lineage where the coding agent invoked git which invoked a shell, even when git wrappers rename the process.

KQL · what this finds: shell spawned two hops under a known AI-agent binary
DeviceProcessEvents | where FileName in~ ("cmd.exe","powershell.exe","pwsh.exe","bash.exe","sh.exe") | where InitiatingProcessParentFileName has_any ("claude","codex","goose","qwen","grok","cursor","node.exe") | where InitiatingProcessFileName == "git.exe" | project Timestamp, DeviceName, AccountName, InitiatingProcessParentFileName, InitiatingProcessCommandLine, ProcessCommandLine
SPL · same lineage via process_guid join is ideal; flat approximation shown
index=edr sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 parent_process_name="git.exe" process_name IN ("cmd.exe","powershell.exe","pwsh.exe","bash.exe","sh.exe") | join process_guid=parent_process_guid [ search index=edr EventCode=1 process_name IN ("claude*","codex*","goose*","qwen*","node.exe") ] | table _time host user parent_process process grandparent_process

Hunt 3 — filesystem sweep for poisoned configs. Run across dev endpoints and file shares. Flags any repo whose local config carries an execution sink.

Bash — sweep a tree of repositories (Linux / macOS)
$ find /home /mnt/share -type f -path '*/.git/config' -print0 \ | xargs -0 grep -lEi 'fsmonitor|hookspath|\[filter |process[[:space:]]*=' # prints the path of every .git/config with an execution-capable sink
PowerShell — same sweep on Windows dev fleet
Get-ChildItem -Path "C:\Users","\\fileshare\dev" -Recurse -Force -Filter "config" ` -ErrorAction SilentlyContinue | Where-Object { $_.DirectoryName -like "*\.git" } | Select-String -Pattern "fsmonitor|hooksPath|\[filter |process\s*=" | Select-Object Path, LineNumber, Line

Sigma rule for portability across SIEMs:

Sigma — git process spawning a command interpreter
title: Git Spawns Shell Interpreter (GitSpawn fsmonitor/hooks abuse) status: experimental logsource: category: process_creation product: windows detection: selection: ParentImage|endswith: '\git.exe' Image|endswith: - '\cmd.exe' - '\powershell.exe' - '\pwsh.exe' - '\bash.exe' - '\sh.exe' condition: selection level: high

Tune Hunt 1 against your baseline: some legitimate hook-heavy workflows (Husky, pre-commit, Git LFS) also make git spawn shells. Pivot on repo provenance (file-delivered vs cloned) and on shells that fire at agent-startup time to separate signal from routine dev noise.

🗺️

10 · MITRE ATT&CK Mapping

PHASE 10
TacticTechniqueIDGitSpawn relevance
Initial AccessSupply Chain CompromiseT1195Poisoned repository delivered as raw files
ExecutionUser Execution: Malicious FileT1204.002Victim opens the repo folder in an AI agent
ExecutionCommand and Scripting InterpreterT1059fsmonitor/hooks value run via the shell
Persistence / Priv. TriggerEvent Triggered ExecutionT1546Git index-refresh / hook events trigger the payload
Defense EvasionAbuse Elevation / Trusted FeatureT1548 / T1059Runs before the trust prompt, outside the agent sandbox
🛡️

11 · Mitigation & Hardening

PHASE 11
A
Patch every agent to its fixed build
Update Codex to 0.131.0+ (desktop to the fixed builds), goose to 1.44.0+, and Claude Code past 2.1.196. Retire or isolate Hermes Agent, Qwen Code and Grok Build until their advisories confirm fixes.
B
Neutralise the sink globally on dev endpoints
Disable fsmonitor at the global level and prefer running git with the setting forced off. This blunts the primitive even on an un-patched agent.
Global hardening
$ git config --global core.fsmonitor false $ git -c core.fsmonitor=false status # force-off for ad-hoc inspection
C
Inspect before you open — make it a habit and a hook
For any file-delivered repository, read .git/config before pointing an agent at it. Wrap the Hunt-2 filesystem sweep into onboarding for archives, contractor drops and take-home tests.

Open genuinely untrusted repositories inside a disposable VM or a throwaway container with no credentials, no SSH agent and no cloud tokens mounted. If GitSpawn fires there, it fires into an empty room.

D
Constrain agent execution context
Run coding agents under a least-privileged account, keep secrets out of the shell environment they inherit, and require the vendor's config-sanitising build (agents should strip repo-local config on background git calls).

Do not rely on the workspace-trust prompt as your control. For several GitSpawn paths the code runs before that prompt is answered, so it protects nothing here.

Hardened When
  • All in-use agents on fixed builds; unpatched siblings removed or air-gapped
  • core.fsmonitor disabled globally on developer endpoints
  • .git/config inspection is mandatory for any file-delivered repo
  • Hunt 1 / Hunt 3 queries deployed and baselined in the SIEM
  • Untrusted repos only opened in disposable, credential-free sandboxes
📚

12 · Sources & References

PHASE 12
Manifold Security — GitSpawn: AI coding agents git config hijack (primary research) The Hacker News — Malicious .git configs can make Claude, Codex, Cursor run attacker code NVD — CVE-2026-19592 (OpenAI Codex, CVSS 7.3, CWE-15) NVD — CVE-2026-72718 (goose review, CVSS 7.0, CWE-94) NVD — CVE-2026-55607 (Claude Code worktree confusion, CVSS 8.8) Cyber Security News — GitSpawn flaws execute code in Claude Code, Codex, Cursor & Grok
🖼️
Manifold Security — GitSpawn per-agent trigger matrix
View the original diagrams and agent matrix on the researcher's blog (not re-hosted here)
OPEN ↗

Run the GitSpawn hunt now. Sweep your developer fleet and file shares for poisoned .git/config sinks, paste any suspect config or repo URL into the CyberHawk IOC Scanner, and pin your AI coding agents to the fixed builds. For live detections and threat-hunting content, follow the CyberHawk Threat Intel feed.

◈ Stay Connected

Follow CyberHawk Threat Intel for threat intelligence, deployment guides and hands-on SOC tooling content.

🌐 Website ▶️ YouTube ▶️ YouTube (2) 𝕏 Twitter / X ♪ TikTok ✈️ Telegram
🔍 IOC Scanner 🛠️ Live Tools 📚 Courses 🚨 Threat Intel 📝 Blog 📋 SOPs

"They can't exploit you if you are the Exploit."