Summary
A server-side request forgery (SSRF) flaw in the n8n-MCP SDK embedder path allows attackers to bypass IP-based safety checks by using IPv4-mapped IPv6 addresses.
When an attacker can control the n8nApiUrl value, they may coerce the server into making HTTP requests to internal services (including cloud metadata, private networks, or localhost) and receive the responses, while also leaking the n8nApiKey to the attacker-controlled endpoint.
Affected context
This vulnerability affects deployments that embed n8n-MCP as an SDK, using:
N8NDocumentationMCPServerorN8NMCPEnginewith user-suppliedInstanceContext.
In vulnerable versions (2.47.4 through 2.47.13), the synchronous URL validator SSRFProtection.validateUrlSync() is invoked in the embedder path (N8NDocumentationMCPServer constructor, getN8nApiClient(), and validateInstanceContext()), but it does not handle IPv6 addresses. IPv4-mapped IPv6 literals such as http://[::ffff:169.254.169.254] evade checks for cloud metadata, localhost, and RFC1918 ranges.
The first‑party n8n-MCP HTTP server is less exposed because it performs an additional asynchronous validation (validateWebhookUrl) that correctly detects IPv6, but SDK-based integrations relying only on the synchronous validator remain at risk.
Exploit preconditions
- Attack surface: Any code path where the n8n-MCP SDK is embedded and accepts user-influenced
n8nApiUrlvalues—typically viaInstanceContextpassed intoN8NDocumentationMCPServerorN8NMCPEngine. - Required access: Ability to supply or influence the URL used to configure the connection to an n8n instance (e.g., user input fields, configuration parameters, or assistant/tool settings bridged to
n8nApiUrl). - Trigger point: When the SDK initializes the n8n API client or validates the instance context and then performs HTTP calls to the specified
n8nApiUrl. - Why exploitation is possible: The synchronous SSRF validator only checks IPv4-style addresses and hostnames; IPv4-mapped IPv6 literals are not recognized as internal or sensitive targets, so requests to cloud metadata, localhost, or private IP space are allowed and their responses are proxied back to the caller along with the
x-n8n-api-keyheader.
Why this happens
The root cause is incomplete SSRF protection logic that assumes all relevant IP checks can be done against traditional IPv4 addresses and hostnames, while ignoring IPv6 and IPv4-mapped IPv6 syntax.
In the n8n-MCP SDK embedder path, SSRFProtection.validateUrlSync() is responsible for blocking connections to sensitive address ranges (cloud metadata endpoints, localhost, and RFC1918 networks). However, its implementation does not normalize or inspect IPv6 literals, including IPv4-mapped IPv6 addresses of the form ::ffff:a.b.c.d. As a result, an attacker can encode a sensitive IPv4 address inside an IPv6 literal and avoid the allow/deny logic altogether.
This behavior maps to CWE-918: Server-Side Request Forgery, where a server that can make HTTP requests on behalf of users fails to properly restrict the set of reachable endpoints, enabling access to internal resources and unintended credential disclosure.
Potential impact
- Access to cloud metadata endpoints (such as
169.254.169.254equivalents) which may expose cloud instance credentials or configuration data. - Unauthorized interaction with internal RFC1918 services (e.g., databases, message queues, admin panels) reachable only from the server's network.
- Requests to
localhostservices that may expose debug endpoints, admin interfaces, or local daemons not intended for remote access. - Exfiltration of the
n8nApiKeyvia thex-n8n-api-keyheader forwarded to attacker-controlled endpoints. - Use of the n8n-MCP deployment as a pivot point for network reconnaissance or further lateral movement within the environment.
General mitigation guidance
Mitigation is centered on robust SSRF defenses, input hardening for URLs, and network-layer containment:
- Implement URL validation that:
- Normalizes and resolves hostnames and IP literals (including IPv6 and IPv4-mapped IPv6),
- Explicitly blocks access to link-local, loopback, and RFC1918 ranges,
- Rejects raw IP literals where not strictly required, or enforces an explicit allowlist of domains.
- Prefer allowlist-based destination policies (e.g., only permit URLs whose host matches known n8n domains or specific deployment hostnames).
- Treat any user- or assistant-controlled endpoint configuration as untrusted input; avoid passing such values directly into HTTP clients without validation and canonicalization.
- Apply least-privilege network egress controls at the host, container, or cluster level so that application processes cannot reach metadata services, private infrastructure, or arbitrary external networks by default.
- Limit propagation of high-privilege secrets (such as
n8nApiKey) to only those outbound requests that truly require them; decouple authentication headers from generic HTTP forwarding where possible.
How teams detect issues like this
Detection generally involves combining code-level analysis with runtime monitoring:
- Static analysis and code review:
- Search for internal HTTP clients instantiated with user-influenced URLs (e.g., parameters named
n8nApiUrl,baseUrl, or similar). - Verify that any SSRF protection utilities properly support IPv6 and perform normalization and address-range checks before use.
- Flag patterns where validation is split into "sync" and "async" paths and only one path enforces complete network restrictions.
- Security testing:
- Incorporate SSRF test cases into automated security testing, including payloads using IPv4-mapped IPv6 addresses and various hostname encodings.
- Use DAST or API security scanners configured to probe for internal address access through URL parameters exposed by MCP integrations.
- Operational monitoring:
- Monitor outbound traffic for requests to well-known metadata IPs, loopback, and RFC1918 ranges from application workloads.
- Set alerts on anomalous use of authentication headers (such as
x-n8n-api-key) to non-standard or unexpected destinations.

