Your repo's Git config can run code past the agent sandboxHooks, fsmonitor and filters in Codex and Cursor
On October 30, OpenAI published four Codex advisories in which Git did the attacker's work. In three, Git ran a program named in the repository's local config, outside the Codex sandbox and without approval. Pillar Security showed the same class in Cursor in July, where the agent itself wrote the config. Update both tools, scan your disk for these settings, and start Git with the dangerous keys switched off.
-
01
Source
Local config
core.fsmonitor, core.hooksPath, filters
.git/config or a renamed git dir -
02
Channel
Tool runs Git
metadata scan or editor auto-detect
outside the agent sandbox -
03
Exposure
Your user
program runs with your permissions
no approval prompt
TL;DR· the answer, in twenty seconds
What happened: OpenAI published CVE-2026-19590 through CVE-2026-19593 on October 30. In three, Codex ran Git against a repository whose local config named a program as a hook, filesystem monitor or attribute filter, and Git started that program outside the sandbox without asking. In the fourth, a Git command Codex judged safe could rewrite Codex's own config. Pillar Security showed the same class in Cursor, where the agent wrote the config inside the sandbox and Cursor's Git extension ran it outside.
The minimum fix: Update Codex CLI to 0.131.0 or later and Codex Desktop to 26.519 or later. Update Cursor. Run the audit script in this guide over your code directories, and start your agents with core.fsmonitor, core.hooksPath and safe.bareRepository overridden in the environment.
The lesson: A repository's local Git config is executable input. Any tool that runs Git outside the sandbox, including your editor, inherits whatever the agent or the archive put there.
On October 30, OpenAI published four security advisories for Codex in which Git did the attacker's work, and in three of them Git read a program path from the repository's local config and ran it, outside the Codex sandbox, with no approval prompt.
None of those three is a Codex parser bug or a model jailbreak. Git did what its documentation says it does. core.fsmonitor names a program Git asks about changed files. core.hooksPath tells Git where to find hooks. A clean or process filter runs a program over file contents. Codex ran git status and similar commands on its own to collect repository metadata, and those commands ran outside the sandbox that wraps the agent's shell. Whoever controlled .git/config chose what ran.
Cursor had its own version of this in July, and that one is worse in a specific way. Nobody had to hand the victim a booby-trapped repository. The agent, steered by a prompt injection, wrote the config from inside the sandbox, and Cursor's Git extension ran it from outside. This guide covers what each advisory says, which Git settings start programs, how to find them on your disk without triggering them, and what to change in Codex, Cursor and Claude Code.
Four advisories, one file
OpenAI's advisory index lists eight advisories. Four of them, published on openai.com on October 30 after the CVE records went out on September 1, share the Git root cause:
| CVE | What Git ran | Products | Reporter |
|---|---|---|---|
| CVE-2026-19590 | A hook from the directory in core.hooksPath |
Codex Desktop | Sina Kheirkhah, Summoning Team |
| CVE-2026-19591 | A Git command through PowerShell that wrote Codex's own config | Codex CLI 0.72.0 to 0.130.0, Codex Desktop | Compass Security |
| CVE-2026-19592 | The program in core.fsmonitor |
Codex CLI 0.102.0 to 0.130.0, Codex Desktop | Fudan University SSS Lab and maitai of Doyensec, via ZDI |
| CVE-2026-19593 | A clean or process filter selected through attr.tree |
Codex Desktop | Satoki Tsuji, Ikotas Labs |
The fixed versions are the same for all four: Codex CLI 0.131.0, Codex Desktop for macOS 26.519.22136, and Codex Desktop for Windows 26.519.21041 (Microsoft Store package 26.519.2081.0). OpenAI reports no known abuse in the wild for any of them.
CVE-2026-19592 is the clearest case. "Codex automatically used Git to collect repository metadata," the advisory says, and during that check Git ran whatever core.fsmonitor pointed at. The Codex command sandbox did not cover it and Codex did not ask. CVE-2026-19593 needed even less: opening the workspace was enough, and the advisory notes that "the attack did not require the user to interact with a model."
CVE-2026-19591 is the odd one out, and the most interesting. Codex and PowerShell disagreed about the stop-parsing token --%, so Codex classified a Git command that wrote a file as safe and ran it without asking. If that write landed in the Codex configuration file, it could register an MCP server the attacker controlled, which would start the next time Codex loaded its config. The attack needed the model to follow repository instructions, plus PowerShell, which on macOS and Linux means a separate pwsh install. OpenAI notes that the default filesystem sandbox on macOS and Linux could stop Git from writing the config file.
Each advisory carries the same condition, and it matters for your threat model: "A Git clone does not copy the source repository's local .git/config file." I confirmed that on git 2.54.0. A fresh git clone of a repository with core.fsmonitor set produced a clone with no such key. So these attacks do not arrive through git clone. They arrive through copies: a zip or tarball of a working tree, a folder shared over a sync service, a Docker volume, a repo someone hands you on a USB stick, a CI artifact, or a .git directory checked into another project's test fixtures. OpenAI's interim advice for 19590 and 19592 is "do not open untrusted repository archives or copies that include the source repository's .git/config file."
That condition does not cover the second half of the problem, where nobody hands you anything.
The agent writes the config, something else runs it
Pillar Security published The Week of Sandbox Escapes on July 20: seven escapes across Cursor, Codex CLI, Gemini CLI and Google's Antigravity. Two of the seven go through Git, and in both the agent, following injected instructions, writes the Git metadata itself.
GitPwned hit Codex CLI. Codex shipped a safe-command list that skipped both the sandbox and the approval prompt, and git show was on it because showing a commit sounds read-only. It isn't. git show accepts --output, which writes to a file, and --format, which controls what gets written. Pillar's payload wrote a [diff] section into the repository config:
# Pillar Security's GitPwned payload against Codex CLI before v0.95.0
git show --format='[diff]%nexternal = bash -c '"'"'open -a Calculator'"'"'' \
--no-patch --output=./.git/config HEAD
After that, the next git diff ran the attacker's command as the external diff tool. git diff was also on the safe list. Pillar reported it on January 7, OpenAI fixed it in v0.95.0, and its advisory ID is GHSA-w5fx-fh39-j5rw. The detail I keep coming back to is from Pillar's disclosure timeline: Bugcrowd's triage first could not reproduce the bug because the model refused the injected instruction. Pillar had to explain that model refusal is probabilistic. If one run in ten complies, the allowlist is the only thing between that run and your shell.
The Cursor finding is the better lesson. Cursor had already patched the obvious path. Its earlier advisory, GHSA-8pcm-8jpx-hv8r (CVE-2026-26268, fixed in 2.5), described a prompt-injected agent writing .git settings, including hooks, that Git later ran outside the sandbox "next time they are triggered." After that fix, Cursor's macOS sandbox profile denied writes matching this rule, quoted by Pillar:
(deny file-write* (regex "^.*/\.git/config$"))
Git does not require the Git directory to be called .git. git init --separate-git-dir=.git-alt leaves a one-line .git file in the working tree that points at the real metadata directory, wherever you put it. Pillar's agent created a probe repository that way, wrote core.fsmonitor into .git-alt/config, and dropped a helper script into .git-alt/hooks. None of those paths matched the regex. Cursor's Git extension noticed the new repository, ran git status from the extension host, outside the sandbox, and Git started the helper. "The sandbox tried to protect a path spelling," Pillar wrote. "Git was operating on a repository abstraction."
The Cloud Security Alliance's research note on the series names the pattern well: in every case "the sandbox boundary itself held," and the downstream component that consumed the agent's output was not built to re-check trust. CSA also notes that the material it reviewed did not say whether Cursor had patched the Git-directory finding. Cursor 3.0.0 fixed a separate hook-execution escape from the same week. Update Cursor regardless, and do not assume a given build covers renamed Git directories until you have tested it.
Which Git settings start a program
You cannot defend a list you have not written down. These are the repository-local keys I treat as executable, with what triggers each one. The git-config reference documents all of them.
| Key | What runs | Triggered by |
|---|---|---|
core.fsmonitor |
The named program, as a file-change oracle | git status, git diff, anything that refreshes the index |
core.hooksPath |
Every hook in the named directory | commit, checkout, merge, rebase, push |
hooks/ in the Git dir |
The hook scripts themselves | the same operations |
diff.external |
An external diff program | git diff, git log -p |
diff.<driver>.textconv, diff.<driver>.command |
A converter or diff program for matching files | diff and log with patches |
filter.<driver>.clean, .smudge, .process |
A filter over file contents | git add, git status, checkout |
attr.tree |
Nothing itself, but it lets config choose which attributes, and so which filters, apply | any attribute lookup |
merge.<driver>.driver |
A merge program | merges and rebases |
core.sshCommand, core.gitProxy |
A transport program | fetch, pull, push |
core.pager, core.editor, core.askPass |
A pager, editor or credential prompt | interactive commands |
include.path, includeIf.* |
Nothing itself, but it pulls in another config file with any of the above | every config read |
Two things make this list harder than it looks. Attribute-driven filters need a driver name that can be anything, so you cannot neutralize them with one fixed override. And include.path can move every other key into a file outside .git, where a path-based sandbox rule will never look.
I checked the core.fsmonitor case end to end on git 2.54.0. A local script set as core.fsmonitor ran on a plain git status. git -c core.fsmonitor=false status did not run it, and neither did the same override passed through the environment. A core.hooksPath hook ran on git commit and stayed silent with -c core.hooksPath=/dev/null.
Find the settings already on your disk
Do not audit these repositories by running git config --list inside them. Some config reads are harmless, but the habit of running Git in a directory you suspect is the habit this whole class of bug exploits. The script below reads each config file with git config --file, which parses the file and executes nothing. It also finds Git directories by their contents, a HEAD file next to config and objects/, so .git-alt, bare foo.git directories and submodule metadata under .git/modules all show up.
#!/usr/bin/env bash
# git-exec-audit.sh: list repo-local Git settings and hooks that start a program.
# Reads config files directly. It never runs Git inside the repos it inspects.
# Usage: git-exec-audit.sh [root]
set -u
root="${1:-.}"
pattern='^(core\.(fsmonitor|hookspath|sshcommand|pager|editor|askpass|gitproxy)|diff\.external|(diff|merge|filter)\..*\.(command|textconv|driver|clean|smudge|process)|attr\.tree|include\.path|includeif\..*|uploadpack\.packobjectshook)$'
# A Git directory is any directory holding HEAD, config and objects,
# whatever it is called: .git, .git-alt, foo.git, or a bare repo root.
find "$root" -type f -name HEAD 2>/dev/null | while IFS= read -r head; do
d=$(dirname "$head")
[ -f "$d/config" ] && [ -d "$d/objects" ] || continue
git config --file "$d/config" --get-regexp "$pattern" 2>/dev/null | sed "s|^|$d: |"
ls "$d/hooks" 2>/dev/null | grep -v '\.sample$' | sed "s|^|$d: hook |"
done
I ran it against a test tree with four repositories: one clean, one with core.fsmonitor, diff.external, a filter and a post-checkout hook, one created with --separate-git-dir=.git-alt and a core.hooksPath, and one bare srv.git with an include.path. It reported all five settings and the hook, and nothing from the clean repository:
./bad/.git: core.fsmonitor /tmp/x.sh
./bad/.git: diff.external bash -c id
./bad/.git: filter.lfsx.clean sh evil
./bad/.git: hook post-checkout
./srv.git: include.path /tmp/inc
./alt/.git-alt: core.hookspath /tmp/hk
Run it over ~/src, ~/Downloads and wherever your agents create worktrees. Expect noise. Husky and lefthook set core.hooksPath, Git LFS installs filter.lfs.* and hooks, and some teams set diff.<driver>.textconv for lockfiles or notebooks. The point is to look at each line once and know why it is there. A core.fsmonitor you did not set, a hook path outside the repository, or an include.path into /tmp is the finding.
Check ~/.gitconfig too, with git config --global --get-regexp and the same pattern. An agent that can write to your home directory can put any of these keys where every repository inherits them.
Harden Codex, Cursor and Claude Code
Every tool: start Git with the dangerous keys off
Git reads GIT_CONFIG_COUNT, GIT_CONFIG_KEY_<n> and GIT_CONFIG_VALUE_<n> from the environment and applies them on top of every config file. Values set this way win over .git/config. Wrap the agent so every Git process it or its harness starts inherits the overrides:
# ~/.zshrc or ~/.bashrc
agent_git_env() {
env GIT_CONFIG_COUNT=3 \
GIT_CONFIG_KEY_0=core.fsmonitor GIT_CONFIG_VALUE_0=false \
GIT_CONFIG_KEY_1=core.hooksPath GIT_CONFIG_VALUE_1=/dev/null \
GIT_CONFIG_KEY_2=safe.bareRepository GIT_CONFIG_VALUE_2=explicit \
"$@"
}
alias codex='agent_git_env codex'
alias claude='agent_git_env claude'
safe.bareRepository=explicit makes Git refuse a bare repository it discovers on its own, which closes the trick of turning a directory into a bare repo by dropping HEAD, config and objects/ into it. On git 2.54.0, git log inside a bare repository failed with "cannot use bare repository" under this override. The git-config reference says explicit will become the default in Git 3.0.
Know what this costs and what it misses. core.hooksPath=/dev/null also switches off your own pre-commit hooks for commits the agent makes, so run your checks in CI or by hand. It does nothing about filter drivers, whose names you cannot predict, or include.path. And it only reaches processes started from that shell. Cursor launched from the Dock does not get it. Confirm the variables reach the agent's commands by asking it to run env | grep GIT_CONFIG.
I left diff.external out on purpose. Pillar suggests git -c diff.external= diff to break the GitPwned chain. On git 2.54.0, that empty override makes every git diff fail with "external diff died", including in clean repositories, so the agent loses a command it runs all the time. If you want the protection, have your tooling pass --no-ext-diff instead.
Codex
Check codex --version and update anything below 0.131.0. Codex Desktop should be at 26.519.22136 or later on macOS and 26.519.21041 or later on Windows. Keep the default filesystem sandbox on. OpenAI's advisory for 19591 names it as the control that could stop Git from rewriting the Codex config on macOS and Linux, and the approvals and security docs cover the modes. Do not point Codex at an unpacked archive or a shared folder that contains a .git directory until you have run the audit over it.
As a limited check of the current build, I ran codex-cli 0.172.0 once with codex exec in a repository whose core.fsmonitor pointed at a logging script. The script did not run. That covers one non-interactive run on one machine. The desktop app and interactive sessions are untested.
Cursor
Update Cursor. Its 2.5 release fixed CVE-2026-26268, and CSA lists 3.0.0 as the fix for the hook-execution escape from Pillar's July series. Pillar's renamed-directory escape depended on the editor's Git extension finding a new repository and running git status on it. Cursor is built on VS Code, and the auto-detection Pillar describes is what VS Code's Git extension does, so that extension's settings are the place to cut the trigger. I checked these names and values against the extension's manifest in the VS Code repository, not against a Cursor build:
{
"git.autoRepositoryDetection": false,
"git.openRepositoryInParentFolders": "never"
}
With auto-detection off, a repository the agent creates in a subfolder stays inert until you open it. You lose the automatic source-control view for nested repositories. If you need it, use "openEditors" so Git only scans repositories for files you have opened yourself.
Claude Code
None of these advisories name Claude Code, and I have not tested its sandbox against a renamed Git directory. What its sandboxing docs do say is specific. Inside the writable working directory, the sandbox still denies writes to hooks and config inside .git, to .gitconfig, and to the top-level HEAD, objects and refs files that would turn the directory into a bare repository. An allowWrite entry does not override that list. In linked worktrees, the sandbox allows writes to the main repository's shared .git directory but keeps hooks/ and config denied.
That list names .git by name. Nothing in it covers a metadata directory stored under another name, which is the path Pillar used against Cursor. Until you have tested your build, keep the sandbox on, and on macOS add your own rule to the project's .claude/settings.json, where ./ resolves to the project root:
{
"sandbox": {
"enabled": true,
"filesystem": {
"denyWrite": ["./**/.git-*/config", "./**/.git-*/hooks"]
}
}
}
The settings reference says mid-path wildcards in denyWrite work on macOS only. On Linux and WSL2, only a trailing /** works, so this rule covers nothing there. It is also a spelling, and a determined agent can pick another name. The environment overrides above are the stronger layer on every platform, because they act on Git's reading of the config, whatever the directory is called. As with Codex, I ran Claude Code 2.1.333 once in print mode in the core.fsmonitor test repository, and the script did not run. One run, one machine, no interactive session.
What this means for your stack
Today: update Codex CLI to 0.131.0 or later and Cursor to the current release, run the audit script over every directory your agents work in, and put the GIT_CONFIG_COUNT wrapper in your shell. In Cursor, turn off Git auto-detection for nested repositories. In Claude Code, keep the sandbox enabled, and on macOS add deny rules for renamed Git directories.
The pattern behind every bug in this guide is a trust handoff. The agent runs in a box, and a tool outside the box reads files the agent or the attacker could shape: Git config, hooks, editor tasks, interpreter paths. Sandbox rules match paths. Git and the editor act on what the files mean. The fix that holds is to treat every file a tool outside the sandbox will execute as part of the sandbox's own surface, and to keep standing credentials out of reach of whatever runs when that fails. A hook that escapes the sandbox and finds no tokens in the environment, no keys in dotfiles and no long-lived session to borrow has far less to take.
hasp is one working implementation of that second half. It keeps secrets in a local encrypted vault and injects them into the one command that needs them at run time, so the secrets you move into it stop sitting in the shell environment or a .env file, where a Git hook or fsmonitor helper running as you would read them. Install with curl -fsSL https://gethasp.com/install.sh | sh and run hasp setup. Source-available (FCL-1.0), local-first, macOS and Linux, no account.
Whatever you run, add Git config to the list of files you review when an agent touches a repository, next to package.json scripts and CI workflows. Codex, Cursor and your editor will keep running Git for you, because that is how they show you what changed. The settings that decide what Git starts live in a file most people never open.
Sources· cited above, in one place
- OpenAI Security advisories for Codex CLI, Codex Desktop, the Codex IDE extension and Atlas
- OpenAI CVE-2026-19590: Git hooks could run code without approval in Codex Desktop
- OpenAI CVE-2026-19591: A Git command could run through PowerShell without approval in Codex CLI and Codex Desktop
- OpenAI CVE-2026-19592: Git could run a filesystem monitor without approval in Codex CLI and Codex Desktop
- OpenAI CVE-2026-19593: Git attribute filters could run code when a user opened a workspace in Codex Desktop
- Pillar Security The Week of Sandbox Escapes: seven escapes across Cursor, Codex, Gemini CLI and Antigravity
- Pillar Security GitPwned: Codex CLI's git show allowlist entry to remote code execution
- Pillar Security Git directories do not have to be called .git: escaping Cursor's sandbox with --separate-git-dir and fsmonitor
- Cloud Security Alliance AI coding agent sandbox escapes: the trust handoff flaw
- Cursor GHSA-8pcm-8jpx-hv8r (CVE-2026-26268): sandbox escape via writing .git configuration
- Anthropic Configure the sandboxed Bash tool: read defaults, credential entries and security limits
- Git git-config reference: core.fsmonitor, core.hooksPath, attr.tree, safe.bareRepository and GIT_CONFIG_COUNT
Stop handing the agent your real keys.
hasp keeps secrets in one local encrypted vault, brokers them into the child process at exec, and never lets the agent read the value.
- Local, encrypted vault — no account, no cloud, no telemetry by default.
- Brokered run — agent gets a reference, the child process gets the value.
- Pre-commit + pre-push hooks catch managed values before they ship.
- Append-only HMAC audit log answers "did the agent touch the prod token?" in seconds.
macOS & Linux. Source-available (FCL-1.0, converts to Apache 2.0). No account.