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

CVE-2026-27124: FastMCP: Missing Consent Verification in OAuth Proxy Callback Facilitates Confused Deputy Vulnerabilities

highCVSS 4.0 8.2GHSA-rww4-4w9c-7733

FastMCP before 3.2.0 has a confused-deputy flaw in its OAuthProxy. The IdP callback handler never checks that the browser returning from the identity provider just gave consent. An attacker can trick a logged-in victim into authorizing the attacker's MCP client and get a token for the victim's account. Upgrade fastmcp to 3.2.0.

Published Mar 31, 2026 · Updated Apr 6, 2026 · Analysis Oct 31, 2026

What an attacker can do

OAuthProxy._handle_idp_callback accepts any valid state and code pair. It exchanges the code with the IdP and redirects the browser to the client's callback URL with a new code. It does not tie the callback to a browser that approved the client. Identity providers such as GitHub skip their consent page for clients a user already approved, so the whole flow can run with no prompt.

The attack in the advisory: the attacker connects their own malicious MCP client to a server that uses GitHubProvider, consents as themselves, and captures the GitHub authorization URL. They lure a victim, who is logged into GitHub and has used the server before, to open that URL. The victim's browser lands on the callback, and the proxy sends a valid authorization code to the attacker's client. The attacker exchanges it for an access token to the MCP server as the victim. Impact is mainly integrity, with access to resources tied to the victim's account. It was verified only for GitHubProvider, but the advisory says any IdP that can skip consent is exposed.

Who is affected

pip package fastmcp, versions before 3.2.0, for servers that use OAuthProxy or an OAuth provider built on it, such as GitHubProvider. Servers without OAuth proxying are not in scope. Check the version:

pip show fastmcp

fastmcp

Ecosystem
PyPI
Affected
< 3.2.0
Fixed in
3.2.0
Check
pip show fastmcp

How to fix it

Upgrade to fastmcp 3.2.0:

pip install --upgrade fastmcp==3.2.0

The advisory recommends binding the callback to the consenting browser with a consent cookie or similar browser-bound state, as the MCP specification's security best practices describe. It lists no workaround beyond upgrading. After patching, consider revoking and reissuing tokens for users who may have been targeted.

How to tell if you were hit

Look in the MCP server and OAuthProxy logs for callbacks where the token issued goes to a client you do not recognize, or for new client registrations followed by token issuance for existing users. Ask users whether they opened unsolicited GitHub authorization links. The advisory gives no log signature. Compare OAuth grants in the identity provider with your known clients.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

While testing the *GitHubProvider* OAuth integration, which allows authentication to a FastMCP MCP server via a FastMCP OAuthProxy using GitHub OAuth, it was discovered that the FastMCP OAuthProxy does not properly validate the user's consent upon receiving the authorization code from GitHub. In combination with GitHub’s behavior of skipping the consent page for previously authorized clients, this introduces a Confused Deputy vulnerability.

Technical Details

An adversary can initiate an authentication flow by connecting their malicious MCP client to a benign MCP server using the *GitHubProvider* OAuth integration. During this flow, the attacker consents to connect their client to the MCP server and, at that point, can capture the GitHub authorization URL they are redirected to after granting consent. The attacker can then lure a victim, who is already logged into GitHub and has previously connected an MCP client to the benign MCP server, to open this captured URL. As a result, the victim’s browser is immediately redirected to the OAuthProxy’s callback endpoint, which does not correctly enforce that this browser has just given consent. The OAuthProxy then redirects the victim’s browser to the malicious MCP client’s callback URL with a valid authorization code. The attacker can exchange this code for an access token to the benign MCP server associated with the victim’s GitHub account, potentially gaining unauthorized access to resources tied to that account.

Although this issue was verified in practice only for the *GitHubProvider*, a review of the source code, specifically the OAuthProxy._handle_idp_callback function, shows that the IdP callback handler does not verify whether the browser sending the state and code has previously consented to connecting the client to the server. As long as a valid state and code pair is provided, the OAuthProxy requests an access token from the IdP and then redirects the user-agent to the client’s callback URL with a new code and the corresponding state, allowing the client to retrieve the access token from the proxy. This pattern causes all OAuth integrations whose IdP allows skipping the consent page to be vulnerable to this attack.

Skipping the consent page is not, by itself, a vulnerability on the IdP side. Many providers legitimately skip consent for first-party or previously authorized clients with the same scopes. In this case, the core problem lies in the OAuthProxy callback handler not correctly verifying that the browser issuing the callback request is the same one that has just given the required consent.

Steps to reproduce

  1. Set up an MCP server using the *GitHubProvider* integration.
  2. Connect a benign MCP client to this MCP server.
  3. Configure your default browser to route all traffic through an interception proxy such as Burp Suite.
  4. In a private browsing window or a second browser, log into the GitHub account used in step 2.
  5. As the attacker, connect a new (malicious) MCP client to the MCP server from step 1.
  6. When the browser opens for the attacker’s client, enable interception in your proxy.
  7. In the browser, confirm the consent prompt.
  8. In the proxy, forward all requests up to the authorization request to the GitHub authorization server.
  9. Copy the authorization URL and drop the intercepted request.
  10. Simulate luring the victim onto the URL by opening this URL in the browser window opened in step 4.
  11. Observe that the malicious client receives a valid authorization code and gains access to the benign MCP server using the victim’s GitHub account.

In a more realistic scenario, the malicious client could be a public MCP client or a simple web server that logs the received authorization code or token, which the attacker then uses to obtain the access token and connect to the MCP server as the victim.

Recommendation

To mitigate this issue, the OAuthProxy should verify that the browser sending the authorization code has actually given consent for the corresponding client. This can be achieved by setting and validating a consent cookie or similar browser-bound state, as described in the mitigations section for this vulnerability in the MCP specification.

Credited to an7y.

Questions

Does CVE-2026-27124 require the victim to click a link?

Yes. The victim must open the captured authorization URL while logged into the IdP. They must also have used the benign MCP server before, so consent is skipped. The attacker needs no account on the victim's side.

Is only GitHub affected?

It was verified in practice only for GitHubProvider. The advisory says any OAuth integration whose IdP can skip the consent page is vulnerable through the same handler.

Which version fixes it?

fastmcp 3.2.0. Everything before it is affected.

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