Skip to content

AAK-MCP-SDK-CVE-2026-59951-001: MCP Python SDK 1.8.0 to 1.29.x and 2.0.x/2.1.x: unbounded sessions, credentials sent across redirects, audience-blind bearer auth and fetched schema $refs

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

What it detects

The MCP Python SDK (mcp on PyPI) carries four flaws that 1.30.0 and, on the 2.x line, 2.2.0 fix. A stateful Streamable HTTP session (FastMCP, Server.streamable_http_app(), StreamableHTTPSessionManager) is kept with no idle expiry and no limit on how many are open, so a client that can reach the endpoint grows the server's memory with short ordinary requests until it restarts (CVE-2026-59951, CVSS 4.0 6.9, CWE-770; from 1.8.0, where the session manager arrives). The HTTP client transports follow a redirect to another origin and send it the caller's custom credential headers and, for a 307 or 308, the request body (CVE-2026-116685, CVSS 5.9, CWE-200; from 1.8.0). Server-side bearer authentication configured through AuthSettings with a token_verifier accepts a valid token issued for another resource when the verifier does not check its audience (CVE-2026-116684, CVSS 6.8, CWE-863; from 1.10.0). And a client that validates a tool result against the server's outputSchema fetches an unresolved $ref from its HTTP, HTTPS or file URL, synchronously and with no timeout, so a server can make the client send blind requests, read local files or stall every session (CVE-2026-116686, CVSS 6.5, CWE-918; from 1.10.0). Checked in the source for CVE-2026-59951: 1.29.1 still has only an optional idle timeout, off by default, and 1.30.0 and 2.2.0 add a 30-minute default and a 10,000-session cap.

How to fix

Upgrade mcp to 1.30.0 or later, or to 2.2.0 or later on the 2.x line, and pin it. Until then, pass session_idle_timeout to the session manager or run the server stateless, give a server's TokenVerifier an audience check, and keep custom credential headers off client transports whose endpoint can redirect.

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

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

Limitations

Reads mcp from 1.8.0 below 1.30.0, and from 2.0.0 below 2.2.0, where a version is stated, in the same files as the HIGH mcp pin: requirements*.txt at any depth and, at the project root only, pyproject.toml, Pipfile, .mcp.json, mcp.json, claude_desktop_config.json and the Pipfile.lock, poetry.lock and uv.lock lockfiles. A bare mcp is not reported. One finding stands for all four CVEs, so 1.8.0 to 1.9.x, which carry only CVE-2026-59951 and CVE-2026-116685, are reported with the rest. It reads versions, not code, so a project that uses none of the affected parts (stateful Streamable HTTP, bearer authentication with a token_verifier, the HTTP client transports, output-schema validation), or that already sets session_idle_timeout, is reported too. 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-59951-001.md: the page then shows that text, with the registry reference appended under it.