Skip to content

♻️ update ws to v7.5.10 [SECURITY] - #567

Open
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/npm-ws-vulnerability
Open

♻️ update ws to v7.5.10 [SECURITY]#567
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/npm-ws-vulnerability

Conversation

@renovate

@renovate renovate Bot commented May 28, 2023

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
ws 7.4.57.5.10 age adoption passing confidence

ReDoS in Sec-Websocket-Protocol header

CVE-2021-32640 / GHSA-6fc8-4gx4-v693

More information

Details

Impact

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

Proof of concept
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);
}
Patches

The vulnerability was fixed in ws@7.4.6 (websockets/ws@00c425e) and backported to ws@6.2.2 (websockets/ws@78c676d) and ws@5.2.3 (websockets/ws@76d47c1).

Workarounds

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.

Credits

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

Severity

  • CVSS Score: 5.3 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


ws affected by a DoS when handling a request with many HTTP headers

CVE-2024-37890 / GHSA-3h5v-q93c-6h6q

More information

Details

Impact

A request with a number of headers exceeding the server.maxHeadersCount threshold could be used to crash a ws server.

Proof of concept
const http = require('http');
const WebSocket = require('ws');

const wss = new WebSocket.Server({ port: 0 }, function () {
  const chars = "!#$%&'*+-.0123456789abcdefghijklmnopqrstuvwxyz^_`|~".split('');
  const headers = {};
  let count = 0;

  for (let i = 0; i < chars.length; i++) {
    if (count === 2000) break;

    for (let j = 0; j < chars.length; j++) {
      const key = chars[i] + chars[j];
      headers[key] = 'x';

      if (++count === 2000) break;
    }
  }

  headers.Connection = 'Upgrade';
  headers.Upgrade = 'websocket';
  headers['Sec-WebSocket-Key'] = 'dGhlIHNhbXBsZSBub25jZQ==';
  headers['Sec-WebSocket-Version'] = '13';

  const request = http.request({
    headers: headers,
    host: '127.0.0.1',
    port: wss.address().port
  });

  request.end();
});
Patches

The vulnerability was fixed in ws@8.17.1 (websockets/ws@e55e510) and backported to ws@7.5.10 (websockets/ws@22c2876), ws@6.2.3 (websockets/ws@eeb76d3), and ws@5.2.4 (websockets/ws@4abd8f6).

Workarounds

In vulnerable versions of ws, the issue can be mitigated in the following ways:

  1. Reduce the maximum allowed length of the request headers using the --max-http-header-size=size and/or the maxHeaderSize options so that no more headers than the server.maxHeadersCount limit can be sent.
  2. Set server.maxHeadersCount to 0 so that no limit is applied.
Credits

The vulnerability was reported by Ryan LaPointe in https://github.com/websockets/ws/issues/2230.

References

Severity

  • CVSS Score: 8.7 / 10 (High)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

websockets/ws (ws)

v7.5.10

Compare Source

Bug fixes

v7.5.9

Compare Source

Bug fixes

v7.5.8

Compare Source

Bug fixes

v7.5.7

Compare Source

Bug fixes

v7.5.6

Compare Source

Bug fixes

v7.5.5

Compare Source

Bug fixes

v7.5.4

Compare Source

Bug fixes

v7.5.3

Compare Source

Bug fixes

  • The WebSocketServer constructor now throws an error if more than one of the
    noServer, server, and port options are specefied (66e58d2).
  • Fixed a bug where a 'close' event was emitted by a WebSocketServer before
    the internal HTTP/S server was actually closed (5a58730).
  • Fixed a bug that allowed WebSocket connections to be established after
    WebSocketServer.prototype.close() was called (772236a).

v7.5.2

Compare Source

Bug fixes

  • The opening handshake is now aborted if the client receives a
    Sec-WebSocket-Extensions header but no extension was requested or if the
    server indicates an extension not requested by the client (aca94c8).

v7.5.1

Compare Source

