/

CVE-2026-42449

Severity:

HIGH RISK

(8.5)

Server-Side Request Forgery (SSRF) in n8n-MCP SDK Embedder

CVE-2026-42449

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Internal network access and credential exposure via non-blind SSRF

Severity:

HIGH RISK

(8.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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:

  • N8NDocumentationMCPServer or
  • N8NMCPEngine with user-supplied InstanceContext.

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 n8nApiUrl values—typically via InstanceContext passed into N8NDocumentationMCPServer or N8NMCPEngine.
  • 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-key header.

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.254 equivalents) 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 localhost services that may expose debug endpoints, admin interfaces, or local daemons not intended for remote access.
  • Exfiltration of the n8nApiKey via the x-n8n-api-key header 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.

Sources

SourceLink
github.comgithub.com/czlonkowski/n8n-mcp/commit/9639f757853149f0cb16663cc8b6b6468f27a25f
github.comgithub.com/czlonkowski/n8n-mcp/security/advisories/GHSA-56c3-vfp2-5qqj

Frequently asked

questions

Exploitability depends on whether an attacker can control or significantly influence the n8nApiUrl parameter within an application embedding the n8n-MCP SDK. In environments where users or AI assistants can provide or shape that URL, exploitation is straightforward and can be performed remotely via normal application interfaces.

In most scenarios, some level of access is required—either authenticated user access or the ability to drive an AI assistant or integration that passes data into InstanceContext. However, once that access exists, the attacker does not need special network privileges, because the vulnerable service itself issues the internal requests.

The most robust fix is to implement centralized, canonical URL validation that:

  • Resolves hostnames and IP literals (including IPv6) before applying network policies,
  • Enforces a strict allowlist of permitted hosts or domains for n8nApiUrl,
  • Blocks all internal, metadata, and loopback ranges regardless of address representation, and
  • Avoids attaching high-privilege credentials to arbitrary outbound requests.

Future designs should treat any user-controlled or assistant-controlled URLs as untrusted, and:

  • Apply consistent SSRF protection libraries that fully understand IPv4, IPv6, and encoded hostnames,
  • Use allowlists instead of attempting to block "bad" networks,
  • Constrain outbound network access at the infrastructure level, and
  • Include SSRF test cases (including IPv6 and obfuscated hosts) in automated security testing and code review guidelines.
Find out what's already
exploitable in your codebase.