The function's name was the question. The question was the wrong one.
io.netty.handler.codec.http.HttpUtil defines the predicate the HTTP/1 decoder leans on to decide whether a request body is chunk-framed:
public static boolean isTransferEncodingChunked(HttpMessage message) {
return message.headers().containsValue(
HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED, true);
}
containsValue in HttpHeaders is not equality. It splits each header value on commas and asks whether any trimmed token matches:
public boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase) {
Iterator<? extends CharSequence> itr = valueCharSequenceIterator(name);
while (itr.hasNext()) {
if (containsCommaSeparatedTrimmed(itr.next(), value, ignoreCase)) {
return true;
}
}
return false;
}
containsCommaSeparatedTrimmed walks each comma-delimited segment, trims optional whitespace, and tests case-insensitive equality. For Transfer-Encoding: chunked, identity it splits into [chunked, identity], compares the first token to chunked, returns true. For Transfer-Encoding: gzip, chunked it does the same. For Transfer-Encoding: identity, chunked, gzip it does the same. The predicate's grain is set membership. Order does not enter it.
HttpObjectDecoder.readHeaders0 then used that predicate as the only check before flipping the body parser into chunked mode:
if (HttpUtil.isTransferEncodingChunked(message)) {
this.chunked = true;
if (!contentLengthFields.isEmpty() && message.protocolVersion() == HttpVersion.HTTP_1_1) {
handleTransferEncodingChunkedWithContentLength(message);
}
return State.READ_CHUNK_SIZE;
}
The return value is State.READ_CHUNK_SIZE. The decoder begins reading the body as a sequence of hex-size CRLF data CRLF chunks terminated by a zero-size chunk. The framing decision has been made.
What RFC 9112 §6.1 actually says
The standard's text is short. Quoting it whole because the precision is the point:
If a Transfer-Encoding header field is present in a request and the chunked transfer coding is not the final encoding, the message body length cannot be determined reliably; the server MUST respond with the 400 (Bad Request) status code and then close the connection.
There is no "MAY" in that sentence. The server is not invited to accept the message under any chunk-framing inference. The server is told to refuse it.
This text has been in HTTP/1.1's framing rules in some form since RFC 7230. RFC 9112 (June 2022) made the wording more emphatic. The reason it is in there at all is that any HTTP intermediary will choose a body length somehow: ignore chunked because it is not last, fall back to Content-Length, treat the request as terminated at the headers, or pass it on. Two intermediaries that choose differently produce desync. Desync is HTTP request smuggling.
Netty was a server in this sentence. Netty did not respond 400. Netty entered chunked-reading mode.
What a smuggling chain looks like
The vulnerable scenario lives at the seam between a front-end proxy and a Netty backend. The proxy and the backend make different framing decisions because they read different bytes from the same header.
A reasonable proxy reading Transfer-Encoding: chunked, identity follows the standard, considers chunked-not-last to be malformed, declines to treat the message as chunked, and falls back on Content-Length: <n>. Many production proxies do exactly that. Some proxies, faced with an unknown final coding identity, strip the token they do not recognise, forward Transfer-Encoding: chunked to the backend, and pass through the Content-Length header alongside it. Some proxies strip the entire Transfer-Encoding header when it does not match chunked exactly, and forward only Content-Length. Each of those proxy behaviours is documented and shipping.
Netty, pre-patch, reads Transfer-Encoding: chunked, identity and frames the body as chunked. Whatever the proxy did with Content-Length is invisible at this point. The decoder consumes bytes until it sees a 0\r\n\r\n terminator and treats everything after as the start of the next request.
The advisory's published test case is a single TCP write that the proxy reads as one POST with a 1-byte body, and Netty reads as a chunked POST followed by a smuggled GET:
POST / HTTP/1.1
Host: target.example
Transfer-Encoding: chunked, identity
Content-Length: 65
0
GET /admin/users HTTP/1.1
Host: target.example
Connection: close
The proxy honours Content-Length: 65, forwards 65 bytes of body, considers the request complete. To the proxy, the smuggled GET /admin/users is the next request on the connection and inherits the previous client's authentication, IP allowlist, mTLS identity, and rate-limit bucket. Netty honours Transfer-Encoding: chunked, reads 0\r\n\r\n, considers the body complete, and treats the bytes after as a fresh request on the same connection. The two systems agree that there are two requests on the wire. They disagree about where the first one ends. That disagreement is the primitive.
Every HTTP/1.1 smuggling attack reduces to this disagreement. The vulnerable input is whatever pair of bytes the proxy and the backend disambiguate differently. Here the bytes are the seven that spell , identity after chunked.
The patch checks the last value's tail
The fix in commit 485f11d322 adds twenty-three lines to readHeaders0:
if (HttpUtil.isTransferEncodingChunked(message)) {
this.chunked = true;
- if (!contentLengthFields.isEmpty() && message.protocolVersion() == HttpVersion.HTTP_1_1) {
- handleTransferEncodingChunkedWithContentLength(message);
+ if (message.protocolVersion() == HttpVersion.HTTP_1_1) {
+ Iterator<? extends CharSequence> encodingIt =
+ message.headers().valueCharSequenceIterator(HttpHeaderNames.TRANSFER_ENCODING);
+ // Validate that chunked is the last encoding.
+ CharSequence v = null;
+ while (encodingIt.hasNext()) {
+ v = encodingIt.next();
+ }
+ final int vLen = v.length();
+ final int chunkedValueLength = HttpHeaderValues.CHUNKED.length();
+ if (vLen > chunkedValueLength && !AsciiString.regionMatches(v, true, vLen - chunkedValueLength,
+ HttpHeaderValues.CHUNKED, 0, chunkedValueLength)) {
+ throw new IllegalArgumentException(
+ "chunked must be the last encoding present in the Transfer-Encoding header");
+ }
+ if (!contentLengthFields.isEmpty()) {
+ handleTransferEncodingChunkedWithContentLength(message);
+ }
}
return State.READ_CHUNK_SIZE;
}
The new logic iterates header values, takes the last one, and checks whether its tail spells chunked. If the tail does not match, the decoder throws. That is the entire fix.
The test case that has to pass is the one Georgieva wrote:
@Test
public void testChunkedNotLastInTransferEncoding() {
String requestStr = "GET /some/path HTTP/1.1\r\n" +
"Transfer-Encoding: chunked, identity\r\n" +
"Content-Length: 1\r\n" +
"Host: netty.io\r\n\r\n" +
"a";
testInvalidHeaders0(requestStr);
}
Two things to read out of that test. First, the request the patch refuses is exactly the request the pre-patch code accepted. Second, the test asserts that the message is rejected with an invalid-headers error, which surfaces in the HTTP/1 decoder as a DecoderException. There is no graceful 400 from Netty itself; the connection-level decoder fails. Whatever sits above Netty in the application has to translate that failure into a 400 response and close the connection. The standard's "MUST respond 400 and close" obligation is split: Netty rejects the message, the framework must respond.
The shape of the check is also worth naming. It compares the last seven bytes of the last header value against the literal chunked using AsciiString.regionMatches. It does not parse the comma-separated list. It does not enumerate inner tokens. It trusts that if the value ends with chunked, chunked is last. That trust holds for well-formed values; it does not hold under all whitespace combinations the grammar allows. Transfer-Encoding: chunked, identity, chunked ends in chunked and is accepted, even though chunked appears twice and only the second occurrence is final. That construction is also forbidden by RFC 9112 §6.1's "MUST NOT be applied more than once" clause, and Netty's new check does not enforce that clause either. The check answers the narrow question it was given.
Five smuggling-class fixes in one release
The same release that closed CVE-2026-42585 closed four other things in Netty's HTTP/1 codec:
| Fix |
What it closed |
| CVE-2026-42585 (this post) |
Transfer-Encoding: chunked, identity enters chunked-reading mode |
| CVE-2026-42580 |
The chunk-size parser does result *= 16; result += digit in int and only rejects negatives; a value like 100000004 overflows positively and the consumed-length disagrees with the on-wire size |
GHSA-57rv-r2g8-2cj3 (HttpClientCodec response desync) |
The client's request queue was polled before checking whether the response was 1xx Informational; the wrong outbound request was paired with subsequent responses |
Commit 6eea1bc7ef |
DefaultHttpRequest.setUri() was not running the URI validator that DefaultHttpRequest's constructor was running, so the December 2025 CRLF-injection fix (CVE-2025-67735) was bypassable by calling setUri() instead |
Commit d2475645d8 |
The default behaviour when a message carried both Transfer-Encoding: chunked and Content-Length flipped from "silently remove Content-Length" (RFC 7230 era) to "throw ContentLengthNotAllowedException" (RFC 9112 era); the old behaviour is still available behind setUseRfc9112TransferEncoding(false) |
Three of those are HTTP request smuggling under CWE-444. One is a response-side desync that is the dual of smuggling. One is a hardening of the canonical TE+CL case that has produced CVEs in every HTTP/1.1 parser ever shipped. They were all developed in private and merged the same day as Merge commit from fork entries on Netty's 4.1 branch, batched into 4.1.133.Final and 4.2.13.Final.
Five smuggling-class fixes in one release is not a coincidence. It is what happens when a project pulls a coordinated cross-research effort against a single component over months and ships the results together. The catalog calls this shape design-debt-driver: a component whose bug class keeps recurring not because the maintainers are sloppy, but because the design substrate the component lives on continues to produce the same primitive. HTTP/1.1 message framing is that substrate. The 1999 RFC was ambiguous, the 2014 RFC tightened the language, the 2022 RFC tightened it further. Every HTTP/1.1 parser ever shipped has fixed a smuggling bug. Netty has fixed more than most because Netty is what the JVM ecosystem reaches for when it needs HTTP/1: Spring WebFlux through Reactor Netty, Vert.x, Play, gRPC-Java, Elasticsearch's transport, every framework whose transitive netty-codec-http pin moves only when somebody notices.
The 4.1.134.Final release is dated nine days after 4.1.133.Final. It does not yet carry a smuggling fix. That is the longest such interval in the last six months.
PoC and references:
Netty asked whether chunked was present. The standard asked whether chunked was last.