Unbounded HTTP header accumulation across SPDY HEADERS frames in SpdyHttpDecoder causes memory-exhaustion DoS
Description
The SPDY-to-HTTP decoder in io.netty:netty-codec-http buffers an in-progress request while its body and trailing headers arrive in later frames, but it never bounds how many header name and value pairs it accumulates into that buffered message. A remote, unauthenticated peer that opens a single SPDY stream with a non-final SYN_STREAM and then sends an unbounded series of non-final HEADERS frames causes the retained HttpHeaders of the buffered message to grow without limit for the lifetime of the connection. The only size guard in the decoder applies to the DATA (body) path, not the HEADERS path, so a headers-only stream is completely unbounded and drives the JVM to OutOfMemoryError.
Root Cause
When SpdyHttpDecoder receives a non-final SYN_STREAM it constructs a FullHttpMessage and stores it in an internal per-stream map, expecting the remainder of the request to arrive in subsequent frames. For each following HEADERS frame on that stream, the decoder appends every header pair from the frame directly onto the buffered message's header set. There is no cumulative limit on the number of HEADERS frames per stream, the number of header entries, or the total retained header size. The decoder's single length guard checks only the accumulated body length on the DATA branch and throws when it exceeds maxContentLength; the HEADERS branch has no analogous cap. The buffered message is removed only when a final (last) frame, an RST_STREAM, a DATA overflow, or channel close occurs, none of which an attacker is obliged to send. Upstream, SpdySessionHandler forwards non-final HEADERS frames on an open stream unconditionally and does not count them, and SPDY flow control governs DATA frames only, so HEADERS frames are never subject to backpressure.
Affected component: io.netty.handler.codec.spdy.SpdyHttpDecoder
Sink: SpdyHttpDecoder.decode(...) SpdyHeadersFrame branch
codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpDecoder.java:369-373
(appends every header pair from each non-final HEADERS frame with no cumulative cap)
Only guard present: SpdyDataFrame branch maxContentLength check at
codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpDecoder.java:396 (DATA path only)
Unbounded forwarder: io.netty.handler.codec.spdy.SpdySessionHandler.channelRead(...)
codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java:407-426, 462Impact
A remote attacker who can reach a server that enables the Netty SPDY codec, with no authentication and no user interaction, can exhaust the JVM heap using a single connection and a single stream. Because SPDY header blocks are zlib-compressed on the wire and highly compressible, a small transmitted payload expands to roughly maxHeaderSize (16 KiB by default) of retained header data per frame, giving a large transmit-to-retained amplification. The retained data is pinned for the connection lifetime and is not garbage-collectable, so the growth is monotonic and leads reliably to OutOfMemoryError and denial of service for the whole process. The demonstrated capability is availability loss (process-wide memory exhaustion); there is no confidentiality or integrity impact.
Proof of Concept
Requires the netty-codec-http SPDY classes on the classpath. The harness drives the decoder directly through an EmbeddedChannel using the protected SpdyHttpDecoder(SpdyVersion, int, Map) constructor, so no live socket is required.
Reproduction steps:
- Build a pipeline (or
EmbeddedChannel) containingSpdyHttpDecoder. - Feed one
SpdySynStreamFrame(streamId=1, last=false)carrying the mandatory:method/:path/:version/:scheme/:hostpseudo-headers so the decoder buffers the request. - Feed a large number of
SpdyHeadersFrame(streamId=1, last=false), each carrying many header pairs and each kept at or undermaxHeaderSizeso it is not marked truncated. - Never send a final frame, RST_STREAM, or close the stream.
EmbeddedChannel ch = new EmbeddedChannel(
new SpdyHttpDecoder(SpdyVersion.SPDY_3_1, /*maxContentLength*/ 1 << 20, new HashMap<Integer, FullHttpMessage>()));
SpdySynStreamFrame syn = new DefaultSpdySynStreamFrame(1, 0, (byte) 0);
syn.setLast(false);
syn.headers().set(":method", "GET").set(":path", "/").set(":version", "HTTP/1.1")
.set(":scheme", "https").set(":host", "victim");
ch.writeInbound(syn);
for (int f = 0; f < 2000; f++) {
SpdyHeadersFrame h = new DefaultSpdyHeadersFrame(1);
h.setLast(false);
for (int i = 0; i < 100; i++) {
h.headers().add("x-pad-" + f + "-" + i, "v");
}
ch.writeInbound(h); // each frame's pairs are appended; nothing is emitted or capped
}Observed: the buffered FullHttpMessage retains 2000 * 100 = 200000 header entries
while content().readableBytes() == 0, so the maxContentLength guard never fires.
Negative control: feeding SpdyDataFrame content beyond maxContentLength instead
throws TooLongFrameException, confirming only the DATA path is bounded.Attack Chain
- Exposure: A server application enables the SPDY codec (the documented example pipeline wires
SpdyFrameCodec,SpdySessionHandler, andSpdyHttpDecoder). Any remote peer can open a stream; no authentication guards the SPDY request path. - Control: The attacker fully controls the number of HEADERS frames sent on a stream and every header name and value in each frame. Keeping each frame at or under
maxHeaderSizeensures the frame is not marked truncated, so its pairs are appended verbatim. - Path: A non-final SYN_STREAM makes
SpdyHttpDecoderbuffer the request in its per-stream map. Each subsequent non-final HEADERS frame is validated bySpdySessionHandler(only for protocol validity, remote-closed state, and the last flag) and then forwarded, reaching the decoder's HEADERS branch. - Guard: The decoder's only length guard is on the DATA branch (
maxContentLengthagainst the body byte buffer). The HEADERS branch has no count or cumulative-size cap; the per-framemaxHeaderSizeand zlib decompression caps reset for each frame and cannot bound the cross-frame sum; SPDY flow control does not apply to HEADERS. - Primitive: Unbounded, monotonic growth of the retained
HttpHeadersof a buffered message that is never released because no final or reset frame is sent. - Result: Heap exhaustion and
OutOfMemoryError, a process-wide denial of service, from a single unauthenticated connection.
Bypass Evidence
The relevant guards were examined and none bounds this path. The DATA-branch maxContentLength check at SpdyHttpDecoder.java:396 tests content().readableBytes(), which stays at zero for a headers-only stream, so it never fires; the negative-control test confirms that the DATA path does throw TooLongFrameException, isolating the HEADERS path as the unguarded gap. The per-frame limits reset between frames: SpdyHeaderBlockRawDecoder resets its headerSize accumulator at end of block and SpdyHeaderBlockZlibDecoder resets totalInflated at end of block, so maxHeaderSize and maxDecompressedSize bound one frame only, not the accumulated total. SpdySessionHandler's HEADERS handling forwards non-final frames unconditionally with no counter, and its receive-window logic is confined to the DATA branch. Four previously disclosed SPDY issues were checked against current source and none blocks this vector: the concurrent-stream cap advisory limits the number of simultaneous streams (this attack uses one stream); the DATA-frame reference-count leak fix (CVE-2026-56745) addresses a different primitive on the body path; the SETTINGS-frame unbounded-map issue (CVE-2026-55831) targets a different frame type and sink; and the per-block zlib expansion issue (CVE-2026-55833) is exactly the per-frame reset described above. Version-control history for the decoder shows no fix to the header-accumulation sink.
Affected Versions
Ecosystem: MavenPackage: io.netty:netty-codec-httpConfirmed affected range: <= 4.2.18.FinalLatest release checked: 4.2.18.Final (Maven Central); source checkout netty-4.2.18.Final-12-gc25cc85Fix status: not fixed
The vulnerable pattern (a DATA-only maxContentLength guard with an unbounded HEADERS accumulation path) is long-standing SPDY-codec code. The current published 4.2 line release (4.2.18.Final) is affected and the sink is unchanged in the unreleased commits past that tag. The maintained 4.1 line is affected in the same way through its latest release (4.1.138.Final). No fixed release exists on any line. The exact introduction boundary could not be pinned from the available shallow checkout.
Suggested Fix
Enforce a cumulative bound on headers accumulated into the buffered message on the HEADERS path, mirroring the existing DATA-path maxContentLength protection. Track the total number of header entries and their aggregate size across all HEADERS frames for a given stream, and when the configured limit is exceeded, remove and release the buffered message and raise a TooLongFrameException (or issue a stream error), just as the DATA branch already does when body length is exceeded. The bound must cover the cross-frame sum, not merely a single frame, since the per-frame decode limits reset per frame. As an interim mitigation, operators can avoid enabling the deprecated SPDY codec, place a bound on total request size ahead of the decoder, or terminate connections that send an excessive number of HEADERS frames without completing a request.
Reported by zx (GitHub: @manus-pi).