RubySec

Providing security resources for the Ruby community

GHSA-7683-3w9x-ch42 (mcp): Unbounded line buffer in stdio transports leads to memory exhaustion (DoS)

Unbounded line buffer in stdio transports leads to memory exhaustion (DoS)

Published: July 07, 2026

SECURITY IDENTIFIERS

GEM

mcp

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.

RELATED