HTTP/1 request-line HTTP-version boundary control bytes are silently normalized
Description
Agent tag: [codex-netty-ylchen-loop4]
HttpRequestDecoder strict-parses the third request-line token through HttpVersion.valueOf(initialLine[2], true). That strict path still trims the token before validating it. Java String.trim() removes boundary characters with code points <= 0x20, including NUL and other C0 controls.
As a result, this malformed request-line is accepted as a clean HTTP/1.1 request:
GET / \x00HTTP/1.1\r\n
Host: example.com\r\n
\r\nThe local PoV shows current 4.2 and 4.1 heads parse it with decoderResult().isSuccess() == true and protocolVersion() == HTTP/1.1. The same current-head PoV also shows adjacent boundaries are already treated as invalid: GET\x00 / HTTP/1.1 and GET / HTTP/1.1\x00 fail. The remaining gap is specific to leading control bytes inside the HTTP-version token.
Technical Details
Current HttpRequestDecoder does strict version checking:
HttpVersion.valueOf(initialLine[2], true)HttpVersion.valueOf(String text, boolean strict) trims before strict validation:
text = text.trim();The constructor used for non-fast-path strict values also calls checkNonEmptyAfterTrim(text, "text") before applying the strict HTTP/[digit].[digit] format check.
This means a wire-level token like \x00HTTP/1.1 becomes HTTP/1.1 before strict validation sees it.
PoC
Copy pov/HttpVersionBoundaryControlPovTest.java into:
codec-http/src/test/java/io/netty/handler/codec/http/HttpVersionBoundaryControlPovTest.javaRun:
./mvnw -pl codec-http -am -Dtest=HttpVersionBoundaryControlPovTest -Dsurefire.failIfNoSpecifiedTests=false testObserved on current 4.2 head and current 4.1 head:
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0The vulnerable expectations in that PoV are:
- clean
GET / HTTP/1.1succeeds; - strict
HttpVersion.valueOf("\x00HTTP/1.1", true)returnsHTTP/1.1; GET / \x00HTTP/1.1succeeds asHTTP/1.1;GET\x00 / HTTP/1.1fails on current heads;GET / HTTP/1.1\x00fails.
Released-artifact sweep:
version clean leading_nul_version nul_in_method trailing_nul_version
4.1.132.Final accepts accepts accepts rejects
4.1.134.Final accepts accepts accepts rejects
4.1.135.Final accepts accepts accepts rejects
4.2.13.Final accepts accepts accepts rejects
4.2.14.Final accepts accepts accepts rejects
4.2.15.Final accepts accepts accepts rejectsThe released-artifact method control is weaker because the public release artifacts tested here still normalize GET\x00; current branch heads include the newer method-boundary hardening, which makes the HTTP-version sibling clearer.
Affected Package/Versions
- Repository:
netty/netty - Package:
io.netty:netty-codec-http - Component:
codec-http - Primary class:
io.netty.handler.codec.http.HttpVersion - Decoder callsite:
io.netty.handler.codec.http.HttpRequestDecoder
Confirmed affected:
- current
4.2head7bae566a93e69409697fe57fa807910ba5c9720e - current
4.1head465c9e6e477ef89f28a4d52b0ae3dd5bb2c086e0 - released artifacts
4.2.15.Final,4.2.14.Final,4.2.13.Final - released artifacts
4.1.135.Final,4.1.134.Final,4.1.132.Final
No patched version is known from local testing. Maintainers should confirm the introducing lower bound.
Recommended Fix
patches/minimal-fix-sketch.diff changes strict HTTP-version parsing so it does not trim before validation. It preserves non-strict public API trimming.
With the patched control, the same five-test PoV passes with the leading HTTP-version NUL case changed to expect rejection:
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0Security Impact
This is an HTTP parser differential in a request-line security boundary. A front-end, gateway, WAF, or backend that treats \x00HTTP/1.1 as malformed can disagree with a Netty hop that silently normalizes the version token and processes the request as ordinary HTTP/1.1. That can undermine front-end request validation or routing decisions in deployments where malformed request-line bytes are forwarded to Netty.
This is not memory corruption and no confidentiality impact was identified. The concrete impact is integrity of HTTP request interpretation.
Suggested Severity
- Severity: Moderate
- CVSS v3.1:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N - Score: 5.3
- CWE:
CWE-444
This follows the same impact shape and CVSS vector as CVE-2026-50020: a remotely reachable HTTP request interpretation issue with low integrity impact and no identified confidentiality or availability impact.