4 ms·
Why TLS is better without STARTTLS (2021)
- ttul 4y agoThe proper long term solution to this problem is DANE [2], but since migrating everyone to DNSSEC will take a long time, Google and a few others in the email ecosystem created MTA-STS, which is far better than nothing [1]. All this being said, another idea (not standardized yet as far as I know) would be to publish a new DNS record, MXS (for example), that would imply the use of the SSL email port 465. I think it would be a worthy standardization effort to go in this direction and finally banish STARTTLS. [1] https://dmarcian.com/mta-sts/ https://dmarcian.com/mta-sts/ [2] https://www.rfc-editor.org/rfc/rfc7671.html https://www.rfc-editor.org/rfc/rfc7671.html
- tsimionescu 4y agoHow would any of these fix vulnerabilities in the handling of STARTTLS? And why is any of them required in place of just using TLS as part of the initial connection, HTTPS style?
- ttul 4y agoYou can’t fix STARTTLS unless receivers stop advertising it. That will take until the end of time. Meanwhile, DANE can assure that domains can assert their SSL certificate in the DNS securely. And MTA-STS can allow DNS to do so, just without the assurance of DNSSEC, which implies that sophisticated man-in-the-middle attacks can still occur, if DNS can be intercepted and modified.
- tptacek 4y agoIt's probably worth noting that the attacks a state-level actor would use to subvert MTA-STS are more sophisticated than the attacks those same actors would use to subvert DNSSEC, which is a global tree PKI whose roots are de jure controlled by state actors.
- dlandau 4y ago"Meddler-in-the-middle", I hope this catches on.
- Arch485 4y agoIt's way more descriptive than "man-in-the-middle"! It also sounds cooler
- markonen 4y agoI've been trying to shoehorn mTLS into existing infrastructure of Postgres clients and servers. This would be trivial if Postgres used straight-up TLS; as it is, though, you need sidecars that understand the Postgres wire protocol and that limits your choices to things like pgbouncer (which will add not-insignificant overhead) or Envoy (where the Postgres wire protocol support seems alpha quality or so).
- gmac 4y agoThe Postgres devs are discussing eliminating that speedbump, and having an encrypted connection start with an ordinary TLS Client Hello: https://www.postgresql.org/message-id/flat/CAM-w4HOEAzxyY01ZKOj-iq%3DM4-VDk%3DvzQgUsuqiTFjFDZaebdg%40mail.gmail.com https://www.postgresql.org/message-id/flat/CAM-w4HOEAzxyY01Z...
- philsnow 4y ago> This would be trivial if Postgres used straight-up TLS ... does it not? (I really don't know, I've never had to admin postgres myself) from https://www.postgresql.org/docs/current/ssl-tcp.html#SSL-SETUP https://www.postgresql.org/docs/current/ssl-tcp.html#SSL-SET... > With SSL support compiled in, the PostgreSQL server can be started with support for encrypted connections using TLS protocols enabled by setting the parameter ssl to on in postgresql.conf. The server will listen for both normal and SSL connections on the same TCP port, and will negotiate with any connecting client on whether to use SSL. By default, this is at the client's option wait so.. if it uses the same port for TLS, does it use STARTTLS? from https://www.postgresql.org/docs/current/protocol-flow.html#id-1.10.6.7.12 https://www.postgresql.org/docs/current/protocol-flow.html#i... > To initiate an SSL-encrypted connection, the frontend initially sends an SSLRequest message rather than a StartupMessage. The server then responds with a single byte containing S or N, indicating that it is willing or unwilling to perform SSL, respectively. The frontend might close the connection at this point if it is dissatisfied with the response. To continue after S, perform an SSL startup handshake (not described here, part of the SSL specification) with the server. If this is successful, continue with sending the usual StartupMessage. In this case the StartupMessage and all subsequent data will be SSL-encrypted. To continue after N, send the usual StartupMessage and proceed without encryption. and also from that section > While the protocol itself does not provide a way for the server to force SSL encryption, the administrator can configure the server to reject unencrypted sessions as a byproduct of authentication checking. .... that is not great. I mean zero disrespect to the postgres dev team, but why do this? I know (m)TLS has issues, but why would anybody want to have to trust/verify two codebases (the postgres bits before the handoff to openssl/boringssl/whatever) instead of just one (only openssl/boringssl), just to bootstrap to a secure client-server connection? (this is my complaint about all upgrade-to-TLS schemes)
- rbut 4y agoWe run an LDAP service attached to our SaaS application. A couple of years ago we were alerted to the fact that iOS devices no longer connected to our LDAPS server running on port 636. macOS still seemed to connect fine.. After some digging, it seemed Apple updated iOS to only accept connecting over STARTTLS on port 389. So we had to run a STARTTLS server also to make iOS devices work. At the time, it seemed STARTTLS over 389 was the "standard", maybe that's why Apple changed it, but looking just now it seems that is being challenged [1][2], and rightly so. [1] https://unix.stackexchange.com/questions/607560/why-is-ldap-with-starttls-preferred-over-ldaps https://unix.stackexchange.com/questions/607560/why-is-ldap-... [2] https://lists.openldap.org/hyperkitty/list/openldap-technical@openldap.org/thread/IXEZAGCOTL5CTSOFNFDE65LURQET6ZZV/#LZ4N3JHGKZVDXRIXNRAM4SHZ44B5U4BP https://lists.openldap.org/hyperkitty/list/openldap-technica...
- hannob 4y agoHi, one of the authors here. Happy to answer any questions.
- billpg 4y agoI'm writing (as a side project) a game with a client-server system. For the server, I'm using dot-net's SslStream (in TLS mode) and it needs to know which TLS cert to use prior to handing over control of the connection. For this reason, I've designed the protocol for the client to announce who they are and what they want as a single line of JSON before letting SslStream negotiate TLS. Once the connection is secured, the client repeats that first line of JSON. If the server detects any difference between the two it closes down the connection. (I also made sure to clear the buffers after reading that first line of JSON.) I don't like doing that but the only other way is to "roll my own crypto" which I understand is a bad thing.
- d-z-m 4y agoSniffing the SNI from the underlying TCP connection is the proper way to do this. a couple examples I know of(only know go ones of the top of my head): https://github.com/fabiolb/fabio/blob/master/proxy/tcp/tls_clienthello.go https://github.com/fabiolb/fabio/blob/master/proxy/tcp/tls_c... https://github.com/FiloSottile/mostly-harmless/blob/main/talks/asyncnet/tls.go https://github.com/FiloSottile/mostly-harmless/blob/main/tal... > I don't like doing that but the only other way is to "roll my own crypto" which I understand is a bad thing. You would not be rolling your own cryptographic primitive, or combining existing ones in strange and speculative ways. This is what most people, most of the time mean when they admonish against rolling your own crypto. All you'd have to do is parse the ClientHello to retrieve the SNI. you're in a memory safe language, so parsing bugs result in a crash, not a buffer overflow. I'd say you're on pretty firm ground.
- hannob 4y ago> it needs to know which TLS cert to use prior to handing over control of the connection It is a bit unclear here what that means. I mean TLS has a mechanism to choose the certificate based on the hostname (SNI). Other than that - why would a different user get a different certificate? After all the certificate's job is to identify the server.
- billpg 4y agoI'm writing a POP3 service (http://billpg.com/POP3/ http://billpg.com/POP3/) and I stumbled upon this as a bit of a forehead-slapping moment. Once I read about it, I tried attacking my own server by sending in "STLS\r\nCAPA\r\n" in a single TCP package and it responded to CAPA after the encrypted channel had been established because those bytes were still in the buffer. One hasty bugfix to clear the buffers after establishing TLS later and I thought about how to exploit this bug. The only thing you can do at this point is log in and an attacker isn't going to know the user's credentials. (If they do, you don't need to exploit the bug.) Despite this, I wonder about what what if HTTP had a STARTTLS command instead of using port 443 and handing over directly to TLS. SNI (identifying the names host the client wishes to connect to prior to certificate exchange) took years to get established, mostly (I think) because it was inside the black-box of TLS. If the certificate exchange happened with HTTP before handing over to TLS, the request might have looked like: GET /.well-known/tls-cert HTTP/1.1 Host: the-actual-hostname Accept: certificate/format, et/c When the hand-over to TLS (in this parallel universe) takes place, the certificate exchange has already happened. TLS's job is now to confirm the cert is valid (or not) and exchange session keys.
- daneel_w 4y agoI never could understand why POP3 service providers don't just insist on enforcing POP3S. We're no longer in the early 2000s. https://github.com/stolendata/little-peepo/blob/master/little_peepo.pl#L8 https://github.com/stolendata/little-peepo/blob/master/littl...
- lbriner 4y agoMy understanding is that it is always historical. There are still people out there who are "I built my own email tools" or "this was setup in 1992 and still works" etc. These aren't a tiny fringe group but asizeable number of sometimes very influential people. As soon as you make a serious breaking change, it brings out all the complaints of "centralisation" of "being forced into something" into "I don't need tls whatever you say" etc. Google try these sorts of things occasionally but although in most cases it is short-term pain for long-term gain, it rarely goes that way.