One Line in a Repository Runs Attacker Code Inside Seven AI Coding Agents

Researchers call it GitSpawn: eight vulnerabilities across Claude Code, OpenAI Codex, Cursor, Grok Build, Goose, Hermes Agent and Qwen Code. Git treats core.fsmonitor as a command. Agents run git in the background. On several of them the payload fires before the workspace-trust prompt is ever accepted.

What Actually Happened

In early September 2026, researchers disclosed a class of vulnerabilities they named GitSpawn: eight distinct flaws across seven AI coding agents, every one of them reachable by publishing a repository and waiting for someone to open it.

The affected products are not fringe tools. They are Claude Code, OpenAI Codex, Cursor, Grok Build, Goose, Hermes Agent and Qwen Code — the daily driver for a large share of professional developers in 2026.

There is no exploit chain here, no memory corruption, no malicious dependency to install. The entire attack is one line of configuration sitting inside a repository, and a background command the agent runs before it says a single word to you.

8 Distinct vulnerabilities in the GitSpawn class
7 AI coding agents affected, including Claude Code, Codex and Cursor
4 Of the eight still executing repository-supplied commands as of September 1
0 Clicks required by the victim beyond opening the project

core.fsmonitor Is Not a Setting. It Is a Command.

Git has a performance feature called core.fsmonitor. It exists because walking an entire working tree to find out what changed is slow on large repositories, so Git lets you delegate that question to an external file-system monitor.

The important detail is what the configuration value contains. It is not a boolean and not a path to data. It is a command, and Git executes it on any operation that refreshes the index.

That includes the two commands every developer runs a hundred times a day:

And critically, Git reads that value from the repository's own .git/config — a file that travels with a repository you did not write.

Now Add an AI Agent

Consider what every AI coding agent does the moment you open a project. Before it answers anything, it orients itself: current branch, staged files, recent diff, working-tree state. It gathers that context by running git commands in the background, silently, by design. The user sees a spinner, not a shell.

Put the two facts together and the attack writes itself:

  1. An attacker publishes a repository carrying one hostile line in .git/config.
  2. A developer clones it — to review a pull request, evaluate a library, reproduce a bug report.
  3. They open it in their agent.
  4. The agent runs git status to build context.
  5. Git reads the repository's configuration, finds the fsmonitor command, and executes it.

The repository told git to run something. The agent asked git to run. Nobody in that chain did anything unusual.

Who Is Affected, and Where the Patches Stand

The disclosure describes eight flaws across seven agents, and the patch picture as of September 1, 2026 was mixed.

The timing of execution is the part that turns a serious bug into an architectural one. On Claude Code and Hermes Agent, the payload fires before the workspace-trust prompt is accepted. On Qwen Code, before the user has authenticated at all. On Grok Build, on the first keystroke.

A note on freshness. Patch status in a story like this ages in days, not months. The versions and the four-of-eight unpatched count reflect the reporting as of September 1, 2026. Before you brief anyone on it, check the current release notes for the specific agents your engineers actually run — the mitigation below holds regardless of which vendor has shipped what.
01
The Structural Read

A Consent Dialog That Appears After Execution Is a Receipt, Not a Control

Every vendor in this space has built an approval layer: workspace-trust dialogs, per-command permission prompts, tool-call logging, allow and deny lists. Those controls are real and they work as designed — for actions the model decides to take. GitSpawn runs underneath that layer entirely. Execution happens during context collection, in plumbing the approval system was never pointed at, and in several products it happens before the prompt is shown or the user is even authenticated. The security model assumed the dangerous actions were the ones the agent proposes. The dangerous action here was one the agent performs to figure out where it is.

This Is Not Prompt Injection, and the Distinction Decides the Fix

It is worth being precise, because the entire mitigation strategy depends on which kind of bug this is.

Prompt injection manipulates the model. Hostile text enters the context window and the model is persuaded to take an action it should not. Defences are probabilistic by nature: instruction hierarchies, classifiers, narrowed tool scopes, human confirmation on sensitive calls.

GitSpawn asks nothing of the model. The AI is not tricked, not consulted, not involved in the decision at all. The agent is a process that runs git as a subprocess, and git had been configured — by the repository, not by the user — to run something else. Strip the AI out of the description and you are left with a textbook untrusted-input-to-command-execution bug that happens to live inside AI tooling.

