-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## `Character.isISOControl` is the wrong predicate for \"empty CRLF line\"\n\n`HttpObjectDecoder`'s state machine starts in `SKIP_CONTROL_CHARS`. The `LineParser.skipControlChars` method walks the buffer looking for the first byte that is neither a control character nor whitespace, using a `ByteProcessor` whose body is one line:\n\n```java\nprivate static final ByteProcessor SKIP_CONTROL_CHARS_BYTES = new ByteProcessor() {\n @Override\n public boolean process(byte value) {\n return ISO_CONTROL_OR_WHITESPACE[128 + value];\n }\n};\n```\n\n`ISO_CONTROL_OR_WHITESPACE` is a precomputed 256-entry boolean lookup table:\n\n```java\nprivate static final boolean[] ISO_CONTROL_OR_WHITESPACE;\n\nstatic {\n ISO_CONTROL_OR_WHITESPACE = new boolean[256];\n for (byte b = Byte.MIN_VALUE; b < Byte.MAX_VALUE; b++) {\n ISO_CONTROL_OR_WHITESPACE[128 + b] = Character.isISOControl(b) || isWhitespace(b);\n }\n}\n```\n\n`Character.isISOControl(int)` returns true for codepoints `0x00` through `0x1F` and `0x7F` through `0x9F`. `Character.isWhitespace` on byte-widened ints adds `0x20`. Java's signed `byte` plus the loop's exclusive upper bound (`b < Byte.MAX_VALUE` rather than `<=`) mean the table is set true at indices `128` through `160` and nowhere else. Translated back through the `128 + value` lookup, the bytes the decoder skips are `0x00` through `0x20` inclusive, thirty-three byte values. `0x7F` is excluded by the loop's off-by-one: index `255` is never written. The published GitHub advisory lists `0x7F` as a skipped byte. The code does not skip it. The advisory describes the predicate the developer thought they wrote.\n\nRFC 9112 §2.2: *\"In the interest of robustness, a server that is expecting to receive and parse a request-line SHOULD ignore at least one empty line (CRLF) received prior to the request-line.\"* The clause is a robustness allowance for HTTP/1.0 clients that posted a body with a trailing CRLF. It names one byte sequence, CR LF, and constrains the sequence to form an empty line. NUL is not an empty line. SOH is not an empty line. SPACE is not an empty line.\n\nThirty-three accepted bytes. Two named by the RFC. The other thirty-one are the smuggling surface.\n\n## NUL is the smuggle byte the advisory does not name\n\nCWE-444 is HTTP Request/Response Smuggling. The threat model is a parser-differential pair: a front-end proxy (HAProxy, nginx, an L7 load balancer) and a back-end server (Netty) sharing a TCP connection, disagreeing on where one request ends and the next begins.\n\nThe smuggle, against pre-patch Netty, is one byte longer than the advisory's threat model description:\n\n```\nPOST / HTTP/1.1\\r\\n\nHost: target.example.com\\r\\n\nContent-Length: 39\\r\\n\n\\r\\n\n\\x00GET /internal/admin HTTP/1.1\\r\\n\nHost: target.example.com\\r\\n\n\\r\\n\n```\n\nThe front-end reads the POST. `Content-Length: 39` matches the thirty-nine bytes that begin with `\\x00` and end with the second `\\r\\n\\r\\n`. The proxy forwards the headers and the body to the upstream connection, treating the request as complete. By the proxy's accounting one request crossed the boundary.\n\nNetty reads the POST, consumes the thirty-nine-byte body, then re-enters `SKIP_CONTROL_CHARS` to look for the next request on the keepalive connection. The first byte on the wire is `\\x00`. `ISO_CONTROL_OR_WHITESPACE[128 + 0]` is `true`. The decoder advances past it. The next bytes spell `GET /internal/admin HTTP/1.1`. Netty parses a second request whose `Host` and target the proxy never authorized, never logged, and never rate-limited. The proxy's access log records one POST. Netty's logs record one POST and one GET.\n\nThe proxy did not have to be misconfigured. It only had to use `Content-Length` to delineate the request body the way every HTTP/1.1 proxy does, and to forward the body bytes verbatim. The smuggle byte does not have to be NUL. SOH, STX, ETX, BS, VT, FF, SO, SI, DLE, DC1, DC2, DC3, DC4, NAK, SYN, ETB, CAN, EM, SUB, ESC, FS, GS, RS, US, and SPACE all reach the same `forEachByte` walk and all return `true` from the same lookup. Pre-patch Netty has no opinion on which of the thirty-one not-named-by-RFC bytes prefixed the smuggled request. Any of them is the front of a chain.\n\n## The patch did not change the bytes. It changed which knob decides.\n\nCommit `aa0cae5a91`, June 1, 2026, \"HttpObjectDecoder skips arbitrary initial control characters when only initial CRLF characters are permitted.\" The diff renames the entry state from `SKIP_CONTROL_CHARS` to `SKIP_INITIAL_LINE_CHARS`, rewrites `skipControlChars` as `skipLineChars`, and adds a `Runnable strictCRLFCheck` parameter:\n\n```diff\n- private boolean skipControlChars(ByteBuf buffer, int readableBytes, int readerIndex) {\n- assert currentState == State.SKIP_CONTROL_CHARS;\n+ private boolean skipLineChars(ByteBuf buffer, int readableBytes, int readerIndex, Runnable strictCRLFCheck) {\n+ assert currentState == State.SKIP_INITIAL_LINE_CHARS;\n final int maxToSkip = Math.min(maxLength, readableBytes);\n- final int firstNonControlIndex = buffer.forEachByte(readerIndex, maxToSkip, SKIP_CONTROL_CHARS_BYTES);\n- if (firstNonControlIndex == -1) {\n+ final int firstNonLineIndex = buffer.forEachByte(readerIndex, maxToSkip,\n+ strictCRLFCheck == null ? SKIP_CONTROL_CHARS_BYTES : ByteProcessor.FIND_NON_CRLF);\n+ if (firstNonLineIndex == -1) {\n buffer.skipBytes(maxToSkip);\n ...\n return true;\n }\n+ if (strictCRLFCheck != null) {\n+ final int b = buffer.getByte(firstNonLineIndex) & 0xFF;\n+ if (Character.isISOControl(b)) {\n+ strictCRLFCheck.run();\n+ }\n+ }\n```\n\n`strictCRLFCheck` is `THROW_INVALID_LINE_SEPARATOR`, a `Runnable` that throws `InvalidLineSeparatorException`. It is set on the decoder if and only if `HttpDecoderConfig.isStrictLineParsing()` returns true. The default value of `strictLineParsing` is `true`. A fresh `HttpRequestDecoder()` constructed against the default config in 4.1.135 or 4.2.15 refuses a leading NUL byte and the smuggling primitive is closed.\n\nThe unsafe predicate is still in the source. The ternary `strictCRLFCheck == null ? SKIP_CONTROL_CHARS_BYTES : ByteProcessor.FIND_NON_CRLF` calls out exactly the condition that keeps the lookup table reachable. When an operator wires `new HttpDecoderConfig().setStrictLineParsing(false)`, or runs the JVM with `-Dio.netty.handler.codec.http.defaultStrictLineParsing=false` (a system property the same maintainer added in the September 2025 commit specifically to give legacy users an opt-out), the patched code path constructs no `strictCRLFCheck`, walks the buffer with `SKIP_CONTROL_CHARS_BYTES`, and skips the same thirty-one not-named-by-RFC bytes the pre-patch code did. The NUL-prefix smuggle still works against a 4.1.135 server that opted out.\n\nThis is the **Safe Mode Was Opt In** shape applied in reverse. The patch removes the primitive from the default. It does not remove the primitive from the codebase. The bytes are still in the lookup table. The lookup table is still wired to the same `ByteProcessor`. The `ByteProcessor` is still called from `forEachByte`. The configuration flag is the gate, and the unsafe path is one `setStrictLineParsing(false)` away from any operator who set it a year ago for legacy-client compatibility and never revisited the call site.\n\n## `strictLineParsing` has been expanded twice in nine months\n\nThe flag was not coined for CVE-2026-50020. Commit `edb55fd8e0`, September 3, 2025, \"Merge commit from fork (#15611)\", motivation:\n\n> Transfer-Encoding: chunked has some strict rules around parsing CR LF delimiters. If we are too lenient, it can cause request/response smuggling issues when combined with proxies that are lenient in different ways. See https://w4ke.info/2025/06/18/funky-chunks.html for the details.\n\nThat commit introduced `strictLineParsing` and `THROW_INVALID_LINE_SEPARATOR`, made strict CR LF the default for chunk extensions and header line separators, and shipped the system property opt-out. The fix scope was lone-LF acceptance in header lines and chunk extensions. The June 2025 funky-chunks writeup the commit references is a parser-differential smuggling analysis of `Transfer-Encoding: chunked`.\n\nNine months later, the June 1, 2026 commit's motivation reads:\n\n> RFC 9112 permit empty lines (CR LF sequences) prior to the request line, but we were skipping over any ISO control characters. This is parsing leniency beyond what the standard mandates and can be a security liability.\n\nThe June 2026 commit borrows the September 2025 commit's framing. The mechanism is the same. A parser leniency in `HttpObjectDecoder` was paired with a downstream proxy that disagreed about which bytes count as message boundaries. The fix was to expand `strictLineParsing` to cover the new code path, make the strict behavior the default, and keep the lenient code reachable through configuration.\n\nBoth commits were authored by [Norman Maurer](https://github.com/normanmaurer), Netty's lead maintainer. Both add a state transition to the same `LineParser`. Both reference the same `THROW_INVALID_LINE_SEPARATOR` runnable. Both leave the unsafe code path in the file. The September 2025 commit's title says \"Enforce CR LF line separators for HTTP messages by default.\" The June 2026 commit's diff comment says \"Additionally, Netty will enforce that only CR LF characters precede the initial line, if any.\" The word the second commit adds is \"Additionally.\"\n\nThis is the design-debt-driver shape. The substrate is the parser leniency the file was written to provide. Every byte-level leniency `HttpObjectDecoder` ships is a candidate to be paired with a downstream proxy that disagrees, and every such pairing becomes a smuggling primitive. The September 2025 patch and the June 2026 patch are the same fix shape, by the same maintainer, with the same flag. The count of `strictLineParsing` expansions, after nine months, is two.\n\nThe pattern repeats in the same component because the component is a parser written to be lenient. Lenient parsers paired with strict proxies are smuggling primitives by construction. There is no reason to assume the count is two forever; `HttpObjectDecoder` has 1,400 lines of parsing leniencies, and `strictLineParsing` currently gates three of them. The next CVE in this file is the next leniency a proxy author disagrees with.\n\n## The predicate is sixteen years old\n\nThe skip routine carrying `Character.isISOControl(c) || Character.isWhitespace(c)` has been in this codec since at least February 19, 2010. In commit `de8671df93` (the import that initialized the JBoss-Netty codebase under its Apache 2.0 license header), `org.jboss.netty.handler.codec.http.HttpMessageDecoder` carries this method:\n\n```java\nprivate void skipControlCharacters(ChannelBuffer buffer) {\n for (;;) {\n char c = (char) buffer.readUnsignedByte();\n if (!Character.isISOControl(c) &&\n !Character.isWhitespace(c)) {\n buffer.readerIndex(buffer.readerIndex() - 1);\n break;\n }\n }\n}\n```\n\nThe 2010 version reads `readUnsignedByte()` and casts to `char`, which means `0x7F` (DEL) passes `Character.isISOControl` and is skipped. The predicate moved into `io.netty.handler.codec.http.HttpObjectDecoder` during the Netty 4 transition. It was refactored in March 2020 (commit `0fb58d3c54`, \"HttpObjectDecoder should limit the number of control chars\") to bound the byte count against `maxInitialLineLength`. The 2020 motivation was a denial-of-service concern about unbounded skipping; the predicate was not the subject. The refactor moved the predicate into the precomputed `ISO_CONTROL_OR_WHITESPACE` lookup table that the 2026 patch did not modify, and introduced the `b < Byte.MAX_VALUE` off-by-one that silently dropped `0x7F` from the skipped set.\n\nSixteen years and four months. The 2010 method, the 2020 refactor, the 2025 chunk-smuggle fix, and the 2026 prefix-skip fix were all authored by the same maintainer. The `strictLineParsing` flag, the `THROW_INVALID_LINE_SEPARATOR` runnable, and the system-property opt-out are all in one person's commit history. The pattern is not adversarial. The component is fertile.\n\nNetty is the substrate underneath Reactor Netty, Spring WebFlux, Vert.x, gRPC-Java, Cassandra's client driver, Elasticsearch's transport, Kafka's network layer, and effectively every modern JVM HTTP framework. Every operator who runs Netty 4.1.0 through 4.1.134 or 4.2.0 through 4.2.14 behind a proxy is in the affected set. Every operator who runs 4.1.135 or 4.2.15 with `setStrictLineParsing(false)` in their stack, set by a vendor a year ago for compatibility with a legacy client that posted lone-LF separators, remains in the affected set.\n\nThe PoC on the GHSA is the patched regression test:\n\n```java\nByteBuf buf = Unpooled.buffer();\nbuf.writeByte(0x00); // NUL, not an empty CRLF line\nbuf.writeByte(0x01); // SOH, not an empty CRLF line\nbuf.writeCharSequence(\n \"GET / HTTP/1.1\\r\\nHost: example.com\\r\\n\\r\\n\",\n CharsetUtil.US_ASCII);\nchannel.writeInbound(buf);\nHttpRequest req = channel.readInbound();\nassertTrue(req.decoderResult().isFailure(),\n \"Non-CRLF control bytes before the request-line must not be silently skipped\");\n```\n\nTwo bytes. NUL and SOH. The maintainer wrote the regression test the same week he wrote the patch. The advisory's \"Silently absorbing NUL bytes, SOH, STX, and other non-CRLF control characters\" wording is the test case as English. The bytes were in the file for sixteen years before someone wrote them down.\n\nPoC: [GHSA-hvcg-qmg6-jm4c](https://github.com/advisories/GHSA-hvcg-qmg6-jm4c)","closing_line":"`strictLineParsing` is the name of a substrate. It will be expanded again.","hook_md":"Netty's `HttpObjectDecoder` skipped every byte for which `Character.isISOControl(b)` was true before reading the request line. The predicate covers `0x00` through `0x1F`. Add `Character.isWhitespace(b)` and you also get `0x20`. That is thirty-three byte values silently consumed before the parser looks at the request line. RFC 9112 §2.2 asks servers to ignore one empty CRLF line preceding the request line, two byte values, paired. CVE-2026-50020 published June 12, 2026 with CVSS 5.3 and CWE-444 HTTP Request Smuggling. The `Character.isISOControl(c) || Character.isWhitespace(c)` predicate has been in this file since February 2010, sixteen years and four months. The June 1, 2026 patch is the second expansion of a configuration flag named `strictLineParsing` in `HttpObjectDecoder.java` in nine months. The first expansion, September 3, 2025, closed a chunked-transfer smuggling primitive in the same decoder. This one closes the leading-control-byte smuggling primitive. Both expansions were authored by the same maintainer, change the default in the safe direction, and leave the unsafe code path reachable through `setStrictLineParsing(false)`.","post_id":648,"slug":"netty-cve-2026-50020-second-strictlineparsing-expansion-in-nine-months","title":"CVE-2026-50020: Netty Expanded `strictLineParsing` Again. Same Flag, Same Decoder, Nine Months.","type":"initial","unreadable_sentence":"RFC 9112 named one byte pair. The decoder skipped thirty-three."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCauuJoAAKCRDeZjl4jgkQ JnAhAQDiCG0Cqp1RzgiGKcU5fPkG7xwEv9aKwgNsgHRuN4E5QQEAu3ucdVz7wrsJ ApTOupIsGMonT8lqhvBq1aAjMF2imAg= =hWsv -----END PGP SIGNATURE-----