GHSA-9fm3-97px-rjf6: Medium severity npm/undici vulnerability
Impact
undici's WebSocket client (including Node.js's bundled globalThis.WebSocket) can be driven to exhaust process memory by a malicious or compromised WebSocket server. For every PING frame received, the receiver automatically writes a PONG response to the socket and ignores the false return value from socket.write(), which is a backpressure signal, so a server that streams small PING frames while never reading the client's PONGs makes the outbound write queue and heap grow without bound until the Node.js process runs out of memory and terminates. The attack is remote and unauthenticated, needs only a normal WebSocket connection, and is asymmetric: small inbound PINGs produce a much larger retained outbound queue. Availability is the only impact. undici 5.x, 6.x, 7.x, and 8.x are affected; the WebSocket client was introduced in 5.15.0.
Patches
Upgrade to 6.29.1, 7.30.1, or 8.12.2, which pause WebSocket frame parsing when the automatic PONG response hits socket backpressure and resume on drain, bounding the outbound queue.
Workarounds
None.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/undicito a version that resolves this vulnerability.Fixed in 8.12.2 - Upgrade
Upgrade
npm/undicito a version that resolves this vulnerability.Fixed in 7.30.1 - Upgrade
Upgrade
npm/undicito a version that resolves this vulnerability.Fixed in 6.29.1 - Upgrade
Upgrade
undicito a version that resolves this vulnerability.Fixed in 6.29.1 - Upgrade
Upgrade
undicito a version that resolves this vulnerability.Fixed in 7.30.1 - Upgrade
Upgrade
undicito a version that resolves this vulnerability.Fixed in 8.12.2
Event History
Frequently Asked Questions
Which deployments are exposed to this denial-of-service issue?
Applications using undici's WebSocket client are affected in undici 5.x, 6.x, 7.x, and 8.x. This also includes Node.js applications using the bundled globalThis.WebSocket; the WebSocket client was introduced in undici 5.15.0.
What must an attacker be able to do to trigger the issue?
An attacker needs to operate or compromise a WebSocket server that the application connects to. No authentication or special protocol access is required beyond a normal WebSocket connection, and the server must send PING frames while not reading the client's automatic PONG responses.
What is the operational impact of successful exploitation?
The affected process can accumulate an unbounded outbound write queue and heap usage until it runs out of memory and terminates. The documented impact is limited to availability.
Which versions contain the fix?
Upgrade to undici 6.29.1, 7.30.1, or 8.12.2. These releases pause WebSocket frame parsing when automatic PONG writes encounter socket backpressure and resume parsing after the socket drains.
Is there a mitigation if an upgrade cannot be applied immediately?
No workaround is provided. The available remediation is upgrading to a fixed undici release.