//nefariousplan

CVE-2026-42582: Netty Patched Three QPACK Allocations, The Advisory Names One

vendor

pattern

cve

proof of concept

The advisory for CVE-2026-42582 names one allocation. It names the non-Huffman branch of QpackDecoder.decodeHuffmanEncodedLiteral, where Netty 4.2 calls new byte[length] before checking the buffer has length bytes to read. A ten-byte HTTP/3 HEADERS payload encodes a one-gibibyte allocation. The GitHub Security Advisory ships a test case proving it.

The patch closes three sites across three files. The other branch of the function the advisory names delegates to QpackHuffmanDecoder.decode, which allocates length * 8 / 5 bytes from the same wire-supplied integer. The branch the CVE description excludes from its scope is the one that allocates the most.

Ten wire bytes, one gibibyte allocated

The reporter on the CVE-2026-42582 advisory is violetagg, a Netty committer. The proof of concept she attached fits in one line of hexadecimal.

01 08 00 00 27 80 80 80 80 04

Ten bytes. The advisory's accompanying test method confirms what happens server-side: the QPACK decoder hands those ten bytes to decodeHuffmanEncodedLiteral, the function reads a QPACK prefixed-integer expressing approximately 2^30, and the next executable line runs new byte[length]. One gibibyte allocation, off a single QUIC datagram.

The encoding is RFC 7541 § 5.1, inherited by QPACK (RFC 9204) from HPACK without modification. The varint format spends wire bytes logarithmically in the value. Roughly six bytes can express any positive 31-bit integer. The Netty decoder spends allocation bytes linearly in the value. At no point in the data path does the decoder compare the two. A defender wanting to cap the worst case has no Netty setting to reach for; the protocol and the parser together fix worst-case allocation at a constant times Integer.MAX_VALUE.

This is the amplification factor between wire bytes and allocated bytes: roughly eight orders of magnitude. A single QUIC datagram mints a gibibyte off the server's heap. The CVSS vector on CVE-2026-42582 is AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H. Network reachable, no privileges, no interaction, availability impact high. The vector is correct.

The function is named for the branch the CVE does not describe

Here is the unpatched function in full, from Netty 4.2.12.Final. The name is decodeHuffmanEncodedLiteral.

private CharSequence decodeHuffmanEncodedLiteral(ByteBuf in, int prefix) throws QpackException {
    assert prefix < 8;
    final boolean huffmanEncoded = firstByteEquals(in, (byte) (1 << prefix));
    final int length = decodePrefixedIntegerAsInt(in, prefix);
    assert length >= 0;
    if (huffmanEncoded) {
        return huffmanDecoder.decode(in, length);
    }
    byte[] buf = new byte[length];
    in.readBytes(buf);
    return new AsciiString(buf, false);
}

The function handles both Huffman and non-Huffman literals. The H bit at position 1 << prefix in the first byte decides. The CVE-2026-42582 description names the non-Huffman branch, the byte[] buf = new byte[length] line two lines below the if. That is the smaller of the two allocations the function dispatches.

The Huffman branch is the other one. It calls huffmanDecoder.decode(in, length), with the same attacker-controlled integer. Here is the relevant Huffman decoder, also from 4.2.12.Final, before the patch:

