Security

GitSpawn Explained: How a Hostile .git/config Runs Code Through AI Coding Agents

Eight flaws across seven coding agents let a repository run code before any approval prompt. Here is how GitSpawn works and how to protect your machine.

Marcus Oyelaran

Security & DevOps Specialist

Published 7 min read
Crop unrecognizable computer geek typing on netbook with codes on screen while hacking system in darkness
On this page 7 sections

GitSpawn is a family of flaws in which a repository's own .git/config file makes git run a program on your machine. AI coding agents call git in the background for context, so the program can run before any approval prompt or sandbox. Manifold Security reported eight findings across seven agents. The fix for you is simple: read the config first.

This explainer is for developers, platform engineers and security teams who let AI coding agents open code from outside their own organization. It covers how the attack works, which tools were named, and the defenses that cost almost nothing. Backtrace covers developer security with one rule: assume the repository is hostile until you have read it.

What Is GitSpawn and How Does It Run Code?

GitSpawn abuses git's own configuration. Git reads settings from a repository's .git/config file, and a few settings name a program that git runs during normal operations. One example is core.fsmonitor, a performance setting that git runs during index refreshes. A malicious repository can point it at any command.

Close-up of a person holding a Git sticker, emphasizing software development.

The attack works because agents call git constantly. AI coding agents run git commands in the background to gather project context. According to Manifold Security's GitSpawn research, agents do not strip the repository's own config on those calls. The named command runs with the user's privileges.

That matters because it happens outside the safeguards people trust. The command runs outside the sandbox and without an approval prompt. In some agents it fires before the workspace-trust dialog even appears.

The result is arbitrary code execution as the developer. That can expose SSH keys, cloud credentials, tokens stored in shell configuration files, local repositories and a foothold for later access. In short, it is the kind of access a CI pipeline would never hand to an untrusted contributor.

Which Coding Agents Were Affected?

Manifold reported eight findings across seven agents: Claude Code with two findings, Goose, Grok Build, Hermes Agent, Qwen Code, OpenAI Codex and Cursor. The authors say they found the same flaw in other agents they did not name. Four findings were patched at publication on September 1, 2026, and four were not.

Black and white image of a metal combination lock on a wooden background.

The patch status at publication looked like this.

Which Coding Agents Were Affected?
AgentStatus at publicationDetail
Claude Code (core.fsmonitor)PatchedFixed in 2.1.196
GoosePatchedFixed in 1.44.0, CVE-2026-72718
OpenAI CodexPatchedClosed as a duplicate report
CursorPatchedClosed as a duplicate report
Claude Code (ultrareview)UnpatchedConfirmed on 2.1.252
Hermes AgentUnpatchedCVE-2026-71963 assigned
Qwen CodeUnpatchedConfirmed on 0.22.3
Grok BuildUnpatchedConfirmed on 1.0.13

Treat the table as a snapshot, not a current status. Patches land quickly after disclosure, so check each vendor's release notes. A later security roundup from Adversa AI's October 2026 coverage of coding agent vulnerabilities lists GitSpawn among a wider set of agent flaws, so the topic is still active.

The vendor responses are a story of their own. Several reports were closed as duplicates of earlier findings, and Manifold says five were duplicates of work other researchers had filed independently. For Hermes Agent, the authors report no triage after six contact attempts across five channels. Multiple researchers found the same hole, which suggests it was easy to find.

Does Cloning a Repository Trigger the Attack?

No. Cloning, fetching or pulling from a hostile URL does not trigger GitSpawn, because git does not copy the sender's .git/config during those operations. The danger comes from receiving a repository as files, with its .git directory included, then opening it in an agent.

Adult male programmer coding on dual monitors in a modern indoor workspace.

That narrows the real-world risk, but it does not remove it. Developers receive project folders as zip files, shared drive links, sync folders and USB sticks all the time. Contractors send code. Candidates send take-home exercises. Teams hand off prototypes in a compressed archive.

The proofs of concept all used a zip file holding a repository with a malicious config. The triggers varied by agent. Running a review command, opening a folder, sending a first message or even a first keystroke was enough in different tools. The authors withheld a ready-made repository and the unnamed config key.

The delivery path tells you where to focus. Treat any repository that arrives as a file bundle the way you would treat an executable attachment. A repository you cloned from your own organization's server is a different risk from a zip someone emailed you.

How Do You Check a Repository Before Opening It?

Read the .git/config file in a plain text editor before pointing any agent at the folder. Look for any setting that names a program, such as core.fsmonitor, a custom hooks path or a custom SSH command. If anything looks unfamiliar, do not open the folder with an agent on your main machine.

Focused detail of a modern server rack with blue LED indicators in a data center.

Manifold's advice for users is to inspect .git/config before opening a received directory, since any setting that names a program can run one. Review it the way you would review a build script. That framing helps, because most teams already read build scripts from unknown sources with suspicion.

