CVE-2024-38355: Unhandled 'error' event in socket.io

Published Jun 19, 2024
·
Updated

Impact

A specially crafted Socket.IO packet can trigger an uncaught exception on the Socket.IO server, thus killing the Node.js process.

node:events:502 throw err; // Unhandled 'error' event ^

Error [ERRUNHANDLEDERROR]: Unhandled error. (undefined) at new NodeError (node:internal/errors:405:5) at Socket.emit (node:events:500:17) at /myapp/nodemodules/socket.io/lib/socket.js:531:14 at process.processTicksAndRejections (node:internal/process/taskqueues:77:11) { code: 'ERRUNHANDLEDERROR', context: undefined }

Affected versions

| Version range | Needs minor update? | |------------------|------------------------------------------------| | 4.6.2...latest | Nothing to do | | 3.0.0...4.6.1 | Please upgrade to socket.io@4.6.2 (at least) | | 2.3.0...2.5.0 | Please upgrade to socket.io@2.5.1 |

Patches

This issue is fixed by https://github.com/socketio/socket.io/commit/15af22fc22bc6030fcead322c106f07640336115, included in socket.io@4.6.2 (released in May 2023).

The fix was backported in the 2.x branch today: https://github.com/socketio/socket.io/commit/d30630ba10562bf987f4d2b42440fc41a828119c

Workarounds

As a workaround for the affected versions of the socket.io package, you can attach a listener for the "error" event:

js io.on("connection", (socket) => { socket.on("error", () => { // ... }); });

For more information

If you have any questions or comments about this advisory:

- Open a discussion here

Thanks a lot to Paul Taylor for the responsible disclosure.

References

- https://github.com/socketio/socket.io/commit/15af22fc22bc6030fcead322c106f07640336115 - https://github.com/socketio/socket.io/commit/d30630ba10562bf987f4d2b42440fc41a828119c

Other sources

Socket.IO is an open source, real-time, bidirectional, event-based, communication framework. A specially crafted Socket.IO packet can trigger an uncaught exception on the Socket.IO server, thus killing the Node.js process. This issue is fixed by commit 15af22fc22 which has been included in socket.io@4.6.2 (released in May 2023). The fix was backported in the 2.x branch as well with commit d30630ba10. Users are advised to upgrade. Users unable to upgrade may attach a listener for the "error" event to catch these errors.

— NVD

Affected Software

2 affected componentsFixes available
npm/socket.io>=3.0.0<4.6.2
4.6.2
npm/socket.io<2.5.0
2.5.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/socket.io to a version that resolves this vulnerability.

    Fixed in 4.6.2
  2. Upgrade

    Upgrade npm/socket.io to a version that resolves this vulnerability.

    Fixed in 2.5.1
  3. Upgrade

    Upgrade socket.io to a version that resolves this vulnerability.

    Fixed in 2.5.1
  4. Upgrade

    Upgrade socket.io to a version that resolves this vulnerability.

    Fixed in 4.6.2
  5. Compensating control

    If unable to upgrade, attach a listener for the "error" event on each Socket.IO socket, such as socket.on("error", () => { ... });, to catch the errors and prevent the uncaught exception from killing the Node.js process.

Event History

Jun 19, 2024
Advisory Published
via GitHub·03:04 PM
CVE Published
via MITRE·07:48 PM
Data Sourced
via MITRE·07:48 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:15 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

What is the severity of CVE-2024-38355?

CVE-2024-38355 is classified as a vulnerability that can cause a denial of service by crashing the Node.js process.

2

How do I fix CVE-2024-38355?

To fix CVE-2024-38355, upgrade to Socket.IO version 4.6.2 or newer, or 2.5.1 if using an older version.

3

What versions of Socket.IO are affected by CVE-2024-38355?

CVE-2024-38355 affects Socket.IO versions from 3.0.0 up to, but not including, 4.6.2, and all versions below 2.5.1.

4

What kind of attacks can CVE-2024-38355 enable?

CVE-2024-38355 can enable denial of service attacks through specially crafted Socket.IO packets that lead to an uncaught exception.

5

What are the consequences of not addressing CVE-2024-38355?

Failing to address CVE-2024-38355 could lead to service interruptions due to unexpected crashes of the Node.js server.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203