INCIDENT MAP

Browse / MCP and Tool Server Flaws / CVE-2025-62800

FastMCP vulnerable to reflected XSS in client's callback page

CVE-2025-62800 ยท 2025-10-29 moderate

Class
MCP and Tool Server Flaws (filed by a model that read the advisory)
Technique
Cross-site scripting
Affected
fastmcp (PyPI)
CVSS
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
EPSS
0.3% chance of exploitation in 30 days

How it works, in short

The OAuth callback page of the FastMCP client inserts the error query parameter unescaped, so a crafted link runs attacker script in the callback origin. (Our summary, written by a model. The source text is below.)

Details

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

1. 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())

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.

References

Source: GitHub Advisory Database, used under CC BY 4.0.