Here is a short routine for any repository that arrives as files.

  1. Unpack the archive in a scratch directory, not in your projects folder.
  2. Open .git/config in a text editor and read every line.
  3. Check for hook directories and agent configuration files in the repository.
  4. Open the folder only inside a disposable container or virtual machine.
  5. Delete the container when you are done.

The container step is the strongest control. A throwaway environment limits the damage even if you miss a malicious setting. It also keeps your SSH keys and cloud credentials out of reach. Keep secrets outside the project tree and out of containers you use for untrusted code.

What Should Teams and Agent Vendors Do?

Teams should set a policy: agents never open externally supplied repositories on a machine that holds production credentials. Vendors should sanitize git config on background context-gathering calls, for example by disabling core.fsmonitor in the git invocation. Both fixes are small, and both close the gap.

Group portrait of Dominican school police officers in uniform outdoors in the Dominican Republic.

For teams, the policy should be concrete. Name the allowed environment, such as a disposable development container. Make it easy to follow, because a rule that costs ten minutes per use will get skipped. Our guide to least privilege access for cloud engineering teams explains how to limit what a compromised laptop can reach.

Secrets deserve the same attention. If an agent runs hostile code as you, anything on disk is exposed. Run a secrets scan on your own repositories and move long-lived keys into a manager. Our comparison of secrets scanning tools shows which tools catch what.

This is also a supply chain problem in a new form. We described the broader pattern in our explainer on software supply chain attacks for engineering teams. The attacker does not need to break into your network. They need you to open a folder.

Finally, remember that agents add their own risk on top. Our review of autonomous coding agents covers where they need supervision. Giving an agent unreviewed code and broad permissions is a bet on every tool in the chain.

Is GitSpawn the Only Way Agents Run Hostile Code?

No. The Adversa roundup lists several related problems, and they share a theme: agents trust files they should not. In one study, a malicious lifecycle hook added through a plugin update compromised all seven tested harnesses, with up to 92.5 percent success across ten objectives. Scanners missed nearly half of the samples.

Another finding, called Plugin4Shell, says several agents install pinned plugin commits without verifying the result. A branch named like the commit hash can then swap in malicious code. The advice is to disable automatic plugin updates until the agent verifies the commit that actually landed.

These are secondhand summaries of other researchers' work, so check the original reports before acting on any single number. The pattern is still clear. Configuration files, plugins and repository settings are now an attack surface, because agents read and act on them automatically.

That is why a simple rule works better than a list of patches. Treat anything an agent reads as code, and give the agent the same limits you would give an unreviewed script.

What Is the Bottom Line on GitSpawn?

GitSpawn is not a reason to stop using coding agents. It is a reason to stop opening strangers' folders on a laptop that holds your keys. At Backtrace, we rate the risk as low for repositories cloned from your own servers and high for anything that arrives as a zip.

Read the config, use a disposable container, and keep agents updated. Those three habits close the hole this research describes, and they will help against the next flaw of the same kind.

What is GitSpawn?
GitSpawn is a family of flaws, described by Manifold Security, where an untrusted repository carries a malicious .git/config that names a program for git to run. AI coding agents run git in the background for context, so the program executes with the developer's privileges, outside any sandbox or approval prompt.
Does cloning a malicious repository trigger GitSpawn?
No. According to Manifold, cloning, fetching or pulling from a hostile URL does not trigger it. The repository must arrive as files with its .git directory included, such as a shared zip archive, a synced folder, a shared drive or a USB stick, and then be opened by a vulnerable agent.
How do I check a repository before opening it with an AI agent?
Read the .git/config file in a text editor before you point any agent at the folder. Look for any setting that names a program, such as core.fsmonitor. If the repository came as a zip or a shared folder, open it only inside a disposable container.
Which AI coding agents were affected by GitSpawn?
Manifold reported eight findings across seven agents: Claude Code with two findings, Goose, Grok Build, Hermes Agent, Qwen Code, OpenAI Codex and Cursor. Four were patched at publication and four were not. Check each vendor's current release notes, because the patch status will have changed since then.

Written by

Marcus Oyelaran

Security & DevOps Specialist

11+ years experience

Marcus Oyelaran spent eleven years moving between platform and security teams, including four years as a security engineer embedded inside a DevOps org at a healthcare SaaS company handling PHI at scale. He's run more incident postmortems than he can count, and most of what he writes for Backtrace comes directly out of those postmortems: the secret that leaked through a build log, the IAM policy that was too permissive by one wildcard, the deploy that skipped a gate because someone was in a hurry. He holds an OSCP and spends an unreasonable amount of time arguing about supply chain security on internal Slack channels.

Credentials

  • OSCP (Offensive Security Certified Professional)
  • 11 years in DevOps and security engineering
  • Former security engineer, healthcare SaaS platform (HIPAA-regulated infrastructure)