← Back to all posts
Published on · by Renaud Deraison

The clone ran the hook

On November 10, Git shipped 2.56.1 and six backports to fix CVE-2026-111760: a repository with an extremely long path can swap a submodule's .git file for a symlink to attacker hooks, and git runs them during a recursive clone. Coding agents clone repositories with their submodules all day. In Bromure Agentic Coding, that hook runs in a VM with stand-in credentials and a default-deny network, the Security Timeline shows the hook's process chain back to the agent's git clone, and Rewind home takes the clone and anything it left out of the machine.

The agent ran git clone --recursive. It approved nothing else, opened no file and installed no package. Git ran the repository's hook while the clone was still going.

On November 10, the Git project released Git 2.56.1, with backports to 2.55.1, 2.54.1, 2.53.1, 2.52.1, 2.51.3 and 2.50.2. The release fixes six vulnerabilities. GitHub's write-up and The Hacker News lead with one of them, CVE-2026-111760: code execution during a recursive clone.

Before git writes a path into a working tree, it checks that the path doesn't overwrite git's own metadata. An integer truncation in the code that handles the index lets an extremely long path pass that check under one name and land on disk under a shorter one. The attacker picks the shorter name, which can be .git.

In a freshly cloned submodule, .git is a file that points at the submodule's repository, not a directory. Git refuses to replace a .git directory with a symlink, and it has no such rule for a .git file. The malicious repository replaces it with a symlink to a directory the attacker controls, full of hooks and config. When the recursive clone gets to that submodule, git uses the attacker's directory, and the hook runs as the user who typed the clone.

This is the third bug of this kind in three years. CVE-2024-32002 used case-insensitive filesystems to write a hook through a submodule symlink. CVE-2025-48384 used a trailing carriage return in a submodule path, and CISA added it to its list of exploited vulnerabilities. Each fix closed one way to get a hook into a submodule's git directory.

GitHub's interim advice is "avoid recursive clones of untrusted repositories," until you've patched every copy of git you have.

Agents clone with submodules

"Clone this repository and get the build working" is one of the most common things people ask a coding agent. The agent runs git clone, the build fails because vendor/ or third_party/ is empty, and it runs git submodule update --init --recursive, or it goes straight to git clone --recursive because the README says to. Both reach the vulnerable code.

Agents also clone repositories nobody on the team has looked at yet: the library in a stack trace, the minimal reproduction attached to an issue, the fork a pull request came from, the "example project" a blog post links to. Teams often let agents run git clone without asking, since a clone downloads files and runs nothing. With this bug, the hook has run by the time the clone finishes.

Git starts the hook, and it runs as the developer with whatever access the agent's shell has. On a Mac, that user can read ~/.ssh, ~/.aws, ~/.config/gh, ~/.npmrc, every .env in every checkout and the browser's cookies.

Then there's patching. A developer Mac has several copies of git: the one in Apple's command-line tools, which Apple updates on its own schedule, Homebrew's, the ones bundled in GitHub Desktop and the GitHub Copilot app (GitHub says patched builds are "being prepared"), and the ones some IDEs ship. When THN checked, Git for Windows had no release based on 2.56.1 yet. An agent uses whichever git is first on its PATH, so you have to update all of them.

CVE-2026-111760, one git clone --recursiveThe agent clonesgit clone --recursive …/repro.git"get the build working"often on an allow listThe check passesan extremely long pathis checked under one name,truncated, then written as.gitSubmodule hijackedits .git file becomesa symlink to a folder ofthe attacker's hookssub/.git → evil/The hook runsduring the clone,as the developer,started by git,not by the agentWhat the hook can read on a developer's Mac~/.ssh ~/.aws ~/.config/gh ~/.npmrc */.env browser cookiesCopies of git to patch: Apple's command-line tools, Homebrew, GitHub Desktop, the Copilot app, IDE bundles.
A recursive clone of a malicious repository. A path long enough to be truncated passes git's metadata check and is written as .git, replacing a submodule's .git file with a symlink to the attacker's hooks. Git runs them during the clone, as the developer.

The same clone in Bromure Agentic Coding

Bromure Agentic Coding runs Claude Code, Codex, Grok, Kimi and omp in Ubuntu VMs on your Mac, one VM per machine. The agent's shell, its git and everything git starts run inside that VM. Credentials inside it are stand-ins, and every connection it makes passes through a virtual switch and a proxy on the Mac.

Take the worst case: an unpatched git, a malicious repository, and an agent that runs git clone --recursive without asking anyone. The hook runs, inside the machine.

It runs in a VM, away from your Mac's files

The hook runs as ubuntu in a Linux home that holds the machine's checkouts, package caches and shell history. Your Mac's home folder, Keychain and browser profiles aren't in the VM. The VM sees only the folders you chose to share with it.

When you start a session from a repository URL, the clone also runs in the machine. On machines that use the OpenShell engine, Bromure's own git calls in the VM always run inside the guest sandbox, because, in the manual's words, "a repository can point git at a program of its choosing."

The credentials it finds are stand-ins

A hook written to steal credentials finds them all in the usual places, in the format each tool expects, and every one is a stand-in. A ghp_ token GitHub never issued, an ANTHROPIC_API_KEY that starts with sk-ant-api03-brm-, an AWS secret key that's fake. The real values stay encrypted on the Mac, and the proxy swaps a stand-in for its real value only on requests to the hosts that credential belongs to.

There's no private key to copy either. The VM's SSH_AUTH_SOCK is a bridge to an agent on the Mac. It can list keys and ask for signatures, and the key bytes never enter the VM.

It has nowhere to send them