Bug fixes

  • Fixed an issue that prevented the connection from being closed properly if an
    error occurred simultaneously on both peers (b434b9f).

v7.5.0

Compare Source

Features

  • Some errors now have a code property describing the specific type of error
    that has occurred (#​1901).

Bug fixes

  • A close frame is now sent to the remote peer if an error (such as a data
    framing error) occurs (8806aa9).
  • The close code is now always 1006 if no close frame is received, even if the
    connection is closed due to an error (8806aa9).

v7.4.6

Compare Source

Bug fixes

  • 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.


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot force-pushed the renovate/npm-ws-vulnerability branch from a0b0bef to 47b6360 Compare June 18, 2024 03:14
@renovate renovate Bot changed the title ♻️ update ws to v7.4.6 [SECURITY] ♻️ update ws to v7.5.10 [SECURITY] Jun 18, 2024
@renovate renovate Bot changed the title ♻️ update ws to v7.5.10 [SECURITY] ♻️ update ws to v7.4.6 [SECURITY] Aug 6, 2024
@renovate renovate Bot changed the title ♻️ update ws to v7.4.6 [SECURITY] ♻️ update ws to v7.4.6 [SECURITY] - autoclosed Dec 8, 2024
@renovate renovate Bot closed this Dec 8, 2024
@renovate
renovate Bot deleted the renovate/npm-ws-vulnerability branch December 8, 2024 18:36
@renovate renovate Bot changed the title ♻️ update ws to v7.4.6 [SECURITY] - autoclosed ♻️ update ws to v7.4.6 [SECURITY] Dec 8, 2024
@renovate renovate Bot reopened this Dec 8, 2024
@renovate renovate Bot changed the title ♻️ update ws to v7.4.6 [SECURITY] ♻️ update ws to v7.5.10 [SECURITY] Aug 13, 2025
@renovate renovate Bot changed the title ♻️ update ws to v7.5.10 [SECURITY] ♻️ update ws to v7.4.6 [SECURITY] Oct 15, 2025
@renovate renovate Bot changed the title ♻️ update ws to v7.4.6 [SECURITY] ♻️ update ws to v7.4.6 [SECURITY] - autoclosed Mar 27, 2026
@renovate renovate Bot closed this Mar 27, 2026
@renovate renovate Bot changed the title ♻️ update ws to v7.4.6 [SECURITY] - autoclosed ♻️ update ws to v7.4.6 [SECURITY] Mar 30, 2026
@renovate renovate Bot reopened this Mar 30, 2026
@renovate
renovate Bot force-pushed the renovate/npm-ws-vulnerability branch 2 times, most recently from 47b6360 to 0459d87 Compare March 30, 2026 21:52
@renovate renovate Bot changed the title ♻️ update ws to v7.4.6 [SECURITY] ♻️ update ws to v7.4.6 [SECURITY] - autoclosed Apr 27, 2026
@renovate renovate Bot closed this Apr 27, 2026
@renovate renovate Bot changed the title ♻️ update ws to v7.4.6 [SECURITY] - autoclosed ♻️ update ws to v7.4.6 [SECURITY] Apr 27, 2026
@renovate renovate Bot reopened this Apr 27, 2026
@renovate
renovate Bot force-pushed the renovate/npm-ws-vulnerability branch 2 times, most recently from 0459d87 to b2ca6a4 Compare April 27, 2026 21:44
@renovate
renovate Bot force-pushed the renovate/npm-ws-vulnerability branch from b2ca6a4 to 7e3ef0a Compare May 28, 2026 19:45
@renovate
renovate Bot force-pushed the renovate/npm-ws-vulnerability branch from 7e3ef0a to 44813e8 Compare July 16, 2026 19:35
@renovate
renovate Bot force-pushed the renovate/npm-ws-vulnerability branch from 44813e8 to 01b3424 Compare July 20, 2026 21:57
@renovate renovate Bot changed the title ♻️ update ws to v7.4.6 [SECURITY] ♻️ update ws to v7.5.10 [SECURITY] Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants