Dev.to Security 🔐 Cybersecurity 👁 2 📖 2 min read

CVE-2026-140015: CVE-2026-140015: Unbounded Memory Exhaustion in Ruby websocket-driver HyBi Protocol Handler

CVE-2026-140015: Unbounded Memory Exhaustion in Ruby websocket-driver HyBi Protocol Handler Vulnerability ID: CVE-2026-140015 CVSS Score: 7.5 Published: 2026-12-01 CVE-2026-140015 is a high-severity Denial of Servic

CVE-2026-140015: Unbounded Memory Exhaustion in Ruby websocket-driver HyBi Protocol Handler

Vulnerability ID: CVE-2026-140015
CVSS Score: 7.5
Published: 2026-12-01

CVE-2026-140015 is a high-severity Denial of Service (DoS) vulnerability affecting the Ruby gem websocket-driver in versions prior to 0.9.1. The flaw resides in the HyBi protocol parser (lib/websocket/driver/hybi.rb), which fails to stop buffering incoming TCP stream data after receiving a WebSocket close control frame. Because TCP supports half-open connections, an unauthenticated remote attacker can transmit a close frame to transition the state machine into a non-consuming shutdown stage, and subsequently stream arbitrary data over the open socket to exhaust server heap memory and crash the host Ruby process.

TL;DR

An unauthenticated remote attacker can trigger an Out-of-Memory (OOM) crash in Ruby servers using websocket-driver (< 0.9.1) by sending a WebSocket close frame followed by a continuous stream of raw TCP data over a half-open connection.

Technical Details

  • Vulnerability Type: CWE-770: Allocation of Resources Without Limits or Throttling
  • Affected Component: WebSocket::Driver::Hybi (lib/websocket/driver/hybi.rb)
  • Attack Vector: Network (Unauthenticated WebSocket Close Frame + Half-Open TCP Flood)
  • CVSS v3.1 Score: 7.5 High (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H)
  • EPSS Score: 0.82% (58.33rd Percentile)
  • Security Impact: Remote Denial of Service via Heap Memory Exhaustion (OOM Crash)
  • Patched Version: websocket-driver 0.9.1
  • CISA KEV Status: Not Listed

Affected Systems

  • websocket-driver Ruby gem (< 0.9.1)
  • faye/websocket-driver-ruby
  • websocket-driver: < 0.9.1 (Fixed in: 0.9.1)

Code Analysis

Commit: a8085fe

Stop buffering data after a socket has failed or been closed

diff --git a/lib/websocket/driver/hybi.rb b/lib/websocket/driver/hybi.rb
index 58b401d..99223c3 100644
--- a/lib/websocket/driver/hybi.rb
+++ b/lib/websocket/driver/hybi.rb
@@ -89,8 +89,11 @@ def add_extension(extension)
       end

       def parse(chunk)
+        return unless @reader
+
         @reader.put(chunk)
         buffer = true
+
         while buffer
           case @stage
             when 0 then
@@ -258,7 +261,7 @@ def handshake_response
       end

       def shutdown(code, reason, error = false)
-        @frame = @message = nil
+        @reader = @frame = @message = nil
         @stage = 5
         @extensions.close

Mitigation Strategies

  • Upgrade the websocket-driver Ruby gem to version 0.9.1 or later to ensure the internal @reader buffer is de-referenced upon connection shutdown.
  • Ensure host I/O loops and custom socket handlers immediately cease passing socket bytes to driver.parse(chunk) and close the read half of the TCP socket as soon as the driver emits a :close or :error event.
  • Enforce strict connection teardown timeouts and ingress bandwidth rate limits at the reverse proxy or edge load balancer level (e.g., Nginx, Envoy, HAProxy).

Remediation Steps:

  1. Audit all Ruby projects and container images for vulnerable versions of websocket-driver (< 0.9.1) by inspecting Gemfile.lock files or running bundle audit check --update.
  2. Update the dependency by running bundle update --conservative websocket-driver and verify that Gemfile.lock resolves to version 0.9.1 or higher.
  3. Rebuild and redeploy affected application containers and restart all persistent Ruby worker processes (such as Puma, ActionCable, Sidekiq, Thin, or EventMachine services).

References

Read the full report for CVE-2026-140015 on our website for more details including interactive diagrams and full exploit analysis.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.