CVE-2026-63119 — MCP Ruby SDK: Unbounded line buffer in mcp
MCP Ruby SDK: Unbounded line buffer in stdio transports leads to memory exhaustion (DoS)
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.18%). Schedule for your next planned update.
Does your project use an affected mcp version?
Paste your Gemfile.lock to check it for CVE-2026-63119 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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.
This is the same vulnerability class tracked in sibling MCP SDKs as GHSA-74gp-qhv5-v493 (Kotlin), GHSA-wqgc-pwpr-pq7r (TypeScript), GHSA-655q-2283-6jgj (Python), and others. It was identified during a cross-SDK audit; ruby-sdk had no prior report.
Affected code
Verified at main @ cf44475c.
Server transport — lib/mcp/server/transports/stdio_transport.rb
# line 23
while @open && (line = $stdin.gets) # <-- no limit argument
response = @session.handle_json(line.strip)
...
# line 76
while @open && (line = $stdin.gets) # <-- no limit argument
begin
parsed = JSON.parse(line.strip, symbolize_names: true)
$stdin is the raw process global (only set_encoding is applied at line 16); there is no wrapper imposing a length limit.
Client transport — lib/mcp/client/stdio.rb
# line 150
@stdin, @stdout, @stderr, @wait_thread = Open3.popen3(spawn_env, @command, *@args)
# line 228
line = @stdout.gets # <-- no limit argument
raise_connection_error!(method, params) if line.nil?
parsed = JSON.parse(line.strip)
@stdout is the raw IO returned by Open3.popen3. The @read_timeout guard at line 227 (wait_for_readable!) only gates the IO.select before gets is invoked; once bytes are flowing, gets blocks indefinitely accumulating into one string.
Impact
Denial of service via memory exhaustion. A peer that controls the byte stream delivered to the stdio transport can grow a single Ruby String until the process exhausts available memory.
Threat-model caveat (important): In the default stdio deployment, the peer process already holds local execution privileges equal to or greater than the victim:
- On the server side (
StdioTransport#open), the writer to$stdinis the parent process that spawned the server, which already holdsProcess.kill, environment control, and filesystem access over the child. This direction is a robustness defect rather than a security boundary in typical deployments. - On the client side (
Client::Stdio#read_response), the writer is the third-party MCP server binary the host application chose to spawn viaOpen3.popen3. In an unsandboxed deployment that binary already has local code execution as the host user.
This issue is primarily a security concern for:
- (a) host applications that sandbox the spawned MCP server (container, restricted user, seccomp) while piping its stdout to an unsandboxed host process — an unbounded
getslets a memory-capped sandboxed process exhaust the unconstrained host; - (b) HTTP-to-stdio bridge deployments that forward bytes from a remote peer to a stdio server's stdin (note: surveyed bridges re-frame JSON-RPC and emit their own newlines, mitigating this in practice);
- (c) robustness against non-malicious servers that emit large unterminated output (misconfigured logging to stdout, runaway loops), which can crash the host process and all other MCP sessions it manages.
The bug fires before the JSON-RPC initialize handshake, since gets cannot return until \n arrives.
Reproduction
# poc_ruby_stdio_oom.rb — drives the real client transport against a producer that never emits \n
require "mcp/client/stdio"
# `yes` writes "y\n" — instead use a producer that never sends \n:
producer = %q{ruby -e 'STDOUT.sync=true; loop { print "A" * 65536 }'}
client = MCP::Client::Stdio.new(command: "bash", args: ["-c", producer])
client.start
# any request triggers read_response → @stdout.gets → unbounded String growth
client.send_request(method: "initialize", params: {})
Observed: process RSS grows linearly with bytes produced; gets never returns; process is OOM-killed.
Suggested fix
IO#gets accepts a second limit argument. Apply a configurable maximum line length (default suggested: 4 MiB — large enough for any realistic JSON-RPC frame including base64-embedded images) at all three call sites, and treat an over-limit line as a transport error that closes the connection:
MAX_LINE_BYTES = 4 * 1024 * 1024
while @open && (line = $stdin.gets("\n", MAX_LINE_BYTES))
unless line.end_with?("\n")
# gets returned because the limit was hit, not because a newline arrived
raise MCP::TransportError, "stdio frame exceeds #{MAX_LINE_BYTES} bytes without newline"
end
...
end
Apply the same pattern at stdio_transport.rb:76 and client/stdio.rb:228. Expose MAX_LINE_BYTES as a constructor option on both transports for callers with legitimate large-frame needs.
Credit
Identified during a cross-SDK audit of the stdio unbounded-buffer vulnerability class, prompted by GHSA-74gp-qhv5-v493 (reporter: tonghuaroot).
Advisory Timeline
- First published July 30, 2026 (119 days ago).
- Last revised July 30, 2026 — 0 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
gem install mcp -v 0.23.0
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: RubyGems (1).
| Package | Fixed In |
|---|---|
| mcp RubyGems · Affected: 0.1.0, 0.10.0, 0.11.0, 0.12.0 (+21 more) | 0.23.0 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.2 score means for each attack dimension.
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
References
- https://github.com/modelcontextprotocol/ruby-sdk/security/advisories/GHSA-7683-3w9x-ch42WEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-63119ADVISORY
- https://github.com/modelcontextprotocol/ruby-sdk/commit/267b8fa6285453525c81ce43db6b7dcd7a8a8c2fWEB
- https://github.com/modelcontextprotocol/ruby-sdkPACKAGE
- https://github.com/modelcontextprotocol/ruby-sdk/releases/tag/v0.23.0WEB
Frequently Asked Questions
- What is CVE-2026-63119?
- MCP Ruby SDK: Unbounded line buffer in stdio transports leads to memory exhaustion (DoS). This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.2/10).
- How do I check if my project is affected by CVE-2026-63119?
- CVE-2026-63119 affects mcp. It has a 0.2% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-63119 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 4.6% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2026-67431HIGH
MCP Ruby SDK: Ruby SSE Session Poisoning
- CVE-2026-67432HIGH
MCP Ruby SDK: Unbounded JSON-RPC request body causes uncontrolled memory allocation in StreamableHTTPTransport
- CVE-2026-33946HIGH
MCP Ruby SDK: Insufficient Session Binding Allows SSE Stream Hijacking via Session ID Replay
- CVE-2026-128084MEDIUM
sqlite3-ruby: Possible SQL query truncation when a string is 4 GiB or larger
- CVE-2026-67430MEDIUM
MCP Ruby SDK: Unbounded session retention in StreamableHTTPTransport allows memory exhaustion via initialize flood
- CVE-2026-115472MEDIUM
Doorkeeper: When using public clients, any client can revoke any access token
- CVE-2026-63118MEDIUM
MCP Ruby SDK: Streamable HTTP transport lacks DNS-rebinding (Host/Origin) protection