Vulnerability · Published May 25, 2021 · Assigned by GitHub_M

CVE-2021-32640ReDoS in Sec-Websocket-Protocol header

Medium 5.3

In plain English

A medium-severity uncontrolled resource consumption in ws from websockets. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 2.8% (higher than 87% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)5.3Medium
Exploit odds (30 days)2.8%top 13.4% of all CVEs
Exploited in the wildNo reportsnot in CISA KEV
Attack toolingNoneno public tooling known

Official description

ws is an open source WebSocket client and server library for Node.js. A specially crafted value of the `Sec-Websocket-Protocol` header can be used to significantly slow down a ws server. The vulnerability has been fixed in ws@7.4.6 (https://github.com/websockets/ws/commit/00c425ec77993773d823f018f64a5c44e17023ff). In vulnerable versions of ws, the issue can be mitigated by reducing the maximum allowed length of the request headers using the [`--max-http-header-size=size`](https://nodejs.org/api/cli.html#cli_max_http_header_size_size) and/or the [`maxHeaderSize`](https://nodejs.org/api/http.html#http_http_createserver_options_requestlistener) options.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12node-ws7.4.2+~cs18.0.8-2DEBIAN-CVE-2021-32640
Debian:13node-ws7.4.2+~cs18.0.8-2DEBIAN-CVE-2021-32640
Debian:14node-ws7.4.2+~cs18.0.8-2DEBIAN-CVE-2021-32640
Ubuntu:22.04:LTSnode-wsno fix listedUBUNTU-CVE-2021-32640
npmws6.2.2GHSA-6fc8-4gx4-v693
npmws5.2.3GHSA-6fc8-4gx4-v693
npmws7.4.6GHSA-6fc8-4gx4-v693

Affected products (as reported)

VendorProductVersions
websockets ws >= 5.0.0 <= 7.4.5

Weakness: CWE-400 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

References