NMS-20088: Fixed CVE-2026-6790 - #3
Open
christianpape wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jetty 9.4 accepted requests where the request-target authority and the Host header disagree, so one request carried two host identities:
request.getServerName()/getServerURL() resolved from the authority, while request.getHeader("Host") returned something else. It applies to two paths here:
never compares the two).
URI Host Mismatch with optional Compliance modes jetty/jetty.project#9343; that fix was never backported to 9.4, so this fork was vulnerable there too.
There is no HTTP/3 in 9.4, so that part of the advisory doesn't apply.
The fix
Rather than duplicating a check per protocol, it goes at the one choke point both paths pass through, Request.setMetaData() (jetty-server/src/main/java/org/eclipse/jetty/server/Request.java:1837) — the same place upstream chose for 10.x. Mismatches throw BadMessageException(400), which HttpChannelOverHTTP2.onRequest and the HTTP/1.1 channel both turn into a 400 response.
Matching normalizes the way upstream's 12.1 ComplianceUtils.authorityMatches does: case-insensitive, default port for the scheme treated as equivalent to an absent port, and an unparseable Host counted as a mismatch. Every Host field is checked, not just the first, so a second smuggled Host behind a matching one is also rejected.
Two supporting changes:
Tests
Two new classes, MismatchedAuthorityTest in jetty-server (14 tests, HTTP/1.1) and in jetty-http2/http2-client (8 tests, HTTP/2 end-to-end): rejection of mismatched host, mismatched port, garbage Host, and smuggled second Host; acceptance of matching authority, case differences, implied vs. explicit default port, IPv6, and no-Host; plus the RFC2616 opt-out. I verified they fail on the unpatched tree — 5 of 14 and 4 of 8 respectively — and pass with the fix.
Four existing suites asserted the old permissive behavior and were updated the way upstream did: RequestTest.testHostPort now expects 400 plus a matching-host case, NcsaRequestLogTest.testAbsolute uses a matching Host, and PartialRFC2616Test, ForwardedRequestCustomizerTest and the NIOHttp(s).xml integration configs select RFC2616.