Unbounded line buffer in stdio transports leads to memory exhaustion (DoS)
Published: July 07, 2026
SECURITY IDENTIFIERS
- GHSA: GHSA-7683-3w9x-ch42
- Vendor Advisory: https://github.com/modelcontextprotocol/ruby-sdk/security/advisories/GHSA-7683-3w9x-ch42
GEM
SEVERITY
CVSS v3.x: 6.2 (Medium)
PATCHED VERSIONS
>= 0.23.0
DESCRIPTION
Summary
The stdio transports in MCP::Server::Transports::StdioTransport and MCP::Client::Stdio read newline-delimited JSON-RPC frames using IO#gets with no limit argument. CRuby's IO#gets with no limit reads from the current position until the next separator (\n) with no upper bound on the returned string length. A peer that streams bytes without ever emitting a newline causes gets to accumulate the entire stream in a single Ruby String until the process is killed by the operating-system OOM killer.
