GHSA-rx4f-c7p8-82vq: Medium severity npm/undici vulnerability
Impact
undici's WebSocketStream crashes the client process when a WebSocket connection is closed abruptly without a close handshake. On such an unclean close, the internal socket-close handler calls abort() on the writable stream even when the application holds a writer lock. Per the WHATWG Streams standard, aborting a locked stream returns a promise that rejects with a TypeError, and the handler discards that promise. The unobserved rejection surfaces as an unhandledRejection and, under Node.js's default behavior, terminates the process.
A malicious or compromised WebSocket server can crash a client with a single connection teardown (a TCP reset, a proxy teardown, or a protocol-violating frame). Affected applications are those using the WebSocketStream API and writing through a writer, which is the standard way to write.
All releases from undici 7.0.0 are affected. WebSocketStream was introduced in 7.0.0.
Patches
Upgrade to undici v7.29.1 or v8.10.2.
Workarounds
No workaround is available.
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.10.2 - Upgrade
Upgrade
npm/undicito a version that resolves this vulnerability.Fixed in 7.29.1 - Upgrade
Upgrade
undicito a version that resolves this vulnerability.Fixed in 7.29.1 - Upgrade
Upgrade
undicito a version that resolves this vulnerability.Fixed in 8.10.2
Event History
Frequently Asked Questions
Which applications are exposed to this denial-of-service risk?
Applications using undici's WebSocketStream API are affected if they write through a writer, which is the standard way to write. All undici releases starting with 7.0.0 are affected.
What does an attacker need to do to trigger the crash?
An attacker needs to control or compromise a WebSocket server that the client connects to, then terminate the connection without a close handshake. A TCP reset, proxy teardown, or protocol-violating frame can trigger the unclean close.
How can I determine whether my deployment is vulnerable?
Check whether the application depends on undici 7.0.0 or later and uses WebSocketStream with a writer. An affected client may terminate after an abrupt WebSocket connection closure because of an unhandled rejection.
What should I do if I cannot patch immediately?
No workaround is available. Upgrade undici to version 7.29.1 or 8.10.2.