CVE-2025-53365:
MCP Python SDK has Unhandled Exception in Streamable HTTP Transport ,Leading to Denial of Service
8.7
CVSS ScoreBasic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
mcp | pip | < 1.10.0 | 1.10.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability analysis identified a critical flaw in the MCP Python SDK's server-side session management. The root cause of the Denial of Service is an unhandled anyio.ClosedResourceError
exception within the mcp.shared.session.Session._receive_loop
function. This function is responsible for processing incoming messages over a streamable HTTP connection.
When a client establishes a connection and then disconnects abruptly (e.g., by crashing or closing the connection without proper termination), the underlying anyio
stream raises a ClosedResourceError
. The vulnerable version of the _receive_loop
function did not have an exception handler for this specific error. As a result, the exception would go uncaught, leading to the termination of the server's execution task and effectively crashing the server process.
The provided patch directly addresses this issue by wrapping the message-reading loop (async for message in self._read_stream:
) inside a try...except
block. The newly added except anyio.ClosedResourceError:
block catches the specific exception, logs a debug message, and allows the server to continue running without crashing. This ensures that a misbehaving or crashing client cannot bring down the entire server, thus mitigating the Denial of Service vulnerability.
Vulnerable functions
mcp.shared.session.Session._receive_loop
src/mcp/shared/session.py