-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any plans to implement it in Rust? #103
Comments
Actually I liked and highly support this idea. If it is challenging to build a Rust library from rustls that supports ALL features in uTLS, at least it would be valuable to have a library to allow customization to a certain extent, or being able to (almost) perfectly mimic one, or a few, popular TLS implementations/browsers. |
Any early proposal or project draft is welcome and wanted! |
I patched rustls for that purpose for noisy-shuttle. To keep to the changes minimum, I add a new Porting utls to Rust would be a great idea. I am willing to contribute if anyone is gonna start such. Or I could start a project myself, but I may not be able to maintain it in a timely fashion on my own. |
Thanks for sharing @Gowee! Your fork looks great and indeed contains many features that a
Sure, I don't mind kick this off by forking a popular and mostly-complete TLS library in Rust. Is Rustls a good starting point or what are the other choices? I'm not super familiar with the TLS ecosystem in Rust.
That is totally fine. Either way I don't believe on the refraction side we have enough capacity for Or utlsr, open for ideas on naming! |
对 Rust 来说,或许直接使用 Chromium 的代码?XTLS/Xray-core#2257 (comment) For Rust, maybe just use the Chromium code? XTLS/Xray-core#2257 (comment) |
其实尝试做一个cronet的rust binding就OK了. 这个对于rust来说不难.
Actually try to make a rust binding for cronet and you'll be fine. It's not hard for rust. |
Thanks for tagging/linking @fedosgad. Out of curiosity, (how) did mitmproxy solve the TLS ClientHello fingerprinting issue in the end? |
We don't have ClientHello mimicry in mitmproxy yet. Right now we're using OpenSSL via pyca/cryptography, which makes this pretty hard to implement. I looked into switching to rustls a while ago, but that attempt was abandoned due to compatibility issues (unrelated to mimicry) back then. |
Does it indicate that mitmproxy produces a relatively unique/unpopular ClientHello fingerprint or not? (Better if would like to provide it in tlsfingerprint.io's format, you may pull from
I would entertain your insights on this if you would love to elaborate. What kind of compatibility issue and if there are any other good paths Rust (and potentially other programming language) programmer should take to counter the ClientHello fingerprinting? i.e., if not then perhaps we should try to start building a rustls-based (Disclaimer: refraction is not against such project, but unlikely to spare any capacity on leading/moderating the project. I would suggest starting a new organization and adding interested developers in, unless there is already something we could contribute to.) |
$ mitmdump --mode reverse:https://client.tlsfingerprint.io/ &
$ curl -k http://localhost:8080
{"tls_record_version":769,"tls_handshake_version":771,"cipher_suites":[4866,4867,4865,49195,49199,49196,49200,52393,52392,158,159,52394,49187,49191,49161,49171,49188,49192,49162,49172,103,107,156,157,60,61,47,53,255],"compression_methods":[0],"extensions":[0,11,10,35,22,23,13,43,45,51],"extensions_normalized":[0,10,11,13,22,23,35,43,45,51],"server_name":"client.tlsfingerprint.io","supported_groups":[29,23,30,25,24,256,257,258,259,260],"ec_point_formats":[0,1,2],"signature_algorithms":[1027,1283,1539,2055,2056,2057,2058,2059,2052,2053,2054,1025,1281,1537,771,769,770,1026,1282,1538],"alpn":null,"compress_certificate":null,"record_size_limit":[],"supported_versions":[772,771],"psk_key_exchange_modes":[1],"key_share":[29],"application_settings":null,"user_agent":"curl/7.81.0","nid":5075520528980946569,"norm_nid":-7307055319671900602,"id":"466fdf07a41cae89","norm_id":"9a981fe6b4d3f646"}
One major blocker for us back then was the lack of support for IPs as dnsAltNames. Rustls supports that nowadays though. :) |
$ mitmdump --mode reverse:https://client.tlsfingerprint.io/ &
$ curl -k http://localhost:8080
{"tls_record_version":769,"tls_handshake_version":771,"cipher_suites":[4866,4867,4865,49195,49199,49196,49200,52393,52392,158,159,52394,49187,49191,49161,49171,49188,49192,49162,49172,103,107,156,157,60,61,47,53,255],"compression_methods":[0],"extensions":[0,11,10,35,22,23,13,43,45,51],"extensions_normalized":[0,10,11,13,22,23,35,43,45,51],"server_name":"client.tlsfingerprint.io","supported_groups":[29,23,30,25,24,256,257,258,259,260],"ec_point_formats":[0,1,2],"signature_algorithms":[1027,1283,1539,2055,2056,2057,2058,2059,2052,2053,2054,1025,1281,1537,771,769,770,1026,1282,1538],"alpn":null,"compress_certificate":null,"record_size_limit":[],"supported_versions":[772,771],"psk_key_exchange_modes":[1],"key_share":[29],"application_settings":null,"user_agent":"curl/7.81.0","nid":5075520528980946569,"norm_nid":-7307055319671900602,"id":"466fdf07a41cae89","norm_id":"9a981fe6b4d3f646"} https://tlsfingerprint.io/id/N/9a981fe6b4d3f646
https://tlsfingerprint.io/id/N/116f0463dfb87fe8 Unfortunately it does look like relatively unique and niche, with no known User Agents to us at our database... Our observation could be biased since it is from a university. |
Thanks. I can also offer
which you get if mitmproxy sends an ALPN because the client sent one. 😅 But yeah - I expect mitmproxy to be easily fingerprintable right now. I'd be happy to fix that eventually, but I'm prioritizing paid work at the moment. :) |
从工作量的角度来说,直接绑定 Chromium 的网络栈前期可能麻烦些,但后期的维护成本比较低,且可以获得比较好的效果。 修改 rustls,前期比较简单,但后期的维护成本比较高,会遇到一些 utls 遇到过的问题:
所以我个人倾向于直接绑定 Chromium 的网络栈,且由于它的维护成本低,放在该 org 下应该也不会有太大的负担。 From a workload perspective, directly binding to Chromium's web stack can be a bit of a pain up front, but it's cheaper to maintain later on and you can get better results. Modifying rustls is easier up front, but more expensive to maintain later, and you'll run into some of the problems that utls has encountered:
So my personal preference is to bind directly to Chromium's web stack, and since it's low-maintenance, it shouldn't be too much of a burden to put under that org. |
I can confirm that mitmproxy is easily fingerprintable - there are DDoS protection services (Cloudflare, for example) that use ClientHello fingerprints to do their job. I have encountered websites that do not allow user to access them when using mitmproxy but work fine without it. That was the primary reason why I wrote mirror_proxy a while ago. |
这应该不成问题,通常我们只用最新的 Chrome 指纹,你的库有计划公开吗,大概什么时候可以发布?@raintean That shouldn't be a problem, usually we only use the latest Chrome fingerprints, do you have any plans to make your library public and roughly when will it be released? |
@RPRX 目前只是个人实验项目, 暂时没有公开的计划.
It's just a personal experiment at the moment, no plans to make it public. |
Some relevant discussions are here: rustls/rustls#1125, rustls/rustls#1421. |
Building a wrapper for cronet only makes sense for the short term since it will be easier to maintain, there is already some open sourced code to help get started. However, building an independent TLS lib, i.e. forking boringSSL, rustls, etc makes the most sense for the long term. Most browsers are using some variation of openSSL, so maintaining a fork of openSSL (or boringSSL) with features found in uTLS seems to be the end game. |
A possibly off-topic update to this issue: at Refraction Networking we have recently created water (it is under me only because it is yet to be cleaned up and formally adopted by Refraction Networking) and it has a twin brother in Rust water-rs. If everything goes well, we will have the ability to build uTLS into a WATER-compatible, pluggable WebAssembly Transport Module (WATM) and use it in Rust with For now, we are blocking on TinyGo and Go.
If either one of these two could be unblocked at some point, we can advance our progress on building Update: We found a workaround and are able to build uTLS to a WebAssembly Transport Module which can be used by water. (12MB) |
Good work on watm, but aren't projects such as |
I'm not familiar with noisy-shuttle, but I'm very sure restls implemented the client in Go to use uTLS's TLS ClientHello parrots. If you could point me to the TLS client implementation of noisy-shuttle, I would be very interested in taking a look. |
You're right restls does not depend on JA3 my mistake! But for noisy-shuttle, here's the fingerprint builder in opts.rs and the implementation seems to be in the fp.rs. Project's README example indicates a raw format supply for fingerprints paramaters:
|
Interesting! Thanks for the info, I will take a look into this, especially how they handle new/unimplemented extensions. But also it seems that |
I see you also developing in rust, so any plans to reimplement same functionality(or like a lite version) in rust(probably using boringssl or openssl)?
The text was updated successfully, but these errors were encountered: