CVE-2024-38355: socket.io has an unhandled 'error' event
7.3
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.28386%
CWE
Published
6/19/2024
Updated
11/18/2024
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| socket.io | npm | < 2.5.0 | 2.5.1 |
| socket.io | npm | >= 3.0.0, < 4.6.2 | 4.6.2 |
Vulnerability Intelligence
Miggo AI
Root 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:
- The error emission logic in onerror/_onerror methods didn't guarantee a listener exists
- Node.js would throw unhandled exceptions when emitting error events without listeners
- The patches added default noop handlers in constructors (socket.ts:280, socket.js:74) and simplified error emission
- Pre-patch versions contained conditional logic that failed to prevent unhandled errors when no user-defined listeners were present
- The stack trace in the advisory points to socket.js:531 (v4.x equivalent to socket.ts error handling)