Summary
n8n-MCP's multi-tenant HTTP mode incorrectly falls back to operator-level N8N_API_URL / N8N_API_KEY credentials when tenant-specific headers are missing or incomplete.
This allows an authenticated tenant to have their management requests executed against the operator's own n8n instance instead of their isolated tenant instance, risking cross-tenant access and privilege escalation in shared deployments.
Affected context
The vulnerability occurs in n8n-MCP deployments configured in HTTP transport mode with multi-tenancy enabled (ENABLE_MULTI_TENANT=true).
In this configuration, each incoming request is expected to specify the target n8n instance via x-n8n-url and x-n8n-key headers.
When those headers are omitted or provided only partially, the system silently reuses process-level N8N_API_URL and N8N_API_KEY values that typically correspond to the operator's own n8n instance.
This behavior is primarily risky in shared multi-tenant services where multiple tenants share the same n8n-MCP server; single-tenant deployments or those with multi-tenancy disabled are not affected by this specific issue.
Exploit preconditions
- Attack surface: HTTP-mode n8n-MCP API exposed to multiple authenticated tenants.
- Required access: The attacker must be a valid MCP tenant with the ability to send authenticated requests to the shared n8n-MCP instance.
- Trigger point: Issuing a request in multi-tenant mode that omits
x-n8n-urland/orx-n8n-keyheaders, causing the server to fall back to the process-level N8N_API_URL / N8N_API_KEY. - Why exploitation is possible: The system assumes that missing or incomplete tenant routing headers should default to operator-level credentials rather than rejecting the request or treating it as misconfigured, breaking isolation between tenants and operator.
Why this happens
The core issue is an instance of CWE-284: Improper Access Control, specifically around multi-tenant routing and credential selection.
Instead of enforcing strict, explicit tenant identification for every request, the code path in HTTP mode allows fallback to a shared, high-privilege configuration (N8N_API_URL and N8N_API_KEY) when tenant-specific headers are absent or incomplete.
This design effectively treats ambiguous or malformed tenant requests as trusted operator operations, violating the principle of tenant isolation and least privilege.
At an abstract level, the bug arises from coupling routing/authentication decisions to global configuration defaults, and not requiring explicit binding between each request and its tenant-specific credentials.
Potential impact
- An authenticated tenant could cause administrative or management operations to run against the operator's n8n instance instead of their own.
- Cross-tenant data exposure or manipulation may occur if operator-level credentials grant access to workflows, secrets, or executions.
- Tenants could indirectly gain higher privileges by leveraging the operator's API permissions.
- Misrouting of automation tasks could lead to unintended changes, configuration drift, or integrity issues in the operator's environment.
General mitigation guidance
Effective mitigation focuses on enforcing strict tenant isolation and eliminating insecure fallbacks in request routing:
- Require explicit, validated tenant-identifying headers for every multi-tenant HTTP request; reject or fail closed when they are missing, incomplete, or inconsistent.
- Avoid using operator-level or process-level API credentials as a default target for ambiguous requests; treat such scenarios as configuration or client errors.
- Separate operator and tenant credentials clearly, using distinct execution contexts and minimizing shared configuration that could be reused unintentionally.
- Apply least-privilege principles to any operator-level API keys so that, if misused, their ability to alter or read tenant-sensitive data is limited.
- Consider architectural patterns such as per-tenant configuration instances or token-based routing that does not rely on optional headers alone.
How teams detect issues like this
Organizations can detect and monitor for this class of issue using a combination of code-level and operational techniques:
- Static analysis and code review: Look for logic paths where multi-tenant routing or authentication falls back to global or operator-level credentials when tenant-specific identifiers are missing; flag any "default tenant" or "fallback" behavior in access control code.
- Configuration and policy checks: Enforce policies that forbid using high-privilege operator credentials as a default target for shared services; ensure that multi-tenant mode requires explicit tenant metadata per request.
- Logging and anomaly detection: Enable detailed request logging that records which credentials or target instances were used; alert on cases where an authenticated tenant's requests are executed against the operator's n8n instance or any unexpected endpoint.
- Automated security testing: Use integration tests or security scanners to simulate tenant requests without the required headers and confirm that the system fails safely rather than defaulting to privileged contexts.

