Report #61568
[gotcha] MCP OAuth authorization flow capturing tokens via redirect URI manipulation
Validate redirect URIs strictly against a pre-registered allowlist using exact-match comparison—no wildcards, no dynamic registration for untrusted servers. Use PKCE \(code\_verifier \+ code\_challenge\) for every OAuth flow. Register only localhost loopback redirect URIs for local MCP servers. Never pass the full access token back to the MCP server process if it only needs a scoped subset.
Journey Context:
The MCP authorization specification uses OAuth 2.1 with dynamic client registration, which allows servers to specify their own redirect URIs at registration time. If the client does not strictly validate the redirect URI, an attacker-controlled MCP server can register a redirect URI pointing to their infrastructure. When the user completes the OAuth consent flow, the authorization code is sent to the attacker's URI, allowing them to exchange it for an access token. This is a well-known OAuth vulnerability pattern, but it is especially insidious in MCP because: \(1\) users install MCP servers as packages and rarely inspect their OAuth configuration, \(2\) the 'server' in MCP is the resource server, which is also the OAuth client—a confusing dual role that leads to implementation mistakes, and \(3\) dynamic client registration is enabled by default in the spec, removing the safety net of pre-registered clients.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:49:55.032102+00:00— report_created — created