The Morning Wire

AI NEWS REPORT

EXPLAINER · FRIDAY, SEPTEMBER 4, 2026

How one line in .git/config makes your AI coding agent run a stranger's code

Seven agents ran the same trick. The reason is not a bug in any of them. It is a Git feature from 2017 meeting a habit every agent has.

This explains reporting by Manifold Security.
Read the original first: https://www.manifold.security/blog/ai-coding-agents-git-hijack

In one minute

The Git feature nobody thinks about

Git has a setting called core.fsmonitor. Its job is speed. On a big repo, git status has to check thousands of files to see what you changed, and that is slow. So Git lets you name a helper program that watches the filesystem and answers the question instantly.

The setting looks like this, and it lives in the repo's own .git/config file:

[core]
	fsmonitor = /path/to/some/program

That is the whole trick. The value is a command. Git runs it. This is documented, intended behavior that has been in Git since 2017, and it is not a vulnerability in Git.

The problem is who gets to write that line. Normally it is you, on your own machine, for your own repo. But .git/config is a file inside the folder. If the folder came from somewhere else, that line came from somewhere else too.

Why every agent fell for it at once

Seven different agents, built by seven different teams, all hit the same trap. That is usually a sign the cause is not a coding mistake in any of them. It is a shared assumption.

The assumption is this: to be useful, a coding agent has to know what is in your working tree. Which files changed, what branch you are on, what is staged. The cheapest way to learn that is to shell out to git status, and every agent does it, usually the moment a folder is opened and then repeatedly as you work.

So the sequence is:

Notice what is missing from that list: you. No prompt was typed, no tool was approved, no command was confirmed. The execution happens during orientation, which every agent treats as the safe part.

Why the sandbox and the trust prompt do not help

Most agents have two protections here, and this defeats both by timing rather than by force.

The first is a sandbox. Agents run risky commands inside a restricted environment. But the background git status is not treated as a risky command, it is treated as reading the state of the folder, so it runs outside the sandbox. The helper program inherits that.

The second is a trust prompt, the dialog that asks whether you trust the code in this directory. The trouble is what has already happened by the time you see it. The agent has to look at the folder to tell you anything about it, and looking at the folder means running git. A prompt that appears after the first git call is asking permission for something that already happened.

This is why the fix in the patched agents is not a better sandbox. It is refusing to honor an untrusted fsmonitor value at all.

What Git copies, and what it does not

This is the part that decides whether you are actually exposed, and it is worth being precise about.

Git treats .git/config as local machine configuration, not as repo content. It is not tracked, not committed, and not transferred by the network protocol. So:

But copying a directory copies everything inside it, including the hidden .git folder and the config file in it. So:

The rule of thumb: if the code arrived as FILES, the config came with it. If it arrived over the Git protocol, it did not.

How to check a folder before you open it

The check is fast and needs no tooling. Read the config, look for any value that is a command:

cat .git/config
git config --local --list | grep -Ei 'fsmonitor|hooksPath|sshCommand|pager|editor|askpass'

Those keys are the ones that take a program rather than a value. fsmonitor is the one being used here, but hooksPath is worth the same suspicion: it points Git at a directory of hook scripts, and hooks run on ordinary operations.

Also look at the hooks themselves, since they travel in the same copied directory:

ls -la .git/hooks/

A stock .git/hooks contains only files ending in .sample, which Git ignores. Anything without that suffix will run.

Who is affected

CaseStatus
git clone, then open with an agentSafe. Clone writes its own config.
git fetch or git pull on a repo you clonedSafe. Neither touches local config.
A zip or tarball a coworker sent youEXPOSED if it includes the .git folder.
A repo on a shared or synced driveEXPOSED. File copy carries .git/config.
A repo from a USB stickEXPOSED. Same reason.
A container image or VM with a checked-out repoEXPOSED if the tree was copied in.
Claude Code, Codex, Cursor, GoosePatched per Manifold. Update and confirm your version.
Hermes, Qwen Code, Grok BuildReported still open as of Manifold's Sept 1 retest.

What to do

What is still unknown

Sources

Today's full edition: AI News Report · every headline, every morning.