Summary
n8n-MCP exposes an authenticated server-side request forgery (SSRF) weakness in how it handles webhook trigger tools, the n8n API client URL (N8N_API_URL), and per-request URLs supplied via the x-n8n-url header in multi-tenant HTTP mode.
An authenticated user can coerce the n8n-MCP server into making arbitrary HTTP requests to internal or external targets, potentially bypassing network controls and reaching otherwise inaccessible services.
Affected context
The vulnerability appears in n8n-MCP deployments where:
- The version is between 2.18.7 and before 2.50.2, and
- Webhook trigger tools are exposed to authenticated users, and/or
- The n8n API client is configured via N8N_API_URL, and/or
- Multi-tenant HTTP mode is enabled and clients can supply URLs via the x-n8n-url header.
In these contexts, the server trusts user-controlled or tenant-controlled URLs without sufficiently constraining where outbound requests may be sent, allowing authenticated users to influence server-originated HTTP traffic.
Exploit preconditions
- Attack surface: HTTP endpoints used by n8n-MCP tooling:
- Webhook trigger tools
- n8n API client interactions (via N8N_API_URL)
- Per-request URLs provided via the x-n8n-url header in multi-tenant HTTP mode
- Required access: Valid authenticated access to n8n-MCP or a tenant context that can:
- Configure or trigger webhooks, or
- Influence N8N_API_URL usage, or
- Set the x-n8n-url header where honored by the server.
- Trigger point: Submission of crafted URLs or headers that cause n8n-MCP to initiate HTTP requests on the user's behalf.
- Why exploitation is possible: The server treats these URLs as trusted destinations and does not consistently enforce strict allowlisting, network segmentation checks, or scheme/host filtering, enabling users to direct outbound requests to internal or sensitive endpoints. Race conditions or insufficient checks around URL validation and request execution (CWE-367) can further undermine protections if validation and use are not atomic.
Why this happens
This vulnerability stems from the server using user-influenced URLs to perform outgoing HTTP requests without robust, centralized validation and restriction.
Conceptually, this maps to CWE-918: Server-Side Request Forgery (SSRF), where an application acts as an HTTP proxy that attackers can steer toward arbitrary targets.
In this case, several features—webhook trigger tools, the configurable N8N_API_URL, and x-n8n-url headers in multi-tenant HTTP mode—introduce multiple paths where URLs cross the trust boundary from authenticated users into server-controlled network operations.
If any validation (such as host allowlisting or scheme checks) happens separately from the actual network call, or relies on mutable state, race conditions aligned with CWE-367: Time-of-Check Time-of-Use (TOCTOU) can allow attackers to bypass intended constraints between the time a URL is checked and the time it is used to make a request.
Potential impact
- Access to internal HTTP services that are not directly exposed to users (e.g., internal APIs, metadata endpoints, admin interfaces)
- Bypassing firewall rules or network segmentation by tunneling requests through the n8n-MCP server
- Data exfiltration from internal endpoints that respond with sensitive configuration or operational data
- Leveraging reachable services for further exploitation, such as abusing internal admin APIs or chaining with other vulnerabilities
- Potential use of the server as a pivot point in broader network reconnaissance or lateral movement campaigns
General mitigation guidance
Effective mitigation focuses on tightly restricting where the server is allowed to send outbound HTTP requests and minimizing trust in user-supplied URLs.
Recommended defensive patterns include:
- Strict egress control: Enforce outbound network policies at the infrastructure level (e.g., firewall rules, service mesh policies) so application components cannot freely reach internal or arbitrary external addresses.
- URL allowlisting: Implement centralized, canonical allowlists of permitted hosts, schemes, and ports for all server-initiated HTTP calls. Disallow private IP ranges, link-local addresses, and metadata endpoints unless explicitly required.
- Consistent validation: Validate URLs at the last possible point before use, using a common utility that performs normalization, DNS resolution checks, and host/IP classification to avoid TOCTOU-style bypasses.
- Least privilege for features: Limit which tenants or roles can configure or influence webhook URLs, N8N_API_URL, and x-n8n-url, and avoid exposing raw URL configuration where simple identifiers or references would suffice.
- Separation of concerns: Where possible, route user-controlled callbacks through dedicated, tightly restricted outbound proxies that enforce network-level and application-level policies.
- Secure defaults: Prefer safe defaults such as disabling dynamic URL overrides in multi-tenant contexts, requiring explicit opt-in for advanced behavior, and defaulting to conservative host restrictions.
How teams detect issues like this
Detecting SSRF issues typically involves a combination of code-level analysis and runtime monitoring:
- Static analysis and code review:
- Search for HTTP client usage paths that consume configuration values like N8N_API_URL or headers such as x-n8n-url.
- Flag any code that passes user-controlled or tenant-controlled URLs directly into HTTP clients without shared validation utilities.
- Review multi-tenant and webhook-related code for branching logic based on user inputs, verifying that host and scheme validation is applied uniformly.
- Examine any URL normalization or resolution logic for potential TOCTOU gaps (e.g., separate DNS lookups and request execution paths).
- Policy enforcement:
- Apply secure coding policies requiring allowlists for outbound connections and standardized URL-validation helpers.
- Integrate these policies into CI/CD with automated checks to prevent new unvetted HTTP call sites from being merged.
- Runtime and log monitoring:
- Monitor outbound traffic patterns from n8n-MCP components; unusual destinations such as internal IP ranges or metadata addresses may indicate SSRF attempts.
- Instrument logging of target URLs (with appropriate privacy controls) for requests originating from webhook or multi-tenant paths and alert on suspicious domains or IPs.
- Automated tooling:
- Use application security testing tools (SAST/DAST) configured with SSRF-focused rules to discover endpoints that accept or forward URLs.

