CVEfocus › CVE database › CVE-2021-32640

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

CVSS 5.3 MediumEPSS 2.9% (higher than 88% of CVEs)Published 2021-05-25Updated 2024-08-03Assigner: GitHub_M

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.

CWE-400

What to do

Fixed builds are available from Debian, npm: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

4Fixed
3Fix pending
1Under investigation
3Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.04node-wsNot affected
vulnerable_code_not_present
Ubuntu 25.10node-wsNot affected
vulnerable_code_not_present
Ubuntu 24.04node-wsNot affected
vulnerable_code_not_present
Ubuntu 22.04node-wsUnder investigationUBUNTU-CVE-2021-32640
Ubuntu 20.04node-wsFix pendingUBUNTU-CVE-2021-32640
Ubuntu 18.04node-wsFix pendingUBUNTU-CVE-2021-32640
Ubuntu 16.04node-wsFix pendingUBUNTU-CVE-2021-32640
Debian 14node-wsFixed7.4.2+~cs18.0.8-2DEBIAN-CVE-2021-32640
Debian 13node-wsFixed7.4.2+~cs18.0.8-2DEBIAN-CVE-2021-32640
Debian 12node-wsFixed7.4.2+~cs18.0.8-2DEBIAN-CVE-2021-32640
npm librarywsFixed5.2.3GHSA-6fc8-4gx4-v693

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.