Executive brief
Undici is a popular HTTP and WebSocket client for Node.js used to fetch data and maintain real-time connections. A vulnerability in its WebSocket implementation allows a malicious server to crash the client application by sending an infinite stream of small data fragments. This leads to memory exhaustion, causing the application to stop responding or shut down entirely.
Technical details
The undici WebSocket client (including the WebSocketStream API) fails to enforce a limit on the number of fragments within a single message. While it validates the cumulative byte count against 'maxPayloadSize', it does not restrict the total count of continuation frames. An attacker-controlled WebSocket server can exploit this by streaming a large volume of small or empty frames. This bypasses per-frame and cumulative size checks while causing the client to allocate memory for each fragment's metadata, leading to memory exhaustion (CWE-400/CWE-770) and a process crash. The vulnerability is fixed in versions 6.27.0, 7.28.0, and 8.5.0.
Affected products
- Node.js undici >= 6.17.0, < 6.27.0; >= 7.0.0, < 7.28.0; >= 8.0.0, < 8.5.0
Timeline
- 2026-06-17: disclosed
- 2026-06-17: advisory
- 2026-06-17: patched