Skip to content

Port 4.1: Bound the SNI host name by the server_name extension (#18121) - #18448

Merged
chrisvest merged 1 commit into
netty:4.1from
chrisvest:4.1-port-pr-18121
Nov 18, 2026
Merged

chrisvest merged 1 commit into
netty:4.1from
chrisvest:4.1-port-pr-18121

Conversation

@chrisvest

Copy link
Copy Markdown
Member

Motivation:

AbstractSniHandler.extractSniHostname(...) bounds the host_name length by extensionsLimit, the end of all extensions, not by the end of the server_name extension. RFC 6066 requires the ServerNameList to fill the extension data. As a result a host_name could be read from the following extension(s), the server_name_list length was never checked, and an empty host_name was returned as "".

Modification:

  • Bound the SNI parse by the end of the server_name extension.
  • Require the server_name_list length to match the extension data.
  • Reject an empty host_name.
  • Throw NotSslRecordException for a malformed server_name extension and fail closed in SslClientHelloHandler instead of selecting the default.
  • Add tests.

Result:

Only host names contained in the server_name extension are returned; malformed server_name extensions cause the handshake to fail closed.

(cherry picked from commit 20dd973)

Motivation:

`AbstractSniHandler.extractSniHostname(...)` bounds the `host_name`
length by `extensionsLimit`, the end of all extensions, not by the end
of the `server_name` extension. RFC 6066 requires the `ServerNameList`
to fill the extension data. As a result a `host_name` could be read
from the following extension(s), the `server_name_list` length was
never checked, and an empty `host_name` was returned as `""`.

Modification:

- Bound the SNI parse by the end of the `server_name` extension.
- Require the `server_name_list` length to match the extension data.
- Reject an empty `host_name`.
- Throw NotSslRecordException for a malformed server_name extension and
  fail closed in SslClientHelloHandler instead of selecting the default.
- Add tests.

Result:

Only host names contained in the `server_name` extension are returned;
malformed `server_name` extensions cause the handshake to fail closed.

(cherry picked from commit 20dd973)

Co-authored-by: Norman Maurer <[email protected]>
@testlens-app

testlens-app Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: de1d255
▶️ Tests: 138185 executed
⚪️ Checks: 21/21 completed


Learn more about TestLens at testlens.app/docs.

@chrisvest
chrisvest merged commit d24cb13 into netty:4.1 Nov 18, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant