Summary
n8n's Source Control feature, when configured to use SSH, previously disabled SSH host key verification for Git operations.
In environments where this feature is enabled, a network attacker in a man-in-the-middle position could impersonate the Git server, inject malicious workflow content, or intercept repository data.
Affected context
This vulnerability occurs in n8n instances that:
- Have the Source Control feature explicitly enabled, and
- Use SSH-based connections for Git operations (non-default configuration), and
- Communicate with a remote Git server over networks where traffic can be intercepted or routed through untrusted paths.
In such setups, SSH host key verification was disabled for Git commands, removing an important integrity and authenticity check for the remote Git endpoint.
Exploit preconditions
- Attack surface: Network communication between the n8n instance and the configured remote Git server (SSH).
- Required access: Ability to observe and intercept or control network traffic between n8n and the Git host (e.g., on-path attacker, compromised router/VPN/proxy, hostile network segment).
- Trigger point: Any Git operation performed by the n8n Source Control subsystem over SSH (such as fetch, pull, or push) while host key verification is disabled.
- Why exploitation is possible: With host key verification disabled, n8n's SSH client does not validate that the server's host key matches an expected, trusted key. This allows an attacker to present a fraudulent SSH host that n8n will accept as legitimate, enabling transparent man-in-the-middle behavior.
Why this happens
The core issue is the deliberate disabling of SSH host key verification in the Git commands used by n8n's Source Control feature when configured for SSH.
SSH host key verification exists to cryptographically bind the remote server's identity to a known key; bypassing this check removes a foundational authentication control.
Conceptually, this aligns with the broader class of improper authentication and trust validation issues, where a client accepts a remote endpoint without verifying its identity.
By not enforcing host key checks, the system treats any responding SSH server on the target address as trusted, enabling impersonation and interception of repository operations.
Potential impact
- An attacker may impersonate the Git server and serve malicious repository content that n8n pulls into workflows.
- Workflows, custom nodes, or configuration files could be tampered with, leading to arbitrary logic execution in automation pipelines.
- Repository data, including potentially sensitive workflow definitions or configuration artifacts stored in Git, could be observed or exfiltrated.
- Integrity of the automation environment can be compromised, enabling subtle supply-chain style attacks via poisoned workflow definitions.
- Downstream systems connected to n8n workflows may be indirectly impacted through manipulated automation behavior.
General mitigation guidance
Long-term mitigation focuses on restoring and enforcing strong endpoint authentication for SSH-based Git operations and constraining trust boundaries:
- Ensure SSH host key verification is enabled and enforced for all SSH connections to Git servers, using known_hosts or equivalent mechanisms.
- Prefer secure, well-configured transport channels (e.g., SSH with strict key checking or HTTPS with proper certificate validation) for source control integration.
- Treat Git repositories as part of the automation supply chain, applying integrity controls (e.g., signed commits, branch protection, approval workflows) before workflow changes are deployed.
- Isolate and harden the n8n runtime environment with least privilege so that even if repository content is manipulated, blast radius is reduced.
- Restrict which Git hosts are allowed for Source Control via configuration or network policy, limiting connections to explicitly trusted servers.
How teams detect issues like this
Detection efforts can focus on both configuration and behavioral signals:
- Configuration review: Examine the Source Control configuration for any use of SSH where host key verification is absent, disabled, or replaced by permissive options.
- Static analysis / code review: Search infrastructure and integration code for unsafe SSH client options (such as ignoring host key checks or accepting unknown keys without validation).
- Network monitoring: Monitor outbound SSH connections from the n8n instance to ensure they are only targeting expected Git servers and detect unusual endpoints or repeated reconnections.
- Repository integrity checks: Use commit signing, checksum verification, or CI policies to detect unexpected changes or non-approved commits arriving from the remote repository.
- Automated security scanning and policy-as-code tools can be configured to flag insecure SSH configurations and enforce host verification standards in deployment manifests and application settings.

