TL;DR
- Manifold Security's GitSpawn research (published September 1, 2026, by Francisco Rosales) reports eight findings across seven coding agents. Each agent runs
gitin the background to collect repository context, and that call runs outside the sandbox and before any approval prompt. - The sink is a git setting that names a program. The headline one is
core.fsmonitor, read from the repository's own.git/config. Any git command that refreshes the index runs it. In the write-up, four of the eight findings were still unpatched at publication. - I reproduced the mechanism locally with real git processes and a harmless marker script.
core.fsmonitorfired on 2 of 4 common read-only commands, whilediff.externaland atextconvdriver each fired ongit diff. Disabling onlycore.fsmonitorblocked 1 of 3 sinks ongit diff. Adding--no-ext-diffand--no-textconvblocked all 3. - The lesson is about a category, not one key. Your approval gate protects the commands the model proposes. It does nothing for the commands your own agent runs on its own behalf before the model is ever involved.
What did GitSpawn actually find?
Coding agents want to know what repository they are standing in. So at startup, or on the first message, they run something like git status or git diff as an internal subprocess. Nobody approves that call. The model did not ask for it. In most designs it also runs outside the OS sandbox, because it is the agent's own plumbing.
According to the Manifold write-up, the agents did not strip the repository's own git configuration from these calls. Git has several settings that name a program to run. The one the researchers lead with is core.fsmonitor, a documented performance hook: when a command refreshes the index, git runs the configured program to ask which files changed. The value comes from .git/config, and .git/config ships inside the repository directory.
The write-up lists trigger points that show how early this happens:
- Claude Code: startup
git status, before the workspace-trust prompt is accepted. Reported June 26, 2026 and patched in 2.1.196 per the post. - Goose:
git diffwhile gathering a review, before any model contact. CVE-2026-72718, severity 7.0, fixed in 1.44.0. - Qwen Code: startup
git status, before authentication. - Grok Build: git runs on the first keystroke of a prompt, before anything is sent.
- Hermes Agent:
git statuson the first message. CVE-2026-71963 was assigned by VulnCheck. - Codex and Cursor: covered in the update note as patched.
Delivery matters for judging the risk. Per the post, cloning, fetching or pulling a hostile URL does not carry .git/config across, so the attacker has to hand over the directory with .git intact: a .zip, a shared drive, a sync folder, a USB stick. That is a narrower path than "open any repo", and it is also a very ordinary developer habit.
Can I reproduce it without a vulnerable agent?
Yes, and it is worth doing, because the point is git's behavior and not any one product. The script below builds a throwaway repository, plants a sink pointing at a script that appends a line to a marker file, runs a command the way an agent would, and checks whether the marker appeared. It uses GIT_CONFIG_GLOBAL and GIT_CONFIG_NOSYSTEM so only the repo's own config is in play.
import subprocess, os, pathlib, tempfile
def sh(args, cwd):
env = dict(os.environ, GIT_CONFIG_GLOBAL=os.devnull, GIT_CONFIG_NOSYSTEM="1")
return subprocess.run(args, cwd=cwd, env=env, capture_output=True, text=True)
base = pathlib.Path(tempfile.mkdtemp())
repo = base / "r"; repo.mkdir()
sh(["git", "init", "-q"], repo)
(repo / "a.txt").write_text("one\n")
sh(["git", "-c", "user.name=x", "-c", "user.email=a@b.c", "add", "."], repo)
sh(["git", "-c", "user.name=x", "-c", "user.email=a@b.c", "commit", "-qm", "i"], repo)
(repo / "a.txt").write_text("two\n") # a dirty tree, like real work
marker = base / "marker"
hook = repo / ".git" / "hook.sh"
hook.write_text(f"#!/bin/sh\necho ran >> '{marker.as_posix()}'\nexit 0\n")
sh(["git", "config", "core.fsmonitor", hook.as_posix()], repo)
sh(["git", "status", "--short"], repo) # what an agent runs at startup
print("fired:", marker.exists())
On git 2.53.0 (Windows build) the marker appears after git status. Nothing was prompted, nothing was sandboxed, and the process ran with my privileges.
Which everyday git commands trigger which sink?
I extended the harness to three sinks and four read-only commands: git status --short, git diff, git log --oneline and git rev-parse HEAD. A fourth sink, core.pager, never fired because my harness has no terminal, so I report it as untested rather than safe.
| Sink in repo config | status | diff | log | rev-parse |
|---|---|---|---|---|
core.fsmonitor |
ran | ran | no | no |
diff.external |
no | ran | no | no |
diff.<driver>.textconv plus .gitattributes
|
no | ran | no | no |
Two things stand out. First, git log and git rev-parse are quiet, so an agent that only reads history is lucky, not safe. Second, the textconv row needs a .gitattributes file in the working tree that maps *.txt to the driver, while the program itself is named in .git/config. Anyone scanning only for suspicious files in the working tree would miss the half that lives in .git.
The practical reading: the more useful the context an agent gathers (a diff is the most useful thing to hand a model), the more sinks it walks past.
Is disabling core.fsmonitor enough?
This is the question I would put in a design review, because the public mitigation example is a single key: git -c core.fsmonitor=false status. The write-up itself says other config keys of the same kind also need handling. I tested what a one-key fix buys on git diff:
Hardening of the agent's git diff
|
fsmonitor | diff.external | textconv |
|---|---|---|---|
| None | ran | ran | ran |
-c core.fsmonitor=false only |
blocked | ran | ran |
-c core.fsmonitor=false --no-ext-diff --no-textconv |
blocked | blocked | blocked |
Denying the one named key blocked 1 of 3. The two extra flags took it to 3 of 3. That is the shape of a denylist problem: the list is right today and short by one entry tomorrow.
Here is the hardened call as a small wrapper:
SAFE_PREFIX = ["git", "-c", "core.fsmonitor=false"]
def agent_git(subcmd, *args, cwd):
extra = []
if subcmd == "diff":
extra = ["--no-ext-diff", "--no-textconv"]
return subprocess.run(SAFE_PREFIX + [subcmd, *extra, *args],
cwd=cwd, capture_output=True, text=True, timeout=30)
Two environment-level options also held in my runs. Overriding the key through GIT_CONFIG_COUNT, GIT_CONFIG_KEY_0 and GIT_CONFIG_VALUE_0 blocked the fsmonitor sink, and so did GIT_CONFIG_PARAMETERS. Both take precedence over repository config. git --no-optional-locks status did not help: the marker still appeared.
What should a preflight scan look for?
The write-up's advice to users is to read .git/config before opening a received directory with an agent and to treat any setting that names a program as executable. That is automatable. My scan was a single regular expression over .git/config for keys that carry a program: fsmonitor, external, textconv, pager, sshcommand, editor, askpass, hookspath and program. It flagged all four planted repositories and stayed quiet on a clean one.
import re
EXEC_KEYS = re.compile(
r"^\s*(fsmonitor|external|textconv|pager|sshcommand|editor|askpass|hookspath|gpg\.program|program)\s*=",
re.I | re.M)
def repo_config_runs_programs(repo):
return bool(EXEC_KEYS.search((repo / ".git" / "config").read_text()))
Treat this as a tripwire, not a boundary. It is a denylist of key names, the same shape as the weakness above, and a handful of planted repositories proves nothing about git's full key space. Its job is to turn "a human should have looked" into a refusal at the door.
Why does the approval gate not cover this?
Because the gate sits in the wrong place for this class. An approval layer decides whether a command the model proposed may run. The GitSpawn path never goes through that layer. The agent's own startup code runs git, and in the cases above it does so before the workspace-trust prompt, before authentication, or before the first request to the model.
This is the same family as bugs covered earlier in this series: the check guarded one position while the dangerous action took another. Earlier it was a path string versus the file the OS opens, and a destination versus the route. Here it is the model's command line versus the agent's own subprocesses. The common fix is also the same: put the control where every route converges.
For background calls the convergence point is a single function that builds the git invocation. A review checklist that follows from that:
- Inventory every place your agent shells out on its own (git, ssh, package managers, linters, language servers) before any model call.
- Route them through one wrapper so there is one place to harden and one place to log.
- Neutralize repository-controlled configuration in that wrapper, with flags where git provides them and environment overrides where it does not.
- Prefer running these calls inside the same confinement as model-proposed commands, so a missed key costs less.
- Add a trust ordering test: start the agent in a repository with a planted sink and assert the marker never appears before the trust prompt is accepted.
Item 5 is the cheapest, and it is the one that would have caught every finding in the table.
Does this mean agents are unsafe to use?
No, and the narrower claim is more useful. The risk applies when you open a directory that came to you as a file, with its .git folder inside, using an agent that does not sanitize its own git calls. Patch status differs per tool: the post lists Claude Code's fsmonitor path, Goose, Codex and Cursor as fixed, and Qwen Code, Grok Build, Hermes Agent and one more Claude Code path as unpatched at the time. Check the current release of whatever you run, because that table was a snapshot from September 1.
FAQ
What is core.fsmonitor and why can it run code?
It is a git setting that names a program for git to call when refreshing the index, as a way to speed up large repositories. Git does not distinguish a legitimate watcher from any other executable, so whoever controls the config value controls what runs.
Does cloning a malicious repository from a URL trigger this?
Per the research, no. A clone does not carry the attacker's .git/config. The path needs the directory delivered with .git intact, for example in a zip archive.
Is disabling one config key a sufficient fix?
In my local test it was not. On git diff, denying core.fsmonitor alone blocked 1 of 3 sinks. diff.external and textconv still ran until --no-ext-diff and --no-textconv were added.
Where do I put the hardening?
In one wrapper through which every agent-initiated git call passes, so new commands inherit it. Add a test that plants a sink and asserts it never fires before the trust prompt.
Why did my sandbox not stop it?
The agent's own context-gathering subprocess is usually outside the sandbox that wraps model-proposed commands. That placement is the finding.
Further reading
- The Sandbox Blocked File Writes and Left a Door Open: How a Coding Agent Switched Off Its Own Approvals Over Loopback (earlier post, same series)
- The Allowlist Guarded the Destination, Not the Route: A Proxies Parameter Leaked Credentials From an Agent HTTP Tool (earlier post, same series)
Sources
- Manifold Security, GitSpawn research post by Francisco Rosales, September 1, 2026: https://www.manifold.security/blog/ai-coding-agents-git-hijack
- Adversa AI, October 2026 digest of coding agent vulnerabilities: https://adversa.ai/blog/top-ai-coding-agent-security-resources-october-2026/
- Local measurements: git 2.53.0 on Windows, real subprocesses, harmless marker script. The
core.pagersink is untested because the harness had no terminal.
Top comments (0)