Fix ECH payload size varying per-connection instead of per-process#2
Draft
Copilot wants to merge 2 commits into
Draft
Fix ECH payload size varying per-connection instead of per-process#2Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Agent-Logs-Url: https://github.com/chipitsine/td/sessions/728c1c97-9113-4e00-a90d-e5fd9df19daf Co-authored-by: chipitsine <2217296+chipitsine@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix possible DPI bypass detection issue
Fix ECH payload size varying per-connection instead of per-process
Apr 5, 2026
There was a problem hiding this comment.
Pull request overview
This PR removes a per-process fingerprint in FakeTLS ECH GREASE generation by making the ECH payload length vary per connection (matching Chrome’s per-connection variability) instead of being fixed at static initialization time.
Changes:
- Added a new
TlsHello::Op::Type::EchPayloadoperation to represent ECH GREASE payload generation without embedding a static length. - Introduced per-connection
ech_payload_size_inTlsHelloContext, computed in the context constructor. - Updated
TlsHelloCalcLengthandTlsHelloStoreto size and fillEchPayloadusingTlsHelloContext::get_ech_payload_size().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
FakeTLS ECH GREASE payload size was determined once at static initialization, making it identical across all connections within a process lifetime — a detectable fingerprint distinguishing it from real Chrome behavior.
Root Cause
Op::ech_payload()computedRandom::fast(0, 3) * 32 + 144duringTlsHello::get_default()'s static initializer, locking the ECH payload size (144/176/208/240 bytes) for the entire process.Fix
Introduces a dedicated
EchPayloadOp type whose size is drawn fromTlsHelloContext, which is constructed fresh per-connection:EchPayloadtoTlsHello::Op::TypeenumOp::ech_payload()now returnsType::EchPayloadwith no embedded lengthTlsHelloContextstoresech_payload_size_computed in its constructor (i.e., once per connection)TlsHelloCalcLengthandTlsHelloStorequerycontext->get_ech_payload_size()when handlingEchPayloadops