undici vulnerable to Denial of Service via unbounded HTTP/2 reconnection of held requests
Description
Impact
A malicious or compromised HTTP/2 origin can hold an undici request open without ever opening a stream, then repeatedly close the connection, driving unbounded reconnection and high client CPU use. A request is held when the peer advertises SETTINGS_MAX_CONCURRENT_STREAMS = 0, or when an extended CONNECT request (including a WebSocket handshake) is waiting for the peer's SETTINGS. In either state, a GOAWAY or a connection close (FIN) starts the retry cycle: undici immediately reconnects and replays the held request without charging it against the existing GOAWAY replay budget, so the request stays pending while connection churn consumes CPU. The reporter reproduced the zero-stream GOAWAY path on undici 8.12.4, where one bodyless Client.request() opened 3,773 sessions in 400 ms without settling. With undici 8.x defaults, new WebSocket('wss://host') can negotiate HTTP/2 and reach this path; on undici 7.x the extended CONNECT and WebSocket path requires the caller to set allowH2: true. The impact is availability of the undici client process only; no confidentiality or integrity impact.
Patches
Upgrade to 7.30.4 or 8.14.1, which charge a request held without a stream against the replay budget when the HTTP/2 session receives a GOAWAY or its socket closes. A held request may be replayed once on a fresh connection; repeated closures then fail it instead of reconnecting indefinitely.
Workarounds
Configure the affected dispatcher with allowH2: false to disable HTTP/2.