MCP Gateway Authority Injection and JWT/Session Bypass via Unauthenticated Router Hairpin
The MCP router exposes an initialize method code path that bypasses the gateway JWT session validator and rewrites the upstream :authority header, gated only by a shared header value, allowing attackers to bypass authorization and access backend services.
The MCP router (ext_proc) in Kuadrant mcp-gateway versions 0.6.1 and earlier exposes an initialize method code path that allows for a critical authentication and authorization bypass. This vulnerability stems from the insufficient validation of the mcp-init-host header when present in a request. The presence of this header, combined with a correct router-key (either the hardcoded “secret-api-key” or a SHA-256 truncation of the MCPGatewayExtension UID), bypasses the gateway’s JWT session validator. This allows an attacker to rewrite the upstream :authority header to an arbitrary value, effectively impersonating any service. This bypasses both the broker’s x-mcp-authorized capability filter and the gateway’s JWT-based session model, granting unauthorized access to backend listeners registered with the gateway.
Attack Chain
- The attacker identifies a vulnerable mcp-gateway instance (version <= 0.6.1).
- The attacker obtains the
router-key. This is either the default “secret-api-key” or, in controller-managed deployments, the SHA-256 truncation of theMCPGatewayExtensionUID, which is accessible withgetpermissions or via the--mcp-router-keyparameter. - The attacker crafts a malicious HTTP request containing the
mcp-init-hostheader and the correctrouter-keyheader. - The attacker sets the
:authorityheader within the crafted request to a desired, potentially sensitive, backend service. - The MCP router, upon receiving the request with the
mcp-init-hostand validrouter-key, bypasses the JWT session validator. - The MCP router rewrites the upstream
:authorityheader based on the attacker’s provided value. - The request is forwarded to the targeted backend listener registered with the gateway.
- The attacker gains unauthorized access to the backend service, effectively bypassing authentication and authorization mechanisms.
Impact
Successful exploitation of this vulnerability allows attackers to completely bypass authentication and authorization controls in the MCP gateway. This can lead to unauthorized access to sensitive backend services, data exfiltration, and other malicious activities. The critical nature of this vulnerability lies in its ability to grant complete control over the :authority header, which is a fundamental component of service identification and routing. If the default router-key is in use, any internet-exposed mcp-gateway is trivially vulnerable.
Recommendation
- Upgrade Kuadrant mcp-gateway to a version greater than 0.6.1 to patch the vulnerability described in GHSA-g53w-w6mj-hrpp.
- Rotate the
MCPGatewayExtensionUID, if in use, to invalidate previously exposedrouter-keyvalues. - Deploy the Sigma rule “Detect MCP Gateway Authentication Bypass Attempt” to detect attempts to exploit this vulnerability by monitoring for the presence of the
mcp-init-hostheader with the defaultrouter-keyvalue in web server logs. - Monitor MCPGatewayExtension resources for unauthorized access that could lead to router-key exposure.
Detection coverage 2
Detect MCP Gateway Authentication Bypass Attempt
criticalDetects attempts to bypass authentication in MCP Gateway by checking for the presence of the 'mcp-init-host' header and the default 'router-key' in web server logs.
Detect MCP Gateway Authentication Bypass Attempt - Alternate Router Key Header
highDetects attempts to bypass authentication in MCP Gateway by checking for the presence of the 'mcp-init-host' header when the router-key header is present.
Detection queries are available on the platform. Get full rules →