Packages

ws

8.23.0 · 12 Nov 2026MIT428.4M / weekRepositorynpmAtom feed

Your version

7.4.6

25 May 2021Where it was published

7.5.14 is the newest release of 7.x.

In short

2 security

Security

Fixes 1 advisory that affected 7.4.5

2 advisories affect 7.4.6; 7.5.11 fixes them

Release note

Bug fixes

  • Security

    Fixed a ReDoS vulnerability (00c425e).

A specially crafted value of the Sec-Websocket-Protocol header could be used
to significantly slow down a ws server.

for (const length of [1000, 2000, 4000, 8000, 16000, 32000]) {
  const value = 'b' + ' '.repeat(length) + 'x';
  const start = process.hrtime.bigint();

  value.trim().split(/ *, */);

  const end = process.hrtime.bigint();

  console.log('length = %d, time = %f ns', length, end - start);
}

The vulnerability was responsibly disclosed along with a fix in private by
Robert McLaughlin from University of California, Santa Barbara.

In vulnerable versions of ws, the issue can be mitigated by reducing the maximum
allowed length of the request headers using the --max-http-header-size=size
and/or the maxHeaderSize options.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.