Repository navigation
Port 4.1: Bound the SNI host name by the server_name extension (#18121) - #18448
Merged
Merged
Conversation
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]>
✅ All tests passed ✅🏷️ Commit: de1d255 Learn more about TestLens at testlens.app/docs. |
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.
Motivation:
AbstractSniHandler.extractSniHostname(...)bounds thehost_namelength byextensionsLimit, the end of all extensions, not by the end of theserver_nameextension. RFC 6066 requires theServerNameListto fill the extension data. As a result ahost_namecould be read from the following extension(s), theserver_name_listlength was never checked, and an emptyhost_namewas returned as"".Modification:
server_nameextension.server_name_listlength to match the extension data.host_name.Result:
Only host names contained in the
server_nameextension are returned; malformedserver_nameextensions cause the handshake to fail closed.(cherry picked from commit 20dd973)