Skip to content

Releases

8.23.0

Choose a tag to compare

@lpinca lpinca released this 12 Nov 21:33

Features

  • Introduced the maxPendingAutoPongs option (ace7248).

Bug fixes

  • Fixed a remote memory exhaustion DoS vulnerability (ace7248).

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.

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()}`);
  });
});

The vulnerability was responsibly disclosed by multiple reporters:

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.

7.5.14

Choose a tag to compare

@lpinca lpinca released this 12 Nov 21:30

Bug fixes

6.2.7

Choose a tag to compare

@lpinca lpinca released this 12 Nov 21:29

Bug fixes

5.2.8

Choose a tag to compare

@lpinca lpinca released this 12 Nov 21:28

Bug fixes

8.22.2

Choose a tag to compare

@lpinca lpinca released this 08 Nov 14:51

Bug fixes

  • The userinfo of the URL is now percent-decoded (#2352).
  • The WebSocket constructor no longer mutates http: or https: url.URL
    objects (#2353).

8.22.1

Choose a tag to compare

@lpinca lpinca released this 31 Oct 09:50

Bug fixes

  • The path of IPC URLs is no longer truncated at : (#2344).

Other notable changes

8.22.0

Choose a tag to compare

@lpinca lpinca released this 26 Sep 14:52

Features

  • Introduced the protocols option (8b918b0).

Bug fixes

  • Calling websocket.close() with invalid arguments no longer transitions the
    state to WebSocket.CLOSING (#2337).

8.21.3

Choose a tag to compare

@lpinca lpinca released this 06 Aug 16:38

Bug fixes

  • The server now correctly rejects permessage-deflate offers if the incoming
    client_max_window_bits parameter value is smaller than its configured
    clientMaxWindowBits (e97a20e).

8.21.2

Choose a tag to compare

@lpinca lpinca released this 03 Aug 20:27

Bug fixes

7.5.13

Choose a tag to compare

@lpinca lpinca released this 17 Jul 16:41

Bug fixes

  • Fixed a bug introduced in version 7.5.12 that prevented the fragment counter
    from resetting (18bcb11).