You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This blog post explores an interesting idea: fragmenting TLS messages (especially Client Hello) over multiple TLS records. This is different from TCP segmentation, which has been studied in the past by, e.g., Winter & Lindskog 2012 (Section 5.2, brdgrd), Khattak et al. 2013, and Bock et al. 2021 (Section 4.1), and is implemented in tools including GoodbyeDPI. Rather, this research takes advantage of the fact that TLS messages (e.g. Client Hello) are carried in TLS records, and that one message may be fragmented over multiple records:
The TLS Record Protocol is a layered protocol. At each layer, messages may include fields for length, description, and content. The Record Protocol takes messages to be transmitted, fragments the data into manageable blocks, optionally compresses the data, applies a MAC, encrypts, and transmits the result.
The post introduces a tool, DPYProxy, that fragments TLS messages over multiple records (by parsing the user's TLS records and re-wrapping them in multiple shorter records). They test the tool in China and find that when a Client Hello message is fragmented at the TLS record layer, the SNI is not interpreted by the firewall and the connection doesn't get blocked. (Surprisingly, TCP-layer segmentation also worked in their tests—as long as the Client Hello message is broken before the SNI extension.)
Reacted by Gaukas Wang, Hector Hanshew, Hung-I Wang, Evsyukov Denis, Felix Graf Lange, showgood163, Antonin GAVREL, Steve Johnson and Nikita Korotaev
It is less likely for realtime systems to handle TCP or TLS reassembly due to its computation or memory cost at scale, in realtime, but this is not a fact that can be relied on in general. During a previous blockage of Cloudflare in #295 I tested various ways of TCP fragmentation of TLS Hello and was able to trigger TCP resets in all variations. I believe in general it is more likely for offline and deeper traffic analysis to perform traffic reassembly as realtime decisions are not required.
@5e2t tested tlshello fragmentation against Henan GFW and Guangzhou international outbound GFW: XTLS/Xray-core#2426 (comment)
My view is that these fragments may be usable, but the GFW doesn't need to reconstruct them, and for now, it's an anomaly for a message to contain only a portion of a client hello rather than the full one
Should Record Fragmentation not work standalone, it can hopefully be combined with TCP fragmentation. That might be something to try out for circumvention tools like XRay. Especially when the TCP and TLS Records are of different size/in different order.
FYI, I tested TLS Record fragmentation with DPYProxy last month and was able to demonstrate that it bypasses SNI-based blocking in an network in Russia and one in Iran.
I also realized that leaving a single byte of the first message out of the first record was enough to bypass censorship. That suggests to me that they just give up parsing TLS. Perhaps they require the message length to be the record length -5 in their TLS detector. This may help against blocking based on TLS fingerprint because of that.
In Russia, TCP alone could bypass SNI-based censorship, but only on byte 2 (as in [01][2...]), and sometimes on byte 1 (as in [0][1...]). That split is right in the middle of the TLS version, which may confuse the TLS detection and make them give up TLS analysis.
Activity
HectorHW commentedon Nov 8, 2023
Verified to work (for now at least) against Roskomnadzor blocking https websites in Russia. Nice finding!
JonSnowWhite commentedon Nov 9, 2023
@HectorHW Thanks for the info!
klzgrad commentedon Nov 9, 2023
It is less likely for realtime systems to handle TCP or TLS reassembly due to its computation or memory cost at scale, in realtime, but this is not a fact that can be relied on in general. During a previous blockage of Cloudflare in #295 I tested various ways of TCP fragmentation of TLS Hello and was able to trigger TCP resets in all variations. I believe in general it is more likely for offline and deeper traffic analysis to perform traffic reassembly as realtime decisions are not required.
RPRX commentedon Nov 13, 2023
@5e2t 针对河南 GFW 和广州国际出口 GFW 测试过 tlshello 分片:XTLS/Xray-core#2426 (comment)
我的观点是这些分片 可能可用,但 GFW 并不需要重组它们,目前来说,一个报文只含一部分而不是完整的 client hello 即为异常
@5e2t tested tlshello fragmentation against Henan GFW and Guangzhou international outbound GFW: XTLS/Xray-core#2426 (comment)
My view is that these fragments may be usable, but the GFW doesn't need to reconstruct them, and for now, it's an anomaly for a message to contain only a portion of a client hello rather than the full one
JonSnowWhite commentedon Nov 13, 2023
Should Record Fragmentation not work standalone, it can hopefully be combined with TCP fragmentation. That might be something to try out for circumvention tools like XRay. Especially when the TCP and TLS Records are of different size/in different order.
fortuna commentedon Nov 16, 2023
FYI, I tested TLS Record fragmentation with DPYProxy last month and was able to demonstrate that it bypasses SNI-based blocking in an network in Russia and one in Iran.
I also realized that leaving a single byte of the first message out of the first record was enough to bypass censorship. That suggests to me that they just give up parsing TLS. Perhaps they require the message length to be the record length -5 in their TLS detector. This may help against blocking based on TLS fingerprint because of that.
See the commands I used for testing at UPB-SysSec/DPYProxy#2 (comment)
This is how the TCP fragmentation looks like on tshark:
This is how it looks with TLS record fragmentation only:
TCP segmentation
In Iran, TCP segmentation alone didn't help.
In Russia, TCP alone could bypass SNI-based censorship, but only on byte 2 (as in [01][2...]), and sometimes on byte 1 (as in [0][1...]). That split is right in the middle of the TLS version, which may confuse the TLS detection and make them give up TLS analysis.