Summary
A high-severity command injection vulnerability in the n8n Git node causes certain repository-local Git configuration values to be executed as commands by the n8n process.
Exploitation requires a malicious value to be planted in a repository through a separate file-write vulnerability, after which a Git node operation accesses that repository.
Affected context
The vulnerability affects n8n workflows that use the Git node to perform operations on repositories containing attacker-controlled local Git configuration. The issue is not directly reachable through the Git node's normal configuration controls; exploitation generally depends on another weakness or trusted workflow that allows a repository-local value to be written before a subsequent Git operation.
Exploit preconditions
- Attack surface: n8n Git node operations performed against a repository
- Required access: Ability to cause or arrange for a malicious repository-local Git configuration value to exist, typically through a separate file-write path
- Trigger point: A subsequent Git node operation that reads or applies the repository-local configuration
- Why exploitation is possible: Certain configuration values are passed to Git without adequate neutralization, allowing them to be interpreted as executable command behavior under the n8n process identity
Why this happens
The underlying bug is an OS command injection condition mapped to CWE-78. The Git node trusted repository-local configuration values and allowed Git to interpret them without sufficiently separating configuration data from command-execution semantics. This creates an insecure trust boundary in which attacker-controlled repository metadata can influence process execution.
Potential impact
- An attacker may execute arbitrary commands with the privileges of the n8n process.
- The n8n runtime could be compromised.
- Workflow credentials, secrets, or locally accessible data could be exposed.
- The affected host or container could be used for lateral movement.
- Workflow integrity and connected automation systems could be disrupted.
General mitigation guidance
Mitigation generally focuses on preventing untrusted repository metadata from influencing executable Git behavior.
Common defensive patterns include:
- Restricting Git operations to repositories and working trees from trusted sources.
- Ignoring or neutralizing repository-local configuration when it is not required.
- Using narrowly scoped Git command modes and explicit allowlists for supported operations.
- Separating repository file writes from subsequent Git execution and requiring validation at the trust boundary.
- Running n8n with least-privilege operating-system and container permissions.
- Limiting accessible credentials, filesystem paths, network destinations, and process capabilities.
- Treating file-write vulnerabilities elsewhere in the deployment as capable of affecting later Git operations.
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules that identify Git process invocation with repository-controlled configuration or environment values.
- Code review checks for Git operations performed in attacker-writable working trees.
- Tests that use repositories containing unusual or untrusted local configuration and verify that no external process behavior is triggered.
- Runtime monitoring for unexpected child processes, command interpreters, or network connections spawned by the n8n process.
- File-integrity monitoring on workflow repositories and configuration directories.
- Policy enforcement that restricts n8n's filesystem writes, process creation, and network access.
Automated security review tools may help identify unsafe subprocess and Git integration patterns, but should be supplemented with deployment-level controls.

