ws
Ecosystem: npm
Downloads: 1.29 Bln
- 0CriticalAffects 0 versions
- 4HighAffects 11 versions
- 0MediumAffects 0 versions
- 2ModerateAffects 4 versions
- 1LowAffects 1 version
- Critical0 (0.0%)
- High4 (57.1%)
- Medium0 (0.0%)
- Moderate2 (28.6%)
- Low1 (14.3%)
Monthly breakdown
- Critical
- High
- Medium
- Moderate
- Low
- 1 vulnerabilities
- Critical: 0
- High: 1
- Medium: 0
- Moderate: 0
- Low: 0
- 1 vulnerabilities
- Critical: 0
- High: 0
- Medium: 0
- Moderate: 1
- Low: 0
- 1 vulnerabilities
- Critical: 0
- High: 1
- Medium: 0
- Moderate: 0
- Low: 0
- 1 vulnerabilities
- Critical: 0
- High: 0
- Medium: 0
- Moderate: 1
- Low: 0
- 1 vulnerabilities
- Critical: 0
- High: 1
- Medium: 0
- Moderate: 0
- Low: 0
- 2 vulnerabilities
- Critical: 0
- High: 1
- Medium: 0
- Moderate: 0
- Low: 1
Vulnerabilities (7)
Known vulnerabilities affecting ws, based on data from OSV.
| ID | Severity | Summary | Affected versions | Published | Source |
|---|---|---|---|---|---|
| GHSA-96hv-2xvq-fx4p | High | ws: Memory exhaustion DoS from tiny fragments and data chunks### 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 ```js 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 |
| GitHub (opens in a new tab) | |
| GHSA-58qx-3vcg-4xpx | Moderate | ws: Uninitialized memory disclosure### Impact The `websocket.close()` implementation is vulnerable to uninitialized memory disclosure when a `TypedArray` is passed as the reason argument. ### Proof of concept ```js 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)); |
| GitHub (opens in a new tab) | |
| GHSA-3h5v-q93c-6h6q | High | ws affected by a DoS when handling a request with many HTTP headers### Impact A request with a number of headers exceeding the [`server.maxHeadersCount`][] threshold could be used to crash a ws server. ### Proof of concept ```js const http = require('http'); const WebSocket = require('ws'); const wss = new WebSocket.Server({ port: 0 }, function () { const chars = "!#$%&'*+-.0123456789abcdefghijklmnopqrstuvwxyz^_`|~".split(''); const headers = {}; let count = 0; for (let i = 0; i < chars.length; i++) { if (count === 2000) break; for (let j = 0; j < chars.length; j++) { const key = chars[i] + chars[j]; headers[key] = 'x'; |
| GitHub (opens in a new tab) | |
| GHSA-6fc8-4gx4-v693 | Moderate | ReDoS in Sec-Websocket-Protocol header### Impact A specially crafted value of the `Sec-Websocket-Protocol` header can be used to significantly slow down a ws server. ### Proof of concept ```js for (const length of [1000, 2000, 4000, 8000, 16000, 32000]) { const value = 'b' + ' '.repeat(length) + 'x'; const start = process.hrtime.bigint(); value.trim().split(/ *, */); const end = process.hrtime.bigint(); console.log('length = %d, time = %f ns', length, end - start); } ``` ### Patches The vulnerability was fixed in ws@7.4.6 (https://github.com/websockets/ws/commit/00c425ec77993773d823f018f64a5c44e17023ff) and backp |
| GitHub (opens in a new tab) | |
| GHSA-5v72-xg48-5rpm | High | Denial of Service in wsAffected 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 |
| GitHub (opens in a new tab) | |
| GHSA-2mhh-w6q8-5hxw | Low | Remote Memory Disclosure in wsVersions of `ws` prior to 1.0.1 are affected by a remote memory disclosure vulnerability. In certain rare circumstances, applications which allow users to control the arguments of a `client.ping()` call will cause `ws` to send the contents of an allocated but non-zero-filled buffer to the server. This may disclose sensitive information that still exists in memory after previous use of the memory for other tasks. ## Proof of Concept ``` var ws = require('ws') var server = new ws.Server({ port: 9000 }) var client = new ws('ws://localhost:9000') client.on('open', function () { console.log |
| GitHub (opens in a new tab) | |
| GHSA-6663-c963-2gqg | High | DoS due to excessively large websocket message in wsAffected versions of `ws` do not appropriately limit the size of incoming websocket payloads, which may result in a denial of service condition when the node process crashes after receiving a large payload. ## Recommendation Update to version 1.1.1 or later. Alternatively, set the `maxpayload` option for the `ws` server to a value smaller than 256MB. |
| GitHub (opens in a new tab) |
- GHSA-96hv-2xvq-fx4pHighws: Memory exhaustion DoS from tiny fragments and data chunks
>= 1.1.0, < 5.2.5>= 6.0.0, < 6.2.4- +2 more
Affected versions:>= 1.1.0, < 5.2.5>= 6.0.0, < 6.2.4>= 7.0.0, < 7.5.11>= 8.0.0, < 8.21.0
### 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 ```js 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
CVE: CVE-2026-48779
- GHSA-58qx-3vcg-4xpxModeratews: Uninitialized memory disclosure
>= 8.0.0, < 8.20.1
### Impact The `websocket.close()` implementation is vulnerable to uninitialized memory disclosure when a `TypedArray` is passed as the reason argument. ### Proof of concept ```js 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));
CVE: CVE-2026-45736
- GHSA-3h5v-q93c-6h6qHighws affected by a DoS when handling a request with many HTTP headers
>= 2.1.0, < 5.2.4>= 6.0.0, < 6.2.3- +2 more
Affected versions:>= 2.1.0, < 5.2.4>= 6.0.0, < 6.2.3>= 7.0.0, < 7.5.10>= 8.0.0, < 8.17.1
### Impact A request with a number of headers exceeding the [`server.maxHeadersCount`][] threshold could be used to crash a ws server. ### Proof of concept ```js const http = require('http'); const WebSocket = require('ws'); const wss = new WebSocket.Server({ port: 0 }, function () { const chars = "!#$%&'*+-.0123456789abcdefghijklmnopqrstuvwxyz^_`|~".split(''); const headers = {}; let count = 0; for (let i = 0; i < chars.length; i++) { if (count === 2000) break; for (let j = 0; j < chars.length; j++) { const key = chars[i] + chars[j]; headers[key] = 'x';
CVE: CVE-2024-37890
- GHSA-6fc8-4gx4-v693ModerateReDoS in Sec-Websocket-Protocol header
>= 7.0.0, < 7.4.6>= 6.0.0, < 6.2.2- +1 more
Affected versions:>= 7.0.0, < 7.4.6>= 6.0.0, < 6.2.2>= 5.0.0, < 5.2.3
### Impact A specially crafted value of the `Sec-Websocket-Protocol` header can be used to significantly slow down a ws server. ### Proof of concept ```js for (const length of [1000, 2000, 4000, 8000, 16000, 32000]) { const value = 'b' + ' '.repeat(length) + 'x'; const start = process.hrtime.bigint(); value.trim().split(/ *, */); const end = process.hrtime.bigint(); console.log('length = %d, time = %f ns', length, end - start); } ``` ### Patches The vulnerability was fixed in ws@7.4.6 (https://github.com/websockets/ws/commit/00c425ec77993773d823f018f64a5c44e17023ff) and backp
CVE: CVE-2021-32640
- GHSA-5v72-xg48-5rpmHighDenial of Service in ws
>= 0.6.0, < 1.1.5>= 2.0.0, < 3.3.1
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
Versions of `ws` prior to 1.0.1 are affected by a remote memory disclosure vulnerability. In certain rare circumstances, applications which allow users to control the arguments of a `client.ping()` call will cause `ws` to send the contents of an allocated but non-zero-filled buffer to the server. This may disclose sensitive information that still exists in memory after previous use of the memory for other tasks. ## Proof of Concept ``` var ws = require('ws') var server = new ws.Server({ port: 9000 }) var client = new ws('ws://localhost:9000') client.on('open', function () { console.log
CVE: CVE-2016-10518
- GHSA-6663-c963-2gqgHighDoS due to excessively large websocket message in ws
< 1.1.1
Affected versions of `ws` do not appropriately limit the size of incoming websocket payloads, which may result in a denial of service condition when the node process crashes after receiving a large payload. ## Recommendation Update to version 1.1.1 or later. Alternatively, set the `maxpayload` option for the `ws` server to a value smaller than 256MB.
CVE: CVE-2016-10542