9 ms·
Rustls: new, modern TLS library written in Rust
- bluejekyll 10y agoNo support for TLS 1.3? Any reason for this, other than work?
- ohazi 10y agoIt's listed in the "Possible future features" section... Isn't TLS 1.3 currently still a draft? [1] [1]: https://en.wikipedia.org/wiki/Transport_Layer_Security#TLS_1.3_.28draft.29 https://en.wikipedia.org/wiki/Transport_Layer_Security#TLS_1...
- bluejekyll 10y agoOh. You're right. Got the numbers confused.
- prdonahue 10y agoYes, TLS 1.3 is still in draft[1]. Heard from a co-worker on Friday (@grittygrease) that draft 14 should be arriving very soon. We (CloudFlare) have implemented draft 13 in go and are actively testing it—try browsing https://tls13.cloudflare.com https://tls13.cloudflare.com with Firefox nightly[2]. I think BoringSSL is also[3] working on their implementation and NSS (Firefox's SSL/TLS library) implemented[4] draft 11 in v3.23, but OpenSSL doesn't have plans to until after 1.1 ships[5]; I've heard the former is expected to land about 6 months prior to the latter as OpenSSL isn't starting until the RFC is finalized. 1 - https://tools.ietf.org/html/draft-ietf-tls-tls13-11 https://tools.ietf.org/html/draft-ietf-tls-tls13-11 (draft 13) 2 - https://nightly.mozilla.org/ https://nightly.mozilla.org/ 3 - https://www.imperialviolet.org/2015/10/17/boringssl.html https://www.imperialviolet.org/2015/10/17/boringssl.html 4 - https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_3.23_release_notes https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NS... 5 - https://www.openssl.org/policies/roadmap.html https://www.openssl.org/policies/roadmap.html
- oconnore 10y agohttp://i.imgur.com/hMqpkev.png http://i.imgur.com/hMqpkev.png
- elithrar 10y agoPat missed one bit: you need to head to about:config and set "security.tls.version.max" to 4.
- prdonahue 10y agoGood point. You'd figure I'd remember this after Nick put it on the monster video wall: http://imgur.com/cf28rpt http://imgur.com/cf28rpt ;)
- prdonahue 10y agoThink draft 13 is only deployed internally (as we're dogfooding it). Draft 11 is what's live unless you're on VPN. Nick (https://twitter.com/grittygrease https://twitter.com/grittygrease) can confirm.
- grittygrease 10y agotls13.cloudflare.com now speaks draft 13
- peter_tonoli 10y agoTLS 1.3 is too "modern".
- oconnore 10y agoI'm developing a twitch whenever I see the word "modern" in a software description. It doesn't actually say anything about what you're doing.
- stormbrew 10y agoIn this case I would tend to take "modern" to mean "not based on openssl."
- haberman 10y agoI take it to mean "uses current, best practices." For example: - C++: uses C++11 features, avoids non-RAII resources, prefers standard libraries over older, platform-specific libraries, not written as "C with classes." - C: doesn't do weird stuff like bypassing malloc(), avoids undefined behavior. - in general: has a test suite, probably uses continuous testing like Travis, uses modern language features to achieve cleaner & more robust code.
- sdegutis 10y ago> C: doesn't do weird stuff like bypassing malloc(), avoids undefined behavior. Can you elaborate?
- jmspring 10y agoIt's a bit of a naive comment, because it wholly depends on the libraries you include and what those do. Use any of the debugging libraries that shim in their own alloc routines, you bypass malloc (or at least do a bunch of things that impact what gets malloc'd).
- haberman 10y agoSure, but those libraries exist for the explicit purpose of giving malloc() special behavior. I'm talking about general-purpose libraries that implement their own malloc(), thereby preventing the use of these malloc()-hooking libraries.
- slimsag 10y agoI wonder, will Servo use this?
- Manishearth 10y agoProbably not. With security sensitive things, the security of the logic itself needs to be good too. Attacks like downgrade attacks, for example, are not memory unsafety issues. Servo would need a library that is battle-tested and has a vulnerability policy. The Rust libraries could be in this category in the future, but not right now. Using something like nss or boringssl, like other browsers, would be our best bet.
- briansmith 10y ago> Attacks like downgrade attacks, for example, are not memory unsafety issues. First, this library only implements TLS 1.2 with AEAD cipher suites (AES-128-GCM, AES-256-GCM, and ChaCha20-Poly1305) and perfect forward secrecy (using ECDHE with the X25519, P-256, and P-384 curves, and RSA and ECDSA signatures). Thus, downgrade to something worse than what NSS or OpenSSL or BoringSSL consider to be the very best crypto is avoided at a very fundamental level. Second, I and other people have been advocating strongly against design decisions that force implementations to add downgrade vectors. In particular, there is a version number field in the TLS ClientHello that we know causes problems. People have proposed solutions to avoid this version number causing compatibility problems for TLS 1.3, but Mozilla's TLS people have not supported making this improvement. Thus, we're likely going to have downgrade issues by design in TLS 1.3 that would be completely avoidable, due in large part to the people making NSS and other C crypto libraries.
- Manishearth 10y agoThis is good. However, I mentioned downgrade attacks as an example of the kind of bug Rust can't solve. Most likely new TLS stacks will not be prone to downgrade attacks. They might be prone to other logic errors. So will established TLS stacks, but those are more battle tested. The rust ones will be too, but eventually, not now. It's a tradeoff.
- teddyh 10y agoMy application needs RFC 6091, i.e. using OpenPGP keys instead of the usual X.509 certificates. (Why not X.509? Ask Peter Gutmann¹). This feature is not listed as something they don’t support, nor as something they won’t support, which is odd. Likewise for DTLS (RFC 6347). These omissions are strange. ① Everything you Never Wanted to Know about PKI but were Forced to Find Out (https://www.cs.auckland.ac.nz/~pgut001/pubs/pkitutorial.pdf https://www.cs.auckland.ac.nz/~pgut001/pubs/pkitutorial.pdf)
- Perceptes 10y agoProbably worth opening an issue on the GitHub to ask for clarification on whether support for those features will be considered for the future.
- mcpherrinm 10y agoThis is exactly the sort of cruft that's quite rarely used and should be omitted from a lean implementation. I'm not aware of any serious use of RFC 6091. GnuTLS supports it, but I don't think any other implementations do.
- teddyh 10y ago> I'm not aware of any serious use of RFC 6091. Was it really your intention to dismiss my application¹ as not serious? ① https://www.recompile.se/mandos https://www.recompile.se/mandos
- mcpherrinm 10y agoIt may be serious but I wasn't aware of it. It seems your project could use x509 client certs as well as gpg ones if you wanted to use a different TLS library that didn't support GPG.
- teddyh 10y agoThat seems like a bit of circular reasoning. We use RFC 6091 because it’s the best fit for our problem, and allows us to avoid the needless complexity of X.509 certificates, which has caused many bugs in the past (in essentially all TLS libraries).
- Perceptes 10y agoI'm so happy to see something like this in development. Every time there's a discussion about OpenSSL vulnerabilities, the topic of a future replacement written in Rust comes up, but no one was stepping up to the plate. Now we have some real progress towards a safer future.
- progman 10y agoThere is also Thrussh, a Rust library for SSH. Rust now begins to shine where it was designed for -- in security. According to https://doc.rust-lang.org/book/ffi.html https://doc.rust-lang.org/book/ffi.html it is possible to make callbacks from C code to Rust functions. This way other languages could take advantage of Rust's safe libraries.
- frutiger 10y agoThere have been far fewer serious vulnerabilities in OpenSSH than in OpenSSL.
- gkya 10y agoOpenSSL is not from the OpenBSD project whereas OpenSSH is.
- gkya 10y agoLanguage having safety features does not guarantee code free of vulnerabilities.
- smt88 10y agoRelated reading: https://tonyarcieri.com/would-rust-have-prevented-heartbleed-another-look https://tonyarcieri.com/would-rust-have-prevented-heartbleed...
- gkya 10y agoTed comments on this post in the article that it critiques. I do know that rust has important tools for writing secure programmes but using them is not really enforced (ie unsafe {}), thus it's possible to write exploitable bug in it. I want to note that I never used it though.
- nialv7 10y agoRustls use ring for crypto, and it seems most of the crypto algorithm code of ring is written in C/assembly. Kind of destroy the purpose?
- zmanian 10y agoRust is not a good language for low level crypto implementation because it offers no facilities for side channel resistant algorithims. Ring uses the extensively reviewed implementation from BoringSSL and considerable expertise from the author. Ring has a goal of moving as much code that does not need side channel resistant to Rust. By moving the protocol logic to Rust, the amount of code that needs to be reviewed for memory safety in a TLS library is drastically reduced.
- colemickens 10y agoWhat does Rust the language have to provide in order to achieve side channel resistant algorithms? That doesn't sound right to me. There are primitives in other languages that are needed? Or Rust doesn't abstract at the right level? edit: thanks for the explanations!
- mcpherrinm 10y agoUltimately, it's an optimizing compiler, and it's difficult/impossible to tell the compiler "make this code fast, but not too fast for these specific cases". The same problem affects basically every language that isn't assembly.
- thristian 10y agoIt might even affect assembly, if your CPU's microcode optimizations are sufficiently aggressive.
- briansmith 10y agoMost high-level languages don't provide guaranteed-constant-time behavior at all. That's a big reason why ring uses lots of BoringSSL's/OpenSSL's assembly language code. Also, one of my goals with the ring project is to identify exactly what constant-time utilities are needed for a crypto library, so that I can draft a proposal for improving the Rust language and libraries to provide such features.
- nialv7 10y agoMemory safety issues are not the only vulnerabilities in a cryptography library. A simple example would be timing attacks. Writing a cryptography library from scratch because the old one has too many security holes? Your implementation is likely to have even more. We should really concentrate on making one implementation secure, instead of creating more libraries.
- EugeneOZ 10y agoI hate so much this logic - it stops evolution. Humanity have enough programmers to write new libraries and patch existing code. Competition is better than stagnation.
- mtgx 10y agoIt's also an argument against disruption in general. Great progress happens when people stop iterating and start rethinking stuff that hasn't been rethought for decades (and the "stuff" has seen only tiny improvements over the years following this strategy, too).
- nialv7 10y agoDon't get me wrong, I'm not against disruption at all. It's just there're cases where doing this doesn't make sense. Write a new text editor, invent a new programming language, sure. But writing a new cryptography library? You are throwing away decades of effort that went into to harden and secure the existing library, and your gain is pretty small. Making things even worse is that you can't really write a crypto library without using C/assembly. So why write a new crypto library?
- nickpsecurity 10y ago"You are throwing away decades of effort that went into to harden and secure the existing library, and your gain is pretty small." If that were true, then it would be a good counterpoint worthy of long thought. The reality of crypto libraries is that popular ones often had preventable errors due to bad coding and/or unsafe language that also took entirely too long to notice. "you can't really write a crypto library without using C/assembly" I'd argue you can't write a crypto library using C by default unless you're a really good coder. C is just an accident of two team's bad hardware: http://pastebin.com/UAQaWuWG http://pastebin.com/UAQaWuWG Languages like Modula-3, Free Pascal, and even Fortran were easier to analyze to ascertain the program's properties. It's why Modula-3 had first, standard library verified free of specific types of errors. Also took years to make a certified compiler for C which had been done in other, simpler languages. Finally, the top performer in secure, systems code is SPARK as illustrated when re-implementing C crypto in it caught a problem. http://www.adacore.com/press/spark-skein/ http://www.adacore.com/press/spark-skein/ Note: The portability result was also impressive given it's one of C's strengths and difficulties.
- zmanian 10y agoI can see this being immensely beneficial to environments that rely heavily of calling out openssl for TLS like node and python.
- EugeneOZ 10y agoGlad to see zero "unsafe" and "panic" :)
- rudenoise 10y agoCan anyone comment on how this implementation of TLS compares to the recent ocaml/mirageOS version? How much does formal verification matter/increase confidence? Is the rust version easier to integrate with other stacks? https://mirage.io/blog/why-ocaml-tls https://mirage.io/blog/why-ocaml-tls
- hannob 10y agoNeither ocaml-tls nor this new one do formal verification. The only TLS library that does so is miTLS.
- nickpsecurity 10y agoLet's not forget the security kernel in Guttman's cryptlib. It's like a lightweight variant of formal verification that justs makes sure things interface correctly.
- strmpnk 10y agoWhich is interating here since F* can extract to OCaml. I wonder how hard it would be to wire up a test harness to compare the two with randomized tests.
- jeffdavis 10y agoOCaml has more runtime requirements. Can someone comment on how invasive those requirements are, and whether that would limit adoption of the OCaml version compared with C or rust?
- edraferi 10y agoIs that still true in MirageOS, which runs as a Unikernel on top of Xen?
- tristor 10y ago> The following things are broken, obsolete, badly designed, underspecified, dangerous and/or insane. Rustls does not support: > Client authentication. > Kerberos. From a complexity perspective I understand why these things would not be the first choice to implement in a new library. What I don't understand is why they're on the "will never implement" list. Public-key client authentication is to this day one of the strongest methods of authentication that can be used, and not having that available in a library greatly limits its usages in high-security applications, exactly the places where someone might want to stop using OpenSSL and its broken peers. Kerberos... well... Kerberos is a cluster-fuck. I think everyone knows that. But there are specific applications where Kerberos (or something similar) is exceptionally useful and maybe even necessary. I will acknowledge though that if Kerberos is missing its not a world-ender, because you can implement your own token-based authentication on top of normal TLS without using Kerberos, which in some cases might even be easier because Kerberos is a cluster-fuck. Despite this, though, if configured properly Kerberos is still one of the best methods for doing secure authentication between multiple servers/services via a central authentication mechanism. If the justification here is simply implementation complexity that might cloud the codebase or otherwise make it harder to audit for security, I do understand that reasoning. I'm just curious specifically in these two cases because they stood out from the list as things that I don't consider "insane", unlike most of the rest of the list. As an aside, thanks for not implementing RC4. RC4 needs to die die die die. I don't know why anyone is still using it, but nonetheless I see it in the wild still sometimes :(
- deleted 10y ago[deleted]
- e12e 10y agoOdd to see "PSK" on the possible future feature list, with "client authentication" on the "never" list. Other than that, looks like a nice and sane subset they've picked. Real shame if they end up avoiding cert-based authentication, though. All other options for authentication are strictly worse, from a security perspective - and leaves more room for implementors to shoot themselves in the foot. For passwords that are intended for human users, for example, you really need some form of rate-limiting. Not to mention the problem of setting up a session first, and then later binding to a user (if authentication succeeds) rather than the simpler "only valid client can connect".