CVE-2025-62800: FastMCP vulnerable to reflected XSS in client's callback page
The fastmcp Python package before 2.13.0 builds its OAuth client callback page without escaping user-controlled values. A crafted callback URL, or a malicious authorization server, can run JavaScript in the origin of the local callback server. Upgrade fastmcp to 2.13.0.
Published Oct 29, 2025 · Analysis Nov 24, 2026
What an attacker can do
The code in src/fastmcp/client/oauth_callback.py passes every value given to create_callback_html through its message parameter straight into the page. The error query parameter is one example, and other parameters that reach the function are affected as well. A payload placed in the error value, such as an image tag with an onerror handler, runs as script.
The callback server runs on the machine of the person using the FastMCP client, on a port such as 1337 in the report. The attacker needs the victim to open a link to that local port, or a malicious authorization server can return the crafted URL in its authorization_endpoint field. The client then opens it itself and the script runs at once.
The script runs in the callback server's origin. It can read the page and talk to that local server, but it does not run in the MCP server's origin. GitHub rates it Moderate, 5.3 on CVSS 4.0 with passive user interaction. The advisory shows no exploitation beyond the proof of concept.
Who is affected
fastmcp, all versions before 2.13.0. Only code that uses the OAuth client helper, which starts a local callback server during login to an OAuth-protected MCP server, is exposed. Check:
pip show fastmcpCheck lockfiles and containers that ship the client as well.
fastmcp
- Ecosystem
- PyPI
- Affected
- < 2.13.0
- Fixed in
- 2.13.0
- Check
pip show fastmcp
How to fix it
Upgrade to fastmcp 2.13.0:
pip install --upgrade fastmcp==2.13.0The fix is pull request 2090, commit 2a20f546. The advisory lists no workaround. Until you upgrade, connect only to MCP servers you trust and do not open callback links from other sources.
How to tell if you were hit
Look at local logs of the FastMCP client for requests to the callback path with an error parameter that holds markup or script text, such as an onerror or script string. Check browser history for visits to the localhost callback port that you did not start. Review the authorization endpoints of the MCP servers your clients use for values that point at the callback port.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
While setting up an oauth client, it was noticed that the callback page hosted by the client during the flow embeds user-controlled content without escaping or sanitizing it. This leads to a reflected Cross-Site-Scripting vulnerability.
Details
The affected code is located in *https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py*, which embeds all values passed to the create_callback_html function via the message parameter it into the callback page without escaping them. This can, for example, be abused by calling the callback server with an XSS payload inside the error GET parameter, the value of which will then be inserted into the callback page, causing the execution of attacker-controlled JavaScript code in the callback server's origin. Note that besides the error parameter, other parameters reaching this function are affected too.
PoC
- Setup a simple fastmcp client such as this one (the callback server's port was fixated for simplicity):
url="http://127.0.0.1:8000/mcp"
oauth = OAuth(mcp_url=url,callback_port=1337)
async def main():
async with Client(url, auth=oauth) as client:
await client.ping()
# List available operations
tools = await client.list_tools()
print(f"tools: {tools}")
asyncio.run(main())- Ensure that the MCP server located at
http://127.0.0.1:8000/mcpsupports oauth. - Start the client.
- As soon as the callback server has been started, access
http://localhost:1337/callback?error=
Note that the exploitation could also for example be initiated by a malicious authorization server by returning the exploitation URL mentioned before in the authorization_endpoint field. The client would then automatically open, causing the XSS to trigger immediatly.
Impact
The impact of this XSS vulnerability is the arbitrary JavaScript execution in the victim's browser in the callback server's origin.
Credited to an7y.
Questions
- Which fastmcp version fixes the callback XSS?
fastmcp 2.13.0. All earlier versions are affected, according to the GitHub advisory.
- Does it affect FastMCP servers?
The flaw is in the client's OAuth callback page. A server that does not use the FastMCP client OAuth helper does not run this code. A client that connects to an OAuth-protected MCP server does.
- Does it need user interaction?
Mostly. The CVSS vector lists passive interaction. The victim opens a crafted link, or the client opens it when a malicious authorization server returns it in authorization_endpoint.
References
Read for this analysis:
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 entriesGHSA-7xgj-8392-5q4r
FastMCP: Post-transform component authorization is skipped on direct calls
medium6.8Oct 23, 2026GHSA-vqqp-x5qm-5qp4
FastMCP MCP client wrappers construct M2M OAuth providers without issuer binding — client secret redirectable to attacker-advertised authorization server
medium5.9Oct 23, 2026CVE-2025-64340
FastMCP has a Command Injection vulnerability - Gemini CLI
medium6.7Mar 31, 2026CVE-2026-27124
FastMCP: Missing Consent Verification in OAuth Proxy Callback Facilitates Confused Deputy Vulnerabilities
high8.2Mar 31, 2026CVE-2026-32871
FastMCP OpenAPI Provider has an SSRF & Path Traversal Vulnerability
critical10.0Mar 31, 2026CVE-2025-69196
FastMCP OAuth Proxy token reuse across MCP servers
high7.4Mar 16, 2026
