CVE-2021-32640
ReDoS in Sec-Websocket-Protocol header
Check your servers for CVE-2021-32640
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2021-32640 affects ws, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
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.
Severity (CVSS)
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- Attack vector
- network: an attacker can reach the vulnerable part over the network, often from the internet
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- none: the attacker does not need an account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality none, integrity none, availability low: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 2.90%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 87.3% of all scored CVEs. Scores of 1 Dec 2026.
Weakness
- CWE-400 Uncontrolled Resource Consumption
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| ws |
affected >= 5.0.0 <= 7.4.5
|
Is my server affected?
Find the installed version of ws and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.
Debian, Ubuntu
dpkg -l | grep -i ws
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2021-32640 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2021-32640RHEL, Rocky, Alma, Fedora
rpm -q ws
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2021-32640Alpine
apk list --installed | grep -i wsWith Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2021-32640
trivy image --scanners vuln IMAGE | grep CVE-2021-32640
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Advisories
- https://github.com/websockets/ws/security/advisories/GHSA-6fc8-4gx4-v693 github.com
- https://security.netapp.com/advisory/ntap-20210706-0005/ security.netapp.com
Other references
- https://github.com/websockets/ws/commit/00c425ec77993773d823f018f64a5c44e17023ff github.com
- [tinkerpop-commits] 20210701 [tinkerpop] 01/03: Bumped ws to 6.2.2 to address CVE-2021-32640 CTR lists.apache.org · mailing list
Source: the record CVE-2021-32640 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse