GHSA-55wc-3pg8-jfw6: Medium severity npm/undici vulnerability
Impact
undici's decompress interceptor forwards decompressed response data to the downstream handler from zlib stream event callbacks without catching exceptions those callbacks may throw. undici's engine converts a synchronous throw from a downstream handler into a per-request failure, but that protection is not in place when the throw happens asynchronously from a zlib callback. As a result, a downstream handler that throws by design, for example the built-in dump interceptor which throws when a response exceeds its maxSize, escapes as an uncaught exception and terminates the Node.js process.
A malicious or compromised HTTP server can crash any client that composes the decompress interceptor with dump (or another response handler that throws), by returning a small compressed body that decompresses to more than the configured limit. The compressed bytes on the wire are tiny, so only the decompressed size matters. If the application keeps the process alive with a global uncaught-exception handler, the affected request instead hangs until the body timeout.
Patches
Upgrade to undici 7.30.1 or 8.12.2.
Workarounds
Avoid composing the decompress interceptor with a response handler that throws during response processing (such as dump with a maxSize) until upgrading.
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
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 - Compensating control
Until upgrading, avoid composing the undici decompress interceptor with a response handler that throws during response processing, such as the dump interceptor configured with maxSize.
Event History
Frequently Asked Questions
Which applications are exposed to process termination?
Clients that compose undici's decompress interceptor with the dump interceptor, or another downstream response handler that can throw, are exposed when they process attacker-controlled HTTP responses.
What does an attacker need to send to trigger the failure?
A malicious or compromised HTTP server can return a small compressed response whose decompressed content exceeds the downstream handler's configured size limit. The compressed size on the wire does not need to be large.
What happens if the application has a global uncaught-exception handler?
The process may remain alive, but the affected request hangs until the body timeout rather than completing normally.
What can be done before upgrading?
Avoid composing the decompress interceptor with dump or any response handler that throws. Upgrade to undici 7.30.1 or 8.12.2 when possible.