Skip to main content
Menu
Advisories

Process crash via Socket.IO error replies that echo a message's binary data

GHSA-PQX8-96W4-Q4W8Published Updated GitHub

Description

FieldValue
Ecosystemnpm
Package@nestjs/websockets, @nestjs/platform-socket.io
Affected versions>= 11.0.0, < 11.2.10 and >= 12.0.0, < 12.5.0
Patched versions11.2.10 and 12.5.0
SeverityHigh
CVSS v3.1AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H (7.5)
CWECWE-405 (Asymmetric Resource Consumption (Amplification)), CWE-400 (Uncontrolled Resource Consumption)

Summary

By default, the WebSocket exception filter includes the data of the message that failed in its error reply. With the Socket.IO adapter, a crafted message with binary data could make that reply far larger than the message itself, and sending it could exhaust memory or terminate the process.

Impact

Applications using the default Socket.IO adapter and the default WebSocket exception filter (or one that extends BaseWsExceptionFilter and keeps includeCause) are affected when any message handler can fail for a client, for example because a guard refuses it or a pipe rejects the payload. No authentication is needed.

Patches

Fixed in 11.2.10 and 12.5.0. The default filter leaves binary data out of the cause of its error replies, and IoAdapter disconnects a client whose message refers to the same binary value more than once. Upgrade both @nestjs/websockets and @nestjs/platform-socket.io.

Workarounds

Use an exception filter that does not include the cause, for example one that extends BaseWsExceptionFilter with includeCause: false.

Credit

Reported by Anthropic's OSS Scanner.

Affected versions

References

GitHub · nestjs/nest