Summary
Certain OAuth providers in the MCP Python SDK can send credentials to an authorization server selected through information advertised by an untrusted MCP server. For affected HTTP clients, this may disclose secrets or other OAuth material; interactive sign-in requires a person to initiate it, while unattended providers do not.
Affected context
The issue concerns OAuth client support in mcp.client.auth in affected SDK releases. It can arise when an affected HTTP client uses ClientCredentialsOAuthProvider, PrivateKeyJWTOAuthProvider, OAuthClientProvider, or the deprecated 1.x RFC7523OAuthClientProvider and follows an authorization server advertised by an MCP server without binding credentials to the intended issuer. MCP servers, stdio clients, and clients that attach their own tokens or headers are not affected. Stored client registration information without an issuer may remain unbound after upgrading.
Exploit preconditions
- Attack surface: An affected HTTP client using one of the specified OAuth providers.
- Required access: The attacker must be able to influence or control the MCP server whose authorization-server information the client uses.
- Trigger point: The client performs an OAuth operation, such as obtaining or exchanging a token, using the selected authorization server.
- Why exploitation is possible: The affected provider may not verify that the server receiving credentials is the issuer intended to own them. Interactive use requires a person to initiate sign-in; unattended provider use does not.
Why this happens
The OAuth providers do not consistently bind credentials to an authenticated, expected authorization-server identity. As a result, server-provided authorization information can influence where sensitive client material is sent. This is primarily a data-authenticity and source-validation weakness (CWE-345), with credential exposure also related to CWE-522: Insufficiently Protected Credentials.
Potential impact
- An attacker-controlled authorization server may receive a client secret or signed client assertion.
- An authorization code or PKCE code verifier could be disclosed during an OAuth flow.
- Stolen credentials or OAuth material could enable client impersonation or unauthorized access, depending on the credential and surrounding controls.
General mitigation guidance
Defensive patterns focus on binding OAuth credentials to a trusted issuer rather than accepting an authorization server selected solely by an MCP server.
- Configure and validate an expected issuer for providers that support issuer binding.
- Replace providers that cannot express or enforce an issuer constraint with an alternative that can.
- Clear unbound stored client registration data and register it again, or ensure manually maintained registration records include the intended issuer.
- Prefer secure-by-default provider configurations that reject missing or mismatched issuer information.
- Reduce trust in server-supplied OAuth metadata, and limit the privileges and scope of OAuth clients and credentials.
How teams detect issues like this
- Review OAuth provider setup for missing issuer constraints and flows that use authorization-server metadata supplied by an MCP server.
- Use static analysis or code review checks to identify credential-bearing requests whose destination is derived from untrusted input.
- Audit stored OAuth registration records for missing or mismatched issuer values.
- Enforce policies that require trusted issuer configuration and prevent sensitive OAuth material from being sent to unapproved hosts.
- Monitor outbound requests from OAuth clients for unexpected authorization-server destinations.

