Executive brief
The Model Context Protocol (MCP) Ruby SDK is used to build applications that communicate with AI models and tools. A vulnerability in how it handles data input allows a connected process to send an endless stream of data without a line break, causing the application to consume all available system memory. This can lead to a denial-of-service (DoS) where the application or the entire host system crashes due to memory exhaustion.
Technical details
The vulnerability exists in `MCP::Server::Transports::StdioTransport` and `MCP::Client::Stdio` due to the use of Ruby's `IO#gets` without a `limit` argument. Because `gets` continues to accumulate bytes into a single Ruby String until a newline character is encountered, a malicious or misconfigured peer can stream data indefinitely to exhaust process memory. This is particularly critical in sandboxed environments where a restricted child process could crash an unrestricted host process by piping unbounded data to its stdout. The issue was resolved in version 0.23.0 by introducing a configurable maximum line length (defaulting to 4 MiB) and treating over-limit lines as transport errors.
Affected products
- modelcontextprotocol mcp <= 0.22.0
Timeline
- 2026-07-08: patched: Fixed in version 0.23.0
- 2026-07-29: advisory: NVD publication date
- 2026-07-30: disclosed: GitHub Advisory published