AAK-MCP-STDIO-UNBOUNDED-BUFFER-001: MCP Kotlin SDK stdio read buffer grows without bound (CVE-2026-53937, 0.7.0–0.12.0)
- Severity
- MEDIUM
- Category
- Supply Chain (
supply-chain) - Scanner
agent_audit_kit/scanners/jvm_mcp_sdk_pins.py- Auto-fixable
- No.
- SARIF name
McpKotlinSdkStdioUnboundedReadBuffer
What it detects
The MCP Kotlin SDK (io.modelcontextprotocol:kotlin-sdk, and the kotlin-sdk-core / kotlin-sdk-jvm artifacts that publish the same code) from 0.7.0 through 0.12.0 appends every chunk received from the stdio transport into a kotlinx.io.Buffer with no size cap. ReadBuffer.append (kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/ReadBuffer.kt) only extracts a frame once a \n (0x0a) byte is observed, so a peer that streams bytes and never sends a newline grows the buffer indefinitely until the JVM — or the host process around it — is OOM-killed. StdioServerTransport and StdioClientTransport amplify it: both queue raw chunks through a Channel<ByteArray>(Channel.UNLIMITED) and then call readBuffer.append(chunk) with neither backpressure nor a size guard. CVE-2026-53937, CVSS 6.2 MEDIUM (AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H), CWE-400 + CWE-770. The impact is availability only, and the attack vector is local because it arrives on stdin — but it is pre-authentication, and the reach is remote wherever an untrusted producer feeds that stdin: a host that exec's the server as a subprocess and pipes bytes from a network peer, or a sidecar proxying an HTTP endpoint onto the stdio transport. Fixed in 0.13.0. The affected range starts at 0.7.0 because that is the first release of kotlin-sdk-core, where the buffer lives — a module boundary, not the commit that introduced the defect.
How to fix
Upgrade io.modelcontextprotocol:kotlin-sdk (or kotlin-sdk-core / kotlin-sdk-jvm) to >= 0.13.0 and pin it. Until then, do not let an untrusted producer write directly to an SDK stdio server's stdin: put a framing proxy in front that enforces a maximum bytes-without-newline budget and drops the peer when it is exceeded, and bound the queue between the reader and the parser rather than using Channel.UNLIMITED.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-STDIO-UNBOUNDED-BUFFER-001
Limitations
Dependency-level detection on JVM manifests only — build.gradle, build.gradle.kts, gradle/libs.versions.toml and pom.xml. A finding requires a version that actually resolved into 0.7.0–0.12.0, so a dynamic version (0.+, latest.release) or a version.ref pointing at a catalog outside the scanned tree is deliberately not reported. It does not detect the unbounded-buffer shape in first-party code.
References
- CVE: CVE-2026-53937
- OWASP MCP Top 10: MCP04:2025 (Software Supply Chain Attacks & Dependency Tampering)
- OWASP Agentic Top 10: ASI04 (Agentic Supply Chain Vulnerabilities)
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-RES-01
- Incidents and advisories: NVD-CVE-2026-53937
- CSA AI Controls Matrix (AICM): STA-08, IVS-04, BCR-01
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-STDIO-UNBOUNDED-BUFFER-001.md: the page then shows that text, with the registry reference appended under it.