Miggo Logo

CVE-2024-38355: socket.io has an unhandled 'error' event

7.3

CVSS Score
3.1

Basic Information

EPSS Score
0.28386%
Published
6/19/2024
Updated
11/18/2024
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Package NameEcosystemVulnerable VersionsFirst Patched Version
socket.ionpm< 2.5.02.5.1
socket.ionpm>= 3.0.0, < 4.6.24.6.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from error event handling in Socket.IO's Socket class. Both versions (2.x and 4.x) had similar patterns where:

  1. The error emission logic in onerror/_onerror methods didn't guarantee a listener exists
  2. Node.js would throw unhandled exceptions when emitting error events without listeners
  3. The patches added default noop handlers in constructors (socket.ts:280, socket.js:74) and simplified error emission
  4. Pre-patch versions contained conditional logic that failed to prevent unhandled errors when no user-defined listeners were present
  5. The stack trace in the advisory points to socket.js:531 (v4.x equivalent to socket.ts error handling)

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Imp**t * sp**i*lly *r**t** So*k*t.IO p**k*t **n tri***r *n un**u**t *x**ption on t** So*k*t.IO s*rv*r, t*us killin* t** No**.js pro**ss. ``` no**:*v*nts:*** t*row *rr; // Un**n*l** '*rror' *v*nt ^ *rror [*RR_UN**N*L**_*RROR]: Un**n*l**

Reasoning

T** vuln*r**ility st*ms *rom *rror *v*nt **n*lin* in So*k*t.IO's So*k*t *l*ss. *ot* v*rsions (*.x *n* *.x) *** simil*r p*tt*rns w**r*: *. T** *rror *mission lo*i* in on*rror/_on*rror m*t*o*s *i*n't *u*r*nt** * list*n*r *xists *. No**.js woul* t*row u