public AsciiString decode(ByteBuf buf, int length) throws QpackException {
    if (length == 0) {
        return AsciiString.EMPTY_STRING;
    }
    dest = new byte[length * 8 / 5];
    ...

length * 8 / 5. The HPACK Huffman table (RFC 7541 Appendix B, reused by QPACK) defines minimum codes of five bits for the most-common ASCII characters. The worst-case expansion of compressed bytes to decoded bytes is therefore eight output bits per five compressed bits. The decoder allocates that worst case before consuming a single byte of input. The same ten-byte payload, with the H bit flipped on, allocates 1.6 gibibytes instead of 1.0.

The dest field on the decoder is an instance field, not a local. The over-allocated buffer remains referenced by the decoder instance until the next decode() call replaces it or the garbage collector reclaims it. Each pooled QpackHuffmanDecoder carries the size of its last decode forward into the heap's live set. On an idle server, the residue of one attacker request stays pinned until the connection moves.

The attacker chooses the H bit. The branch the CVE description excludes is the one the attacker picks. The branch the attacker picks is the one whose decoder holds the over-allocation across calls.

The patch closes three files

The fix is commit 541ca7c, "Merge commit from fork", authored by Norman Maurer on May 4, 2026, four days before the GHSA was published. The diff is eighteen lines across three files. The same three-line check appears in each:

+        if (in.readableBytes() < length) {
+            throw INVALID_LENGTH_ENCODED_LITERAL;
+        }
         byte[] buf = new byte[length];
         in.readBytes(buf);

Three sites:

  1. QpackDecoder.decodeHuffmanEncodedLiteral: the non-Huffman literal allocation in the request-stream header decoder. The site CVE-2026-42582 describes.
  2. QpackEncoderHandler.decodeStringLiteral: the non-Huffman literal allocation in the QPACK encoder-instructions stream handler. The CVE does not mention this file.
  3. QpackHuffmanDecoder.decode: the Huffman branch's dest = new byte[length * 8 / 5]. Same fix, applied to the larger allocation.

The second site, QpackEncoderHandler, is the most quietly damaging omission. QPACK splits its wire protocol across multiple QUIC streams: a request stream carrying encoded field sections, and a unidirectional encoder stream carrying instructions that update the peer's dynamic table. The instructions are Insert With Name Reference, Insert Without Name Reference, Set Dynamic Table Capacity, Duplicate. The Insert instructions carry string literals with their own length fields, decoded by QpackEncoderHandler.decodeStringLiteral (or its Huffman delegate). Both decoders carried the same bug. Both got the same fix in the same commit. The advisory text describes the request-stream decoder and is silent on the encoder-stream decoder.

The encoder stream is opened by the client at connection setup, before any HTTP/3 request is sent. It is reachable as soon as the QUIC handshake completes, by any caller that can speak QUIC to the server. The dynamic-table capacity ceiling lives on the local decoder and is advertised via the SETTINGS_QPACK_MAX_TABLE_CAPACITY setting, but the literal length fields inside Insert instructions are not constrained by it. The pre-patch decoder allocates the literal's claimed size before checking whether the wire actually delivered that many bytes. A single Insert With Name Reference instruction with a wire-encoded length of 2^30 reaches the same new byte[length] site on the encoder-stream handler that the CVE description does not mention.

A defender who reads the advisory and audits QpackDecoder.java learns about one allocation. They will not audit QpackEncoderHandler.java because the advisory does not name it. They will not audit QpackHuffmanDecoder.java because the advisory says "the non-Huffman branch." Upgrade to 4.2.13.Final closes all three because the patch did. Manual remediation guided by the advisory closes one.

The parser receives a framed buffer and trusts inner lengths past the frame

The pattern is one the catalog already names: frame-bounds-headers-only. The Netty QPACK decoder accepts a ByteBuf whose readableBytes() is the outer bound of the wire content it is supposed to consume. Every inner literal in that content carries its own length field. The parser's contract should be that each inner length is bounded by the outer remainder. The pre-patch parser does not enforce this; the fix is one comparison per site against in.readableBytes() before the allocation runs.

The shape is structural and transcends QPACK. Variable-length integer encodings sit at the bottom of every modern wire format. HPACK in HTTP/2. QPACK in HTTP/3. QUIC's transport encoding itself. Protobuf framing under gRPC. msgpack. ASN.1 BER. CBOR. Each format spends a constant number of wire bytes to express any practical integer. Each parser that reads such an integer and immediately uses it to size an allocation has a worst-case allocation bounded only by the integer type's range, not by the wire bytes actually delivered. Three sites in one QPACK module is one codebase's worth of the pattern. The pattern lives in every codebase that decodes variable-length integers off a network socket. Netty's patch is correct at the function level. The fix the broader Java HTTP/3 ecosystem requires is the same predicate applied wherever a wire integer drives an allocation.

Who runs codec-http3

Netty's codec-http3 module ships as part of the Netty 4.2 main artifact set under io.netty:netty-codec-http3. It is positioned as incubator, but it is published, versioned, and consumed. Reactor Netty 1.2 picked up HTTP/3 server support sitting on top of this module. Spring WebFlux's experimental HTTP/3 listener is the consumer one layer up. Quarkus exposes HTTP/3 through the same Netty codec via Vert.x. gRPC-Java has an experimental HTTP/3 server profile. Any deployment that has wired HTTP/3 onto a Netty 4.2 pipeline before May 8, 2026 was running all three pre-patch allocations. The footprint is small relative to HTTP/2 Netty. It is not zero, and it is the leading edge of the ecosystem that will be larger in twelve months.

The advisory inherits the report

CVE descriptions are written from bug reports. Bug reports start with one finding. By the time the patch is written, the reporter has often grepped the codebase for the same pattern and found neighbors. The patch closes the neighbors. The description does not always grow to match.

In this case the reporter is the patcher. violetagg found one allocation, then patched three. Norman Maurer signed off the merge commit from her fork. The CVE-2026-42582 record that propagated to the GitHub Security Advisory Database and to NVD carries the description that matched her first finding, not her final patch. The advisory's "Affected" range correctly names every version up to and including 4.2.12.Final. The advisory's description correctly names one of three vulnerable functions.

A defender doing source-level remediation, hot-patching, or selective backport based on the advisory text will fix the one function the description names and leave the other two unpatched. The fix is in the patch, not in the description of the patch. The patch is the legal instrument; the advisory is the press release. The press release lists one of three because the indictment was filed before the investigation was complete.

PoC: advisories/GHSA-2c5c-chwr-9hqw

The patch counted to three. The advisory inherited the first finding.