CVE-2025-58444: MCP Inspector is Vulnerable to Potential Command Execution via XSS When Connecting to an Untrusted MCP Server
N/A
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| @modelcontextprotocol/inspector | npm | < 0.16.6 | 0.16.6 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability is a Cross-Site Scripting (XSS) issue in the MCP Inspector's OAuth flow, which can be escalated to arbitrary command execution. The root cause is the failure to properly validate the authorizationUrl received from a potentially malicious remote MCP server before using it in client-side redirects or links.
The analysis of the patch commit 650f3090d26344a672026b737d81586595bb1f60 reveals several locations where this untrusted URL was handled insecurely:
- In
AuthDebugger.tsx, auseEffecthook triggered an automatic redirect usingwindow.location.hrefwithout any validation. - In
OAuthFlowProgress.tsx, the URL was used directly in an<a>tag'shrefattribute and in awindow.opencall, both of which are vulnerable tojavascript:URIs if a user clicks them. - In
auth.ts, theInspectorOAuthClientProvider.redirectToAuthorizationmethod had a weak protocol check before redirecting, which was insufficient.
A malicious server could provide an authorizationUrl with a javascript: scheme. When the MCP Inspector client processed this URL, it would execute the embedded script in the user's browser. According to the advisory, this XSS could then be used to interact with the inspector's proxy, leading to arbitrary command execution on the user's machine.
The fix involves introducing a new centralized utility function, validateRedirectUrl, which strictly ensures that any URL used for redirection has either an http: or https: protocol. This function is now called in all the previously vulnerable locations before the URL is used, effectively mitigating the XSS threat.