Skip to content

AAK-MCP-SDK-CVE-2026-52869-001: MCP Python SDK session/task cross-client access and unbounded request bodies (mcp below 1.29.1, and 2.0.x)

Severity
HIGH
Category
Supply Chain (supply-chain)
Scanner
agent_audit_kit/scanners/mcp_cve_pins_2026_07.py
Auto-fixable
No.
SARIF name
McpPythonSdkSessionIsolation

What it detects

The official MCP Python SDK (mcp on PyPI) before 1.28.1 has three session-isolation flaws reachable over its HTTP transports: the SSE and stateful Streamable HTTP transports route requests by session_id / Mcp-Session-Id without verifying the authenticated principal that created the session, so another bearer-authenticated client with a known session ID can inject JSON-RPC messages (CVE-2026-52869); the experimental.enable_tasks() default handlers key tasks only by id, letting any client enumerate / read / cancel other clients' tasks (CVE-2026-52870, from 1.23.0); and the deprecated websocket_server transport accepts handshakes with no Host/Origin validation (CVE-2026-59950). Before 1.29.1, and on the 2.0 line from 2.0.0a1 to 2.0.1, the SSE message endpoint, the Streamable HTTP session manager and the OAuth authorization-server routes also buffer a whole request body with no size limit, so an unauthenticated client can send a large or streamed body and exhaust the server's memory (CVE-2026-109527, CVSS 3.1 7.5, CWE-770). Checked in the source: 0.9.1 and 1.0.0 already read the SSE body whole (request.json()), and 1.29.1 and 2.1.0 add the limit; 2.0.1, released after 2.1.0, does not have it. Stdio-only servers are not exposed to that one.

How to fix

Upgrade mcp to 1.29.1 or later, or to 2.1.0 or later on the 2.x line, and pin it. Bind every session to the principal that created it and validate Host/Origin on WebSocket handshakes. Until you upgrade, cap the request body size at a reverse proxy in front of any HTTP transport.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-MCP-SDK-CVE-2026-52869-001

Limitations

Reads mcp below 1.29.1, and from 2.0.0 below 2.1.0, in requirements*.txt at any depth and, at the project root only, in pyproject.toml, Pipfile, .mcp.json, mcp.json, claude_desktop_config.json and the Pipfile.lock, poetry.lock and uv.lock lockfiles, taking the lowest version a range allows. npm's unrelated mcp package, in package.json or an npm lockfile, is not read as the SDK. A reference must state a version to be reported, so a bare mcp is not. It reads versions, not code, so a stdio-only server, or one behind a body-size limit, is reported too. The dependency is not read when it is declared in a sub-directory manifest (services/api/pyproject.toml) or in a lockfile format the reader does not parse (pdm.lock). A file over 2 MB, or a lockfile over 32 MiB, is not read. A declaration nested more than 64 levels deep in package.json, a TOML manifest or an MCP config (an MCP server more than 62) is still judged, and reported without a line; a lockfile entry keeps its line at any depth.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCP-SDK-CVE-2026-52869-001.md: the page then shows that text, with the registry reference appended under it.