Every connection out of the VM goes through the Mac. Set the Bromure Firewall's Unmatched traffic to Deny and the machine reaches the hosts on its list and nothing else. Or switch the machine to OpenShell + Sentry: its starter policy allows GitHub, npm and PyPI read-only, plus Ubuntu's mirrors, and denies everything else. A hook that calls home to its own server gets a refusal and a red row in the Security Timeline.

With Enforce binaries on, a root-owned attestor in the VM ties every connection to the program that opened it, and each rule names the programs allowed to use it. The refusal tells you which rule and which program, so a curl started by a hook shows up as curl, not as git.

If the hook tries to reuse a token, it gets nothing out of it. Sent to any host other than the one it belongs to, a stand-in is caught by the proxy, which answers HTTP 451, pauses the VM, and opens an alert titled This environment may have been compromised, naming the credential and both hosts. Sent to GitHub, it can't push a backdoor into your other repositories: new machines put every forge in Prompt before write, so a git push from the VM waits for you to approve it in a dialog on the Mac.

The agent watchdog watches the session from outside the VM: bursts of blocked requests, credentials that don't belong, new destinations once the session has settled. Set to Quarantine, it cuts the network and pauses the VM within milliseconds.

It can only touch the files the policy allows

Under OpenShell, a filesystem_policy confines what the agent and every process it starts may read and write, with Linux Landlock. Even root in the VM can't lift it. The hook inherits that from the agent's git clone, so when it goes looking in folders the policy doesn't list, it gets "permission denied." Each refusal is a Guest sandbox row in the Timeline, and an alarm fires when one program hits its limits 20 times in a minute.

Machine VMAgent runsgit clone --recursive …the hook runs as ubuntuWhat the hook findstokens are stand-ins: ghp_…, brm-…SSH agent bridge, no key bytesno Mac home, no KeychainGuest sandbox (OpenShell)Landlock: only the listed paths,even for root in the VMYour MacDefault denyunlisted hosts refused; withEnforce binaries, names the programTripwiresstand-in to a foreign host:HTTP 451, VM pausedgit push: Prompt before writeReal secrets, Keychain-sealedswapped in only on requests tothe host each one belongs toSee it, undo itNetwork lineageprompt → claude → bash→ git → hook → curl→ refusedRewind home…home as it was at an earlierboot; the clone is goneReset disksystem disk re-cloned fromthe base image
The same recursive clone in a Bromure machine. The hook runs in the VM, finds stand-ins and no private keys, and every connection it opens meets the firewall or OpenShell policy on the Mac. The kernel sentry ties each connection to the hook's process and the agent's git clone, and Rewind home removes the clone and anything it left in the home.

You can see which clone ran it

The agent's transcript shows one git clone that succeeded. The hook never went through a tool call, so the agent has no record of it.

On a machine with the kernel sentry, a small kernel module reports every program launch and every connection from inside the VM's kernel, over a channel the agent can't silence. Double-click the refused connection in the Security Timeline and its network lineage opens: the prompt you gave, the agent's reasoning and stated intent, the tool call (Bash, git clone --recursive …, exact match), and the process chain from claude through bash and git down to the hook and the program it started. Other flows from this tool call lists everything else that clone connected to.

That row gives you the repository, the prompt that sent the agent to it, and the host the hook tried to reach.

Undoing it

The malicious clone, its symlinked hook folder and anything the hook wrote to ~/.bashrc or ~/.config all live in the machine's home, which is its own disk image. Bromure takes a copy-on-write checkpoint of it on the first successful boot of each day. Shut the machine down, open ⋯ › Rewind home…, and pick a point from before the clone. The next start comes up with the home as it was then. The current home is kept as a new point in the same list, so you can still go back for a file.

If the hook reached the system disk with sudo, Reset disk re-clones it from the signed base image and leaves the home alone. For a repository you don't trust at all, bromure-cli vm run --rm gives you a throwaway machine that is deleted when it stops: clone it there, look, and let it go.

One git to patch per machine

The agent's git is Ubuntu's git package in the VM, not the one from Apple, Homebrew or an app bundle. Updating it is sudo apt install --only-upgrade git in the machine, and every .deb download is a Supply chain row in the Timeline, so you can check which machines fetched the new one. When Bromure publishes a new base image, each machine offers the upgrade on its next start, and Yes, upgrade moves its system disk onto the new image without touching the home.

Nothing worth stealing

The hook finds stand-in tokens, an SSH bridge with no key bytes, and no Mac home. A stand-in sent to the wrong host pauses the VM.

Nowhere to go

Default deny on the Mac refuses the hook's server, and a push to GitHub waits for your OK in a dialog on the Mac.

One row tells the story

The kernel sentry ties the refused connection to the hook, to git, to the agent's clone, and to the prompt that asked for it.

Rewind past it

Rewind home takes the clone and what it wrote out of the machine. Reset disk restores the system disk from the base image.

What to do this week

  • Update git to 2.56.1 or a fixed backport everywhere you have a copy: Homebrew, your Linux machines, CI images, and any app that bundles git. Check Apple's command-line tools, GitHub Desktop and the Copilot app for updates as they ship.
  • Until then, don't clone untrusted repositories with --recursive or run git submodule update --init in them, and take git clone off your agents' list of commands that run without asking.
  • On GitHub Enterprise Server, move to 3.19.15, 3.20.11, 3.21.9 or 3.22.4.

Then give your agents a machine where a hook that runs during a clone finds nothing to steal and nowhere to send it, and where removing what it left takes a rewind. Setting default deny, OpenShell policies and the kernel sentry is covered in the Sandbox Policy chapter of the manual.