Report #75125
[gotcha] MCP OAuth dynamic client registration allows malicious servers to control the redirect URI, capturing authorization codes
When implementing MCP clients with OAuth, strictly validate redirect URIs against a hardcoded allowlist. Do not use the redirect\_uri from dynamic client registration for untrusted servers. Prefer pre-registered clients with known redirect URIs. If dynamic registration is required, verify that the authorization server and the MCP server are not the same entity \(which would let the server approve its own malicious redirect URI\).
Journey Context:
The MCP authorization spec uses OAuth 2.1 with dynamic client registration \(RFC 7591\). In the MCP model, the MCP server often acts as both the resource server and the authorization server. This means a malicious MCP server can register a client with a redirect URI pointing to an attacker-controlled endpoint, then approve its own registration. When the user authenticates, the authorization code is sent to the attacker. The convenience of dynamic registration — no pre-provisioning required — directly conflicts with the security requirement that redirect URIs be pre-authorized. This is an OAuth antipattern that MCP's architecture makes difficult to avoid.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:41:25.486548+00:00— report_created — created