Repository navigation
fix: resolve TLS error decoding message for ECH extension - #429
Open
AdamMagued wants to merge 1 commit into
Open
AdamMagued wants to merge 1 commit into
AdamMagued wants to merge 1 commit into
Conversation
Replace the placeholder CustomECHExtension with utls.BoringGREASEECH for extension 0xfe0d, and omit it when disableGrease is active. Update TLS 1.3 KeyShareExtension to provide X25519MLKEM768 alongside X25519, matching the order in SupportedCurvesExtension and preventing server HelloRetryRequest failures. Add comprehensive unit tests verifying handshake, ECH extension generation, and curve order. Signed-off-by: Adam Magued <adamismailmageud@gmail.com>
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.
Summary
Fixes #409
This change resolves the TLS handshake failure
uTlsConn.Handshake() error: remote error: tls: error decoding messagethat occurs when JA4r fingerprints include extension0xfe0d(Encrypted Client Hello / ECH).Root Cause
cycletls/extensions.go, extension ID0xfe0dwas handled byNewCustomECHExtension, which emitted 8 dummy zero bytes. According to the draft-ietf-tls-esni and RFC specifications, malformed ECH extension payloads cause compliant TLS 1.3 servers to abort the handshake with alert 50 (decode_error).0x000a(SupportedGroups) prependedutls.X25519MLKEM768in TLS 1.3, but extension0x0033(KeyShare) only advertised classicalX25519andCurveP256. When post-quantum-aware servers received this configuration, they issued a HelloRetryRequest selectingX25519MLKEM768. Because uTLS does not support dynamic generation of hybrid KEM keys during HelloRetryRequest, this produced a client-sideCurvePreferences includes unsupported curvehandshake error.Key Changes
CustomECHExtensionwithutls.BoringGREASEECH(), matching Chrome's standard GREASE ECH extension format.disableGreasefor extension0xfe0d: when GREASE is disabled, extension0xfe0dis omitted (nil).CustomECHExtensionand constructorNewCustomECHExtension.KeyShareExtensionto advertise bothutls.X25519MLKEM768andutls.X25519, matchingModernChromeSpecand preventing unhandled HelloRetryRequest rounds.cycletls/tests/unit/issue409_test.gocovering end-to-end TLS 1.3 handshake with JA4r, ECH generation with GREASE toggling, and curve/key share verification.Verification
go test -v -count=1 ./tests/unit/...passed.go test -count=1 ./tests/...passed.