Fix Fake-TLS (EE mode) rejected when domain option specified#24
Merged
dvershinin merged 5 commits intomasterfrom Dec 28, 2025
Merged
Fix Fake-TLS (EE mode) rejected when domain option specified#24dvershinin merged 5 commits intomasterfrom
dvershinin merged 5 commits intomasterfrom
Conversation
Remove incorrect check that was rejecting 0xeeeeeeee tag when allow_only_tls flag is set. This allows EE mode (Fake-TLS + Padding) to work properly when -D domain option is specified. Co-authored-by: dvershinin <250071+dvershinin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Fake-TLS not working issue
Fix Fake-TLS (EE mode) rejected when domain option specified
Dec 28, 2025
|
@copilot why remove the validation entirely? Perhaps just relaxing it a bit is a better approach. |
Instead of removing validation entirely, now properly validates that when -D (Fake-TLS) option is used: - DD mode (0xdddddddd - random padding only) is rejected - EE mode (0xeeeeeeee - Fake-TLS + Padding) is allowed - EF mode (0xefefefef - Fake-TLS compact) is allowed This maintains proper security validation while fixing the original bug. Co-authored-by: dvershinin <250071+dvershinin@users.noreply.github.com>
Author
You're right. I've refined the validation instead of removing it entirely. The new check inverts the logic to properly reject DD mode (random padding only) when |
Co-authored-by: dvershinin <250071+dvershinin@users.noreply.github.com>
Co-authored-by: dvershinin <250071+dvershinin@users.noreply.github.com>
dvershinin
approved these changes
Dec 28, 2025
|
@copilot still not working, still same behavior as in https://github.com/user-attachments/files/24359663/mtproto-verbose.log |
|
@copilot hello |
This was referenced Dec 28, 2025
Copilot AI
added a commit
that referenced
this pull request
Dec 28, 2025
This fix reverts the problematic changes from PR #24 and PR #25 that broke Fake-TLS connections: 1. Revert TLS ClientHello detection to original pattern: The change in PR #25 incorrectly checked the length byte instead of TLS version, which could cause detection failures. 2. Remove the tag validation check that was incorrectly rejecting EE/EF modes: - For Fake-TLS connections (C_IS_TLS set), any valid tag should be accepted - For non-TLS connections with allow_only_tls=1, connection is rejected earlier - This check was unnecessary and was causing EE mode to fail Fixes #23 Co-authored-by: dvershinin <250071+dvershinin@users.noreply.github.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.
When
-Ddomain option is used to enable Fake-TLS mode, connections using EE mode (tag0xeeeeeeee) were incorrectly rejected with "Expected random padding mode" error. This prevented the documented EE mode secret format (ee+ secret + domain_hex) from working.Changes
net/net-tcp-rpc-ext-server.c(lines 1318-1321) to properly allow EE/EF modes and reject DD mode whenallow_only_tlsflag is setThe original buggy check was:
This incorrectly rejected EE/EF modes (Fake-TLS) and only allowed DD mode (random padding only) when
-Dwas used.The fixed validation is:
This properly rejects DD mode and allows EE/EF modes when
-Dis specified, maintaining security validation while fixing the bug.Behavior
When
-Doption is used:The logic correctly separates two orthogonal concerns:
-Doption setsallow_only_tlsto enforce Fake-TLS transport modes (EE/EF)-Roption setsext_rand_pad_onlyto restrict to DD mode onlyOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.