Skip to main content
Menu
Advisories

Cross-route MCP session reuse bypasses per-tool JWT authorization

GHSA-72HP-5VM2-FRR7Published Updated GitHub

Description

An MCP session created on an OAuth-protected route can be resumed through another route on the same Gateway that does not validate bearer tokens. The proxy restores the original route from the session ID but does not compare it with the current request route; the original route's per-tool JWT check then parses the current token without signature verification. Under the stated configuration, a forged elevated scope can pass the protected route's per-tool rule. Confirmed on Agent Router v1.2.0. Suggested severity: Moderate (CVSS 3.1 6.8). The reproduction reached a loopback backend in an isolated handler test; full Envoy/Kubernetes/OAuth integration was not tested.

Details

Two MCP routes on one Gateway share a proxy. Route A uses OAuth and a per-tool JWT authorization rule. Route B does not configure securityPolicy.oauth; any other authentication on B neither validates the Authorization bearer token nor sets x-ai-eg-mcp-subject.

On POST session resumption, the proxy decrypts the session ID, recovers route A and the session subject, and checks only the supplied subject. It does not compare the embedded route with the current Gateway route header. The resumed session therefore retains route A's authorization configuration. Its VerifiedJWT setting is derived from route A's OAuth configuration, and the authorization code calls ParseUnverified on the current request token. Route B did not verify that token, so a caller can supply an unsigned elevated scope claim.

The initial OAuth login is not bypassed: the caller needs a valid low-scope token to create their own route-A session, as well as access to route B and the retained session ID/subject. Route-level backend and tool selectors remain in effect.

Relevant source: internal/controller/mcp_route.go:316-330; internal/controller/mcp_route_security_policy.go:149-156; internal/controller/gateway.go:684-695; internal/mcpproxy/legacy.go:215-221,643-734,680-721,1554-1566; internal/mcpproxy/mcpproxy.go:310-345; internal/mcpproxy/authorization.go:139-172.

Proof of concept

  1. On one Gateway, configure route A with OAuth and a per-tool JWT rule requiring an elevated scope. Configure route B without securityPolicy.oauth (or with authentication that neither verifies the Authorization bearer token nor sets x-ai-eg-mcp-subject). Have both routes reach the shared MCP proxy.
  2. Initialize a session through route A using a valid low-scope token; retain its returned Mcp-Session-Id and subject.
  3. Send tools/call through route B with that session ID, x-ai-eg-mcp-subject set to the session subject, and an unsigned alg=none bearer token containing the elevated scope.
  4. The proxy resumes the session as route A, compares only the subject, then applies route A's JWT rule to claims parsed with ParseUnverified.

In the isolated local test, the actual proxy handler/session authorization path sent the request to a loopback httptest backend. The saved evidence has no negative-control request. No real Envoy Gateway, Kubernetes cluster, or OAuth provider was run.

Impact

A caller with a valid low-scope account on route A can, under the stated mixed-auth route configuration, call tools through route B using forged claims that satisfy route A's per-tool JWT rule. This bypasses the protected route's intended per-tool scope boundary for tools still allowed by its backend and tool selectors. It does not bypass initial OAuth login or grant Kubernetes/cluster-admin privileges. Impact depends on which protected tools are configured and what data or actions they expose.

Affected versions

References

GitHub · theagentrouter/agent-router