Increase REALITY target TLS record buffer to 16 KiB#33
Open
fanyangCS wants to merge 2 commits into
Open
Conversation
Author
|
Update: changed the proposed bound from Reason: TLS plaintext records are commonly described as 16 KiB, but TLS 1.3 encrypted records can exceed 16 KiB slightly due to overhead (RFC allows TLSCiphertext length up to The original reproducer ( |
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.
Fixes XTLS/Xray-core#6356.
Summary
Increase REALITY's target TLS record buffer from 8192 bytes to 16384 bytes.
This fixes a reproducible REALITY failure when the legitimate target server returns a TLS Certificate record slightly larger than 8192 bytes. In the linked Xray-core issue,
www.microsoft.comcan return a Certificate record with total record length 8273 bytes when OCSP/status is included:The current REALITY code rejects it because:
The resulting user-facing/server log error is only:
Validation
I reproduced the failure with Xray-core
v26.3.27using:dest:www.microsoft.com:443serverNames:www.microsoft.comchromeUnpatched Xray failed locally with:
After this patch, the same localhost REALITY server/client setup succeeds:
A production deployment using the patched binary was also verified by the reporter.
Notes
TLS records can be up to around 16 KiB, so 8192 is too tight for real-world OCSP-stapled Certificate records from some large sites/CDN edges. This patch keeps the change minimal and avoids changing protocol behavior beyond allowing larger legitimate target handshake records.