CVE-2026-59950: CWE-346: Origin Validation Error in modelcontextprotocol python-sdk
Description
### Summary In affected versions, the deprecated WebSocket server transport (`mcp.server.websocket.websocket_server`) accepted the WebSocket handshake without applying any `Host` or `Origin` header validation. The `TransportSecuritySettings` mechanism that the SSE and Streamable HTTP transports use for this purpose was not wired into the WebSocket transport, so there was no SDK-level way to restrict which origins could connect. ### Am I affected? Only if a developer's application server exposes `mcp.server.websocket.websocket_server`. This transport has never been part of the MCP specification, is marked deprecated, and is not reachable through `FastMCP` — a developer must have wired it into an ASGI application themselves. Servers using stdio, SSE, or Streamable HTTP are not affected by this advisory. ### Details `websocket_server()` constructed a Starlette `WebSocket` and called `accept(subprotocol="mcp")` immediately, with no inspection of the connection's headers. By contrast, `SseServerTransport` and `StreamableHTTPServerTransport` accept an optional `security_settings: TransportSecuritySettings` and run `TransportSecurityMiddleware.validate_request()` against the incoming `Host` and `Origin` headers before establishing a session. Because browsers attach an `Origin` header to cross-origin WebSocket upgrade requests but do not enforce a same-origin policy on the response, a web page served from any origin could open a WebSocket to a reachable MCP server on this transport, complete the `initialize` handshake, and issue JSON-RPC requests on the resulting session. ### Impact A user who runs an MCP server on this transport bound to localhost or a LAN address, without a separate authentication or origin gate in front of it, and visits a malicious web page, can have that page enumerate and invoke the server's tools and read its resources. The consequences depend entirely on what the server exposes. The transport itself requires no token or prior session. Some browsers prompt before allowing a public page to open a connection to a local-network address, which adds a user-interaction step but is not a substitute for server-side validation. ### Mitigation Upgrade to version 1.28.1 or later, in which `websocket_server()` accepts the same optional `security_settings: TransportSecuritySettings` argument as the other HTTP-based transports and validates the `Host` and `Origin` headers before accepting the handshake; a request that fails validation is rejected with HTTP 403 and `ValueError("Request validation failed")` is raised to the caller. As with the other transports the parameter defaults to `None`, which leaves validation disabled, so upgrading alone does not change behaviour: pass a `TransportSecuritySettings` with `enable_dns_rebinding_protection=True` and appropriate `allowed_hosts` / `allowed_origins` to receive the protection. The recommended path remains to migrate off this deprecated transport to Streamable HTTP, where `FastMCP` enables this protection automatically for localhost binds. The WebSocket transport has been removed entirely in v2.
CVSS v4.0
Score 7.6high
Affected software
modelcontextprotocol
python-sdk
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2026-59950 describes a vulnerability in the MCP Python SDK's deprecated mcp.server.websocket.websocket_server transport, where WebSocket handshake requests did not validate the Host or Origin headers. This lack of origin validation means that applications exposing this transport could not restrict which origins were allowed to connect, potentially allowing unauthorized cross-origin WebSocket connections. The vulnerability is resolved in version 1.28.1 of the SDK.
Potential Impact
The vulnerability allows WebSocket connections from any origin due to missing Host and Origin header validation. This can lead to unauthorized cross-origin access to applications using the affected transport, potentially exposing sensitive data or functionality. The CVSS 4.0 score is 7.6 (high severity), indicating significant impact with network attack vector, low attack complexity, and partial user interaction required.
Mitigation Recommendations
Upgrade to version 1.28.1 or later of the MCP Python SDK, where the origin validation issue has been fixed. Since this is a client-side SDK and not a cloud service, users must apply the update themselves to remediate the vulnerability. Patch status is confirmed fixed in 1.28.1.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-07-07T18:49:15.607Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 6a57f21668715ace4371edee
Added to database: 07/15/2026, 20:48:22 UTC
Last enriched: 07/22/2026, 22:55:03 UTC
Last updated: 10/12/2026, 06:48:17 UTC
Views: 265
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.