Miggo Logo

CVE-2024-37890: ws affected by a DoS when handling a request with many HTTP headers

7.5

CVSS Score
3.1

Basic Information

EPSS Score
0.54504%
Published
6/17/2024
Updated
8/5/2024
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
wsnpm>= 2.1.0, < 5.2.45.2.4
wsnpm>= 6.0.0, < 6.2.36.2.3
wsnpm>= 7.0.0, < 7.5.107.5.10
wsnpm>= 8.0.0, < 8.17.18.17.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability occurs because the code attempts to access properties (like .toLowerCase()) of header values (specifically Upgrade and Sec-WebSocket-Key) without first checking if these headers exist in the req.headers (for server) or res.headers (for client) object. Node.js's HTTP parser may omit headers from this object if the maxHeadersCount limit is exceeded. The patches consistently add checks for undefined before accessing these properties. The primary vulnerable function, as per the advisory and PoC, is WebSocketServer.handleUpgrade which processes incoming requests on the server. The initAsClient function in lib/websocket.js was also patched for an analogous issue on the client side when processing response headers. Both functions are directly involved in parsing headers critical for WebSocket establishment and were modified to prevent crashes when these headers are missing due to header count limits.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Imp**t * r*qu*st wit* * num**r o* *****rs *x****in* t**[`s*rv*r.m*x*****rs*ount`][] t*r*s*ol* *oul* ** us** to *r*s* * ws s*rv*r. ### Proo* o* *on**pt ```js *onst *ttp = r*quir*('*ttp'); *onst W**So*k*t = r*quir*('ws'); *onst wss = n*w W**So*

Reasoning

T** vuln*r**ility o**urs ****us* t** *o** *tt*mpts to ****ss prop*rti*s (lik* `.toLow*r**s*()`) o* *****r v*lu*s (sp**i*i**lly `Up*r***` *n* `S**-W**So*k*t-K*y`) wit*out *irst ****kin* i* t**s* *****rs *xist in t** `r*q.*****rs` (*or s*rv*r) or `r*s.