Why that matters operationally. No amount of alignment work, guardrail tuning or model evaluation touches this. It is fixed the way command-execution bugs have always been fixed: by treating repository-supplied configuration as untrusted input and refusing to hand it to a shell. Which is exactly what the patches do.

The Real Exposure Is the Patch Pipeline

A vulnerability with a same-week fix is a minor incident when you can push the fix. It is an open door when you cannot see the installs.

AI coding agents occupy an unusual position in most organisations. They live on developer laptops. They update on their own release cadence, often silently. They are frequently installed by the engineer rather than by IT, sometimes through npm or a package manager rather than a managed software catalogue. They rarely appear in an asset inventory, and almost never in a vulnerability management report.

Ask a security team which agent version is running on which engineer's machine. Most cannot answer — not because the process is weak, but because these tools were never enrolled in it.

02
The Blast-Radius Read

The Developer Laptop Is the Highest-Value Endpoint You Do Not Treat Like One

Think about what sits on the machine where this executes: cloud credentials, SSH keys, signing keys, registry tokens, kubeconfig files, browser sessions to the CI system and the cloud console, and write access to the repositories that build production. A single command executed there is not an endpoint compromise, it is a foothold in the software supply chain. We spent a decade hardening servers and CI runners while the machine that pushes to both kept a developer's full standing privileges and, increasingly, an agent that executes things on their behalf. GitSpawn is a small bug pointed at a very large target.

What To Do If You Run Engineering

1. Override fsmonitor Where It Actually Counts

The fix you will see recommended most often, git config --global core.fsmonitor false, does not protect you. Git applies configuration in order, system, then global, then the repository's own .git/config, and the last value wins. A poisoned repository sets fsmonitor locally, so it overrides your global setting. We tested it on Git 2.54: with the global value set to false, the repository's command still ran.

What does take precedence over the repository is configuration passed on the command line or through the environment. Setting these variables in the environment the agent runs in neutralizes the setting for every git call it makes, and the command did not run in our test:

GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.fsmonitor GIT_CONFIG_VALUE_0=false

Push it through your MDM or shell baseline rather than asking people individually, and pair it with a habit: before opening a repository you did not clone yourself, run git config --local --list and look for fsmonitor, hooksPath and sshCommand. Better still, re-clone from a known remote, since a fresh clone never copies the sender's .git/config.

2. Inventory the Agents and Their Versions

Enumerate which AI coding tools are installed across engineering, at which versions, and bring them into normal patch management with an owner and a minimum-version policy. Several products in the affected set were still shipping the behaviour at the start of the month. You cannot ship a fix to software you have not inventoried.

3. Treat Cloning as Execution

Opening an untrusted repository in an agent is now functionally equivalent to running it. That reframing should change routine habits: triage before you clone, be deliberate about repositories from issue reports, forks, job applicants and vendor demos, and keep unknown code in a disposable environment.

4. Isolate the Agent Workspace

Containers, devcontainers, dedicated VMs or a separate low-privilege user turn a developer-machine compromise into a discarded sandbox. This is the control that survives the next bug in this class, which will not be about fsmonitor and will not be announced in advance.

5. Monitor the Developer Endpoint Like an Endpoint

EDR coverage, process telemetry and egress logging belong on machines running agents, not only on servers and CI runners. If a git subprocess spawns an unexpected child process on an engineer's laptop, someone should see it. Today, on most estates, nobody would.

6. Rotate What the Laptop Holds

If an engineer opened an untrusted repository on an unpatched agent, treat the cloud tokens, SSH keys and registry credentials on that machine as potentially exposed. Short-lived credentials and hardware-backed keys make that conversation dramatically shorter.

The pattern worth carrying forward is not the fsmonitor trick. An agent is not just a model. It is a process with a shell, a filesystem, a network stack, credentials, and a long tail of helper commands nobody audits because they look like plumbing: git, package managers, language servers, formatters, build tools, test runners. Every one of those reads configuration from the project directory, and the project directory is attacker-controlled the moment you clone something you did not write. The model is the part everyone is watching. The subprocess is the part that gets you.

Frequently Asked Questions

What is GitSpawn?
GitSpawn is the name researchers gave to a class of eight vulnerabilities across seven AI coding agents, disclosed in early September 2026. All of them let a repository execute commands on the machine of anyone who opens it in an affected agent, by abusing Git's core.fsmonitor configuration value, which Git runs as a command whenever it refreshes the index. The affected products include Claude Code, OpenAI Codex, Cursor, Grok Build, Goose, Hermes Agent and Qwen Code.
How does one line in .git/config get code execution?
Git's core.fsmonitor setting exists to delegate change detection to an external file-system monitor, so its value is a command rather than data, and Git executes it during any index refresh, including git status and git diff. AI coding agents run those commands in the background to gather project context as soon as you open a project. If the repository ships its own .git/config with a hostile fsmonitor value, the agent's routine context collection runs the attacker's command.
Does the workspace-trust prompt protect me?
Not in the affected versions. The execution happens during context collection, underneath the approval layer. On Claude Code and Hermes Agent the payload fires before the trust prompt is accepted, on Qwen Code before the user has authenticated, and on Grok Build on the first keystroke. A consent dialog that appears after execution is a record of what already happened, not a control.
Is this a prompt injection attack?
No, and the distinction matters. Prompt injection manipulates the model through hostile text in its context window. GitSpawn never involves the model at all: the agent runs git as a subprocess, and git was configured by the repository to run something else. That means model-side guardrails, classifiers and alignment work do not address it. It is fixed by treating repository-supplied configuration as untrusted input, which is what the vendor patches do.
Which agents are patched?
As reported at the start of September 2026, Claude Code fixed the core.fsmonitor path in version 2.1.196 after it was confirmed in 2.1.193, and OpenAI Codex and Cursor had both shipped fixes. Hermes Agent, Qwen Code, Grok Build and a second path in Claude Code were still executing repository-supplied commands at that point, with four of the eight flaws outstanding. Patch status changes quickly, so verify the current release notes for the versions your team actually runs.
What is the single most effective mitigation?
Override fsmonitor in the environment the agent runs in (GIT_CONFIG_COUNT=1, GIT_CONFIG_KEY_0=core.fsmonitor, GIT_CONFIG_VALUE_0=false), which takes precedence over a repository's own .git/config. The often-cited git config --global core.fsmonitor false is not enough, because the repository's local value overrides it. Re-cloning from a known remote avoids inheriting the sender's .git/config at all. Beyond that, inventory the agents and their versions so patches can actually be shipped, run agents in an isolated workspace such as a devcontainer, and put EDR and egress logging on developer laptops rather than only on servers and CI runners.

My Take

The industry has spent two years hardening what AI agents say. Refusals, guardrails, output filtering, red-teaming the weights, evaluations for dangerous capability. That work is necessary and it is not where this bug lives.

GitSpawn is a 2005-vintage vulnerability wearing a 2026 badge. Untrusted input reaches a command interpreter. We have known how to fix that for a very long time. What is new is the delivery: the untrusted input arrives in a config file nobody reads, the command interpreter is a tool everybody trusts, and the trigger is an agent doing something so mundane that no product designer thought to put a gate in front of it.

That is the shape I expect to see repeatedly. The interesting attack surface in agentic systems is not the model, it is the harness — the subprocesses, the config parsing, the file access, the network calls the agent makes to orient itself before it does anything a human approves. Every one of those is code executing on attacker-influenced input, and almost none of it is covered by the permission model the vendor shipped.

The uncomfortable part is the deployment reality. These tools sit on the machines with the broadest access in the company, install themselves outside IT, update on their own schedule, and are absent from most asset inventories. When the fix arrived in a point release, a large share of the installed base had no mechanism to receive it. That gap is not the vendors' to close.

Fix the config setting this week. Then ask the harder question: how many other commands does your agent run before you approve anything, and what do they read from the folder you just cloned?

If a hostile repository were opened on one of your developer machines today, what in your telemetry would tell you?

Related Articles:

Kodjo Apedoh

About the Author

Kodjo Apedoh

Network Engineer & AI Entrepreneur

Founder of TechVernia & SankaraShield. Certified Network Security Engineer with 4+ years of experience specializing in network automation (Python), AI tools research, and advanced security implementations. Also builds iOS and Android applications. Holds certifications from Palo Alto Networks, Fortinet, and Cisco. Based in Arlington, Virginia.

Connect on LinkedIn →