[go: up one dir, main page]

|
|
Log in / Subscribe / Register

STARTTLS considered harmful

By Jake Edge
August 18, 2021

The use of Transport Layer Security (TLS) encryption is ubiquitous on today's internet, though that has largely happened over the last 20 years or so; the first public version of its predecessor, Secure Sockets Layer (SSL), appeared in 1995. Before then, internet protocols were generally not encrypted, thus providing fertile ground for various types of "meddler-in-the-middle" (MitM) attacks. Later on, the STARTTLS command was added to some protocols as a backward-compatible way to add TLS support, but the mechanism has suffered from a number of flaws and vulnerabilities over the years. Some recent research, going by the name "NO STARTTLS", describes more, similar vulnerabilities and concludes that it is probably time to avoid using STARTTLS altogether.

Opportunistic TLS

Normally, protocol messages are either encrypted or not, but STARTTLS allows for a kind of middle ground. It is the command used to invoke TLS for an existing plaintext connection in what is known as opportunistic TLS. Servers can advertise their ability to handle TLS connections; for example, an email (SMTP/ESMTP) server specifies whether it will accept the STARTTLS command in its reply to the client's initial message (EHLO). If desired, the client can then request encryption using the STARTTLS command; a TLS handshake will then be performed and subsequent traffic will be encrypted. This contrasts with implicit TLS, where the communication channel, typically indicated by a specific port number, only operates in the encrypted mode.

As might be guessed, it is the switch from one mode to the other that is most vulnerable to MitM attacks. In the most basic attack, known as STARTTLS stripping, an attacker who can intercept and change the traffic can simply stop any STARTTLS command from being sent between the participants, ensuring that the conversation proceeds in plaintext form. Failure to establish an encrypted session could be treated as an error by clients, but sometimes is not. The next step after trying to establish the encryption is often some kind of authentication, which might effectively be performed in plaintext if the session is not encrypted.

As reported by one of the researchers, Hanno Böck, on the oss-security mailing list, a STARTTLS flaw found in 2011 was the jumping-off point for the research. That flaw was found by Postfix creator Wietse Venema in multiple SMTP servers, including Postfix; it allowed MitM attackers to "inject plaintext content into the TCP packet of a STARTTLS command and a server would interpret it as if it was part of the TLS session", Böck said. But the researchers found that this ten-year-old vulnerability was still unfixed in some servers; in its most severe form, "it can be used for credential stealing".

The other researchers, Damian Poddebniak, Fabian Ising, and Sebastian Schinzel, are from Münster University of Applied Sciences, while Böck is an independent researcher. They presented their paper at the 30th USENIX Security Symposium in August. As part of that work, they developed a testing toolkit called EAST that was used to analyze 28 email clients and 23 servers; only three of the clients and seven of the servers were completely unaffected by the 40 separate STARTTLS problems they uncovered. In addition, it turns out that 15 servers are still vulnerable to the same flaw found by Venema in 2011; scans found that 2% of mail servers on the internet exhibit the flaw. Both the paper and the web site have more details on all of the flaws, including which servers and clients are affected.

The researchers also looked at the POP3 and IMAP message-retrieval protocols, both of which have STARTTLS commands. Like what Venema saw for SMTP, they found that some servers will process the plaintext sent with the command as if it were part of the encrypted session. Instead of discarding any buffered input, the servers end up processing it after the TLS handshake is done—and the state of the connection has changed.

The most severe attacks exploit this behavior to exfiltrate the user's login credentials. They require that the attacker also has a valid account on the SMTP or IMAP server in question, though, which reduces the scope of the problem somewhat.

The attacker can inject commands that authenticate them and then start sending (SMTP) or storing (IMAP) an email. The login credentials sent by the victim will be stored in the email that the attacker can access.

Going in the other direction, mailbox contents can be forged by adding commands to the STARTTLS response from the server. Once again, the data is buffered and interpreted in the context of the encrypted session, this time by the email client, even though it was sent (and received) before the session was established.

This bug affected many popular mail clients, including Apple Mail, Mozilla Thunderbird, Claws Mail, and Mutt.

By injecting additional content to the server message in response to the STARTTLS command before the TLS handshake, we can inject server commands that the client will process as if they were part of the encrypted connection. This can be used to forge mailbox content.

On the web page for the NO STARTTLS flaws, the researchers called out a third vulnerability type that was found. In IMAP connections, the PREAUTH command can be sent by a server to indicate that the client is already authenticated, but it also prevents the client from using STARTTLS to transition into an encrypted state. The IMAP protocol does not allow STARTTLS after PREAUTH, which turns PREAUTH into a way to prevent encryption that is somewhat similar to STARTTLS stripping. Clients should reject that type of connection when encryption has been requested by the user, but some do not. The flaw was found in the Trojitá email client in 2014, but the researchers discovered that other clients are vulnerable to it.

When coupled with the little-used IMAP referral features (for logins and for mailboxes), an attacker could cause a client to send its credentials directly to the attacker:

By using PREAUTH to prevent an encrypted connection, an attacker can use referrals to force a client to send credentials to an attacker-controlled server. Fortunately, the referral features are not supported by many clients. We found only one client - Alpine - vulnerable to this combination of PREAUTH and referrals.

Recommendations

The researchers recommend that users stick to implicit TLS ports (465 for SMTP submission, 993 for IMAP, and 995 for POP3) to avoid STARTTLS altogether, though some service providers do not give that option for email submission. Application developers should strongly consider only offering support for implicit TLS; if that is not possible, testing with EAST or something similar is needed to ensure that plaintext is not processed as if it were encrypted. Meanwhile, mail-server administrators should consider disabling STARTTLS for the email-handling protocols.

As noted in the FAQ section, STARTTLS is the only way for mail servers (mail transfer agents or MTAs) to encrypt the traffic between themselves, as there is no support for implicit TLS for SMTP when it is used to transfer email between MTAs. Those STARTTLS transactions are already vulnerable to STARTTLS stripping attacks, because servers do not know whether the other endpoint accepts TLS or not; they cannot refuse to transfer mail because the connection is not encrypted. That means there is no real advantage for attackers to adopt the NO STARTTLS techniques. Adding authentication to the connections between servers, which is being worked on, would change the equation, however, so server code needs to be analyzed for buffering and other types of STARTTLS problems.

MitM vulnerabilities that can only be exploited with the ability to alter messages between the endpoints are sometimes seen as "lesser" flaws—and they are. But the requirements for an active meddler in between the participants are sometimes misjudged. For example, any WiFi router, say at the local coffee shop, or internet service provider being used, certainly has the capability of performing these kinds of attacks—it does not require some nation-state attack against the internet backbone by any means. WiFi routers, especially those in busy locations that handle lots of users, would make prime targets for a full compromise by an attacker. That compromise would provide a perfect platform for MitM attacks of various sorts against all of its users.

While the NO STARTTLS vulnerabilities are important and should be fixed, they are not generally huge problems in their own right. Their impact is fairly limited as the researchers noted:

The demonstrated attacks require an active attacker and may be recognized when used against an email client that tries to enforce the transition to TLS. We have informed all popular email client and server vendors and most issues are already fixed. We think that the demonstrated attacks would be difficult to execute on a large scale and we primarily expect them to be used in targeted attacks.

One thing the vulnerabilities do highlight is that projects are not generally all that good at scrutinizing their code for the same kinds of problems found in other, similar tools. Vulnerabilities found years ago should quite plausibly have led other email server and client projects to ferret out their own manifestations of those bugs long before now. Instead, it took some security researchers who were curious about the wart that is STARTTLS.

It is clear that retrofitting security into existing protocols is difficult to get right. Mixing plaintext and encrypted traffic over the same connection without these kinds of botches is evidently difficult as well. Those general principles will be important to keep in mind as we move forward; backward compatibility is most certainly a "nice to have", but secure protocols, without warts and hard-to-get-right pieces, is increasingly becoming a "must have".


Index entries for this article
SecurityInternet
SecurityTLS


to post comments

STARTTLS considered harmful

Posted Aug 18, 2021 1:57 UTC (Wed) by NYKevin (subscriber, #129325) [Link] (13 responses)

> they cannot refuse to transfer mail because the connection is not encrypted.

I guarantee, if Gmail, Outlook, and one or two of the other big email services all simultaneously announced "In one year, we will stop accepting any SMTP commands over cleartext, other than EHLO and STARTTLS," then this problem would solve itself. But then they'd get accused of being big evil tech monopolies.

Disclaimer: I work for Google, but not on Gmail.

STARTTLS considered harmful

Posted Aug 18, 2021 2:50 UTC (Wed) by jkingweb (subscriber, #113039) [Link]

Five years ago, maybe. Today TLS is so established and available that they could probably get away with it easily.

STARTTLS considered harmful

Posted Aug 18, 2021 3:05 UTC (Wed) by wtarreau (subscriber, #51152) [Link] (7 responses)

> if Gmail, Outlook, and one or two of the other big email services all simultaneously announced "In one year, we will stop accepting any SMTP commands over cleartext, other than EHLO and STARTTLS," then this problem would solve itself

Or e-mail usage would simply stop in favor of other communication channels that require authenticating on various services that make a business of exploiting identities.

A huge amount of e-mails have no business being encrypted nor authenticated. Think about mailing lists for example. Forcing this would simply kick a lot of users out of this service. And don't forget that forced TLS just makes the business of certificate sellers and causes lots of trouble for small sites and small users who simply can't easily keep up with periodically updating them :-/

The internet was initially designed to be resilient and to ease interconnection. Nowadays it's extremely brittle and is entirely owned by huge companies who decide what protocols you will use by offering you both the clients and the servers.

STARTTLS considered harmful

Posted Aug 18, 2021 3:49 UTC (Wed) by Cyberax (✭ supporter ✭, #52523) [Link] (4 responses)

> A huge amount of e-mails have no business being encrypted nor authenticated. Think about mailing lists for example.

That's pretty much the only thing that doesn't always need to be encrypted (there are plenty of private lists). And encryption won't _hurt_ them, the CPU costs are negligible at this point in time.

> And don't forget that forced TLS just makes the business of certificate sellers and causes lots of trouble for small sites and small users who simply can't easily keep up with periodically updating them :-/

Right now STARTTLS doesn't do any validations in most cases. In future, you can use self-signed certificates with DANE.

STARTTLS considered harmful

Posted Aug 18, 2021 12:40 UTC (Wed) by jgh (guest, #92451) [Link] (3 responses)

> In future, you can use self-signed certificates with DANE.

Except that DANE requires DNSSEC, and that is apparently hard.

STARTTLS considered harmful

Posted Aug 18, 2021 18:10 UTC (Wed) by ale2018 (subscriber, #128727) [Link] (2 responses)

> > In future, you can use self-signed certificates with DANE.

Let's Encrypt acme tool works perfectly. It's even more convenient than self-signing, let alone reliable.

> Except that DANE requires DNSSEC, and that is apparently hard.

IME, DNSSEC is not as hard as it might have appeared before enabling it. Meanwhile, one can use MTA-STS anyway.

STARTTLS considered harmful

Posted Aug 18, 2021 22:09 UTC (Wed) by mbunkus (subscriber, #87248) [Link] (1 responses)

Using Let's Encrypt (ACME in general) for mail servers can be slightly more complicated than for web servers. Not unsolvable, of course, ist just isn't as natural a fit as LE-with-web-servers.

If you use the http01 challenge type, you need to have a web server on the IPs all of those host names used in the certificate resolve to. This is often undesirable for mail servers or clashes with NAT situations were you only have a single public IP & your mail & web servers are behind that on different servers.

If you want to use dns01, on the other hand, you must use a DNS provider that provides some kind of API for automated DNS updates. And believe me, there are tons out there that don't have an official API and only crappy web pages.

Last but not least a lot of mail servers actually have some kind of appliance sitting in front of them for anti-spam and anti-malware services. Again, while some of them have APIs for automation or even direct support for LE, a lot of them still have neither.

All that being said, I do use LE for most (all?) mail servers I admin (with dns01 challenges & providers that have sane APIs + centralized certificate distribution due to tools such as Ansible). It just takes some more effort.

ACME for email servers

Posted Aug 19, 2021 23:30 UTC (Thu) by tialaramex (subscriber, #21167) [Link]

Interestingly, although the situation for most protocols is like that by design, email is different and it would be plausible for Let's Encrypt (or another ACME CA, perhaps one specialising in mail servers) to make your life easier here.

As de facto stand-ins for the relying parties, Web Browser vendors (approximately OS vendors, since today the two are almost the same modulo Mozilla) in practice set the rules for the Web PKI. The CA/ Browser forum or CA/B Forum is a standing meeting that sprang into existence because both groups were unhappy with the status quo in about 2010. What began as essentially horse-trading (CAs get a shiny new UI feature to sell, browsers get at least some sort of rules beyond "Trust me") evolved into an ongoing process to considerably reform the Web PKI and that produced the Baseline Requirements. CA/B BRs are in a sense the basic rules for how the Web PKI works, they're agreed upon by (sufficient majorities of) both groups.

The CA/B BRs used to provide a handful of very generally worded methods by which a CA could decide if you are who you say you are, and then said, "Any other method" explaining that a CA could (and they all did) just choose to pick their own methods that they determined were good enough. At about the same time as Let's Encrypt comes into existence (and it's no coincidence) there was effort to formalise some specific methods and eliminate "Any other method". The eventual vote on this led to a debacle in CA/B the greater meaning of which I leave to historians to describe, but since the CA/B is voluntary Mozilla just enforced the agreed new rules anyway, irrespective of whether the CA/B ratified them (it eventually did) and so the "Ten Blessed Methods" (as I will persist in calling them, although there aren't currently ten of them) era began.

Let's Encrypt from the outset used the Ten Blessed Methods approach, other CAs had to adopt it once Mozilla made it a condition of trust (and then the CA/B BRs made it mandatory too). In this approach the CA/B must have specifically adopted the method you want to use to prove you control a DNS name. http-01 for example is an implementation of 3.2.2.4.19 Agreed‑Upon Change to Website ‑ ACME, and dns-01 is 3.2.2.4.7 DNS Change.

Now, as a result of this restriction you can't just make up some rule for an arbitrary protocol like "Connect to the IRC server on port 1234 and ask for Jim, if Jim says it's OK you can issue a certificate". But, for email there already are Blessed Methods and you could (but Let's Encrypt does not) leverage those to implement an automated issuance scheme. Whether the effort needed makes any sense when you could just engineer the DNS records and the vast majority of mail server admins actually can do that already, I do not know.

For example 3.2.2.4.13 Email to DNS CAA Contact seems eminently suitable for automation _if_ somebody wants to put all the work in. In fact I believe some work in that direction took place on the ACME working group, but of course without a public CA offering it that's no practical use for public mail servers. I personally have no interest in this work because unlike dns-01 it's unclear how it can be secured over the longer term.

STARTTLS considered harmful

Posted Aug 18, 2021 4:27 UTC (Wed) by derobert (subscriber, #89569) [Link]

I run my own mailserver and use Let's Encrypt, wwhich works fine. Both administration-wise and performance-wise, enabling TLS is insignificant. Spam filtering, deliverability, etc. are the hard things; TLS is trivial.

Honestly, I already have a list of domains configured in that (a) require TLS and (b) verify the cert. E.g., if I send something to a Gmail address, it will verify that and (eventually) bounce if it can't securely send. It doesn't take many domains to cover a good portion of outgoing email (especially on my small mailserver).

STARTTLS considered harmful

Posted Aug 19, 2021 18:44 UTC (Thu) by shx (subscriber, #105604) [Link]

Regarding the kicking users out of service - years ago I would've expected something like that as well. Around two years post Snowden I worked for a television station focused on DACH states, and by accident someone reconfigured the outbound SMTP service for all the newsletters to enforce STARTTLS for the sending part. To my surprise we noticed only days later that the mail queue was filling up slowly, because except for something like two self hosted mailserver and one bigger provider in Switzerland everyone offered STARTTLS. Sadly I don't have any similar numbers for other geographic regions, but for the DACH states I believe enforcing STARTTLS is absolutely possible without forcing users to prefer other means of communication. That shift might happen anyway, but from my point of view not due to email improving the transport security a little bit.

STARTTLS considered harmful

Posted Aug 18, 2021 5:01 UTC (Wed) by gdt (subscriber, #6284) [Link] (1 responses)

It depends what you think 'the problem' is. Emails at rest would still be unencrypted, and thus liable to be read or altered.

Even with encryption of the email body, across-the-wire encryption is still needed to defeat traffic analysis of intercepted email headers. Such interception and analysis on a broad scale allows relationships between people to be deduced.

STARTTLS considered harmful

Posted Aug 18, 2021 5:10 UTC (Wed) by NYKevin (subscriber, #129325) [Link]

Unless you are specifically alluding to E2EE over email with something like PGP (which I personally wrote off as an utterly hopeless endeavor* about five years ago), encryption at rest is an entirely unrelated problem, which each host can solve as it sees fit. There is no reason for the protocol to become involved in the minutiae of how a given endpoint encrypts its files/disks and rotates its keys.

* There's no PKI, there's no reasonable UI or UX, normal people are either unwilling or unable to understand what a "public key" even is, let alone sign other people's keys, https://xkcd.com/1181/, Signal already provides most of this functionality anyway, etc.

STARTTLS considered harmful

Posted Aug 18, 2021 8:53 UTC (Wed) by kleptog (subscriber, #1183) [Link] (1 responses)

Gmail apparently for 5 years already notifies users if their email came over an unencrypted link. Or if they're sending to someone whose mail-server does not support encryption.

https://techcrunch.com/2016/02/09/gmail-now-warns-users-w...

I'm pretty sure that this had impact because in the beginning I occasionally got emails tagged this way but not in a while now. And this is the right way to approach it: let users know how their email is being handled so they can make choices.

I'm not sure if any other services implemented this though.

STARTTLS considered harmful

Posted Aug 29, 2021 9:35 UTC (Sun) by nilsmeyer (guest, #122604) [Link]

For spam filter, rspamd also includes the possibility to score servers that don't use TLS worse than those that do. Looking through a (recent) sample of my e-Mail, 60% of spam doesn't use TLS, all "ham" does use TLS.

STARTTLS considered harmful

Posted Aug 18, 2021 7:30 UTC (Wed) by james (guest, #1325) [Link] (13 responses)

Apparently, Denmark requires encryption on sensitive data sent by email. I've had to enable STARTTLS on our MX servers at work because Danish banks and lawyers have configured their email servers not to send email at all over unencrypted links. And yes, the email won't flow without TLS and will when it's turned on.

It's easy to see how discouraging STARTTLS in SMTP could make things worse, not better.

STARTTLS considered harmful

Posted Aug 18, 2021 10:15 UTC (Wed) by taladar (subscriber, #68407) [Link] (12 responses)

Nobody is saying STARTTLS should be replaced by unencrypted connections. This is about immediately encrypted SMTP vs. unencrypted connections upgraded via STARTTLS.

STARTTLS considered harmful

Posted Aug 18, 2021 10:54 UTC (Wed) by james (guest, #1325) [Link] (11 responses)

Immediately encrypted SMTP is not a thing, as far as transfer across the Internet to an MX server is concerned. It could be, but you'd have to start by getting a port reserved -- and then persuade everyone to use it.

You would not want to re-use 465: there are good reasons, including firewalling and spam filtering, to be able to distinguish message submission from message transfer. For example, port 25 is widely blocked or rerouted in firewalls, whereas 465 or another port wouldn't be. That means if people started having MX servers listening on port 465 (or another port), spammers would be able to send spam from compromised PCs on networks that block port 25 but don't block 465. It would be possible to filter the majority of that out, at the cost of CPU time, memory usage and bandwidth: this isn't exactly appealing to MX server operators.

The alternatives I'm worried about are proprietary messaging protocols using custom software or web-based message portals, possibly with email notification that "there is a message for you to read". Senders can roll that out without waiting for the Internet to adopt a new protocol.

STARTTLS considered harmful

Posted Aug 18, 2021 11:22 UTC (Wed) by Jonno (guest, #49613) [Link] (2 responses)

> You would not want to re-use 465: there are good reasons, including firewalling and spam filtering, to be able to distinguish message submission from message transfer.

Yes, that is why port 25 & 465 is designated for message *transfer*, while port 587 is designated for message *submission*.

STARTTLS considered harmful

Posted Aug 18, 2021 17:57 UTC (Wed) by james (guest, #1325) [Link]

Unfortunately, even if port 465 is designated for message transfer, it's used for message submission, making it unsuitable for use as a message transfer port for the reasons I indicated.

STARTTLS considered harmful

Posted Aug 19, 2021 9:54 UTC (Thu) by jschrod (subscriber, #1646) [Link]

RFC 8313 says otherwise; 465 is a submission port.

https://datatracker.ietf.org/doc/html/rfc8314#section-7.3

STARTTLS considered harmful

Posted Aug 18, 2021 19:51 UTC (Wed) by miquels (guest, #59247) [Link] (7 responses)

> You would not want to re-use 465

Too late. Has already been done. It is officially registered at IANA as "message Submission over TLS protocol".

Port 465 used to be implicit SMTP over TLS, "smtps", but since you cannot indicate using an MX record that your server wants to accept mail on TLS/465 instead of plain/25, this was revoked. Port 465 was assigned to another service. However, lots of client software was already using port 465 for mail submission, so port 465 was resurrected and is now "submissions" (submission s).

This is described in more detail in https://datatracker.ietf.org/doc/html/rfc8314#section-7.3 .

STARTTLS considered harmful

Posted Aug 19, 2021 8:50 UTC (Thu) by chris_se (subscriber, #99706) [Link] (1 responses)

Interesting.

I do remember though that I've been behind countless firewalls that blocked both 25 and 465 indiscriminately (in order to hinder clients from directly sending spam from that network), which is why I've only ever used 587 (with STARTTLS) for authenticated mail submission since at least 2008 or so. Has your experience with port 465 been any better in more recent years?

STARTTLS considered harmful

Posted Aug 19, 2021 19:09 UTC (Thu) by miquels (guest, #59247) [Link]

> Has your experience with port 465 been any better in more recent years?

Well yes, at my ISP all of 25/465/587 work, and large mail providers like gmail etc are also not a problem.
Now I actually happen to work at said ISP as well :) so I just asked our main mail guy for some numbers as to the relative usage of 25/465/587 on our SMTP submission servers. That is, the servers that our customers connect to to send outgoing mail. Note that we require clients to always use TLS, either STARTTLS on 25 or 587, or implicit on 465.

port  % of connections
25	60.5
465	24.8
587	14.6

STARTTLS considered harmful

Posted Aug 19, 2021 18:28 UTC (Thu) by NYKevin (subscriber, #129325) [Link] (4 responses)

> Port 465 used to be implicit SMTP over TLS, "smtps", but since you cannot indicate using an MX record that your server wants to accept mail on TLS/465 instead of plain/25, this was revoked. Port 465 was assigned to another service.

I'm sure this made sense at the time, but by modern standards, this is dumb. They could've just invented a format and stuffed it into TXT records, or even just specified "try 465 first, and fallback to 25 if it fails."

(Yes, I know that resolving exotic DNS records such as TXT was a very questionable thing at the time they made this decision. I'm also aware that implicit fallback carries many of the same problems as STARTTLS. My point is that this is not a decision you would make today - in the long run, those are eventually-solvable problems, and "everything should be encrypted" is a much more widely accepted position now than it was at the time.)

STARTTLS considered harmful

Posted Aug 19, 2021 19:13 UTC (Thu) by miquels (guest, #59247) [Link] (2 responses)

> Yes, I know that resolving exotic DNS records such as TXT was a very questionable thing at the time they made this decision.

If only web browsers had asked for SRV records from the start, then usage of SRV would be much more wide spread and perhaps even mail servers would look at them. Oh well.

STARTTLS considered harmful

Posted Aug 19, 2021 21:35 UTC (Thu) by rodgerd (guest, #58896) [Link] (1 responses)

There are a lot of what-ifs. What if the MX priority record had been generalised so that other protocols baked failover in, doing away the pain of faking it with short TTLs and similar hackery.

STARTTLS considered harmful

Posted Aug 19, 2021 23:00 UTC (Thu) by tialaramex (subscriber, #21167) [Link]

There is more activity today in DNS because of DPRIVE and other work (which has the purpose of improving privacy, but the effect of reducing the impact of rusted-in-place "security" appliances) than we were seeing through say the 1990s or 2000s. SVCB and HTTPS records provide a much richer feature set than generalising MX, indeed the intention as I understand it is that HTTPS will contain enough information that your client can go from "I want https://clown-porn.example.com/" to a set of IPv4 or IPv6 addresses, TCP or UDP port numbers, keys to encrypt initial setup and a masking name like only-cats.example.com in a single DNS request so that it's then equipped to do an encrypted HTTP transaction to the URL you wanted, no further extra roundtrips.

The next generation happy eyeballs algorithms are trying to guess in advance whether to try say, IPv6 QUIC to server A or go with IPv4 TLS to server B or just do both and throw away whichever was slowest, learning from recent experience.

STARTTLS considered harmful

Posted Aug 21, 2021 14:29 UTC (Sat) by HenrikH (subscriber, #31152) [Link]

Try 465 first and then 25 if it fails would be open to MITM blocking just like STARTTLS, not to mention the added latency.

STARTTLS considered harmful

Posted Aug 18, 2021 8:51 UTC (Wed) by chris_se (subscriber, #99706) [Link]

While I think that avoiding STARTTLS for POP3 and IMAP is very reasonable -- there's no good reason not to just use the TLS only ports if you require encryption anyway, and in all my configurations for POP3 and/or IMAP I've only kept the TLS only ports open in more than a decade. (First with self-signed certificates, then with Let's Encrypt.)

That doesn't work for SMTP though: there are three SMTP ports: 25 (cleartext, potential STARTTLS), 465 (TLS only) and 587 (cleartext, potential STARTTLS). The ports 25 and 465 are generic ports where any type of mail may be sent to, while 587 is reserved for submission by users of that mail server. To avoid spam there are many, many networks that block ports 25 and 465 for local clients, so configuring your local mail client to send mail to port 465, especially if you're on a mobile device, just won't work in practice, you'll end up in situations where you can't send mails.

If people came up with a TLS-only port that has the same semantics as 587, then sure, drop STARTTLS, and simple use SMTP over TLS directly on that other port. And sure, technically you could configure such a port on your own mailserver, and with the mail client autoconfiguration mechanisms this would even work now -- but for that to gain any real traction such a port would need to be standardized.

STARTTLS considered harmful

Posted Aug 18, 2021 16:32 UTC (Wed) by gnoutchd (guest, #121472) [Link] (3 responses)

For some years implicit TLS was depreciated in favor of STARTTLS (RFC 2595 section 7). This changed with RFC 8314 (dated January 2018). Appendix A cites the history of implementation flaws as a primary reason why the authors changed their minds about STARTTLS.

Honestly, I never quite understood why we bothered with STARTTLS. Implicit TLS is so simple to implement that a power user armed with stunnel can pull it off. Compared to that, STARTTLS always seemed like a lot of trouble for marginal benefit.

STARTTLS considered harmful

Posted Aug 18, 2021 16:42 UTC (Wed) by gnoutchd (guest, #121472) [Link]

s/depreciated/deprecated/, of course. *sigh*

STARTTLS considered harmful

Posted Aug 18, 2021 17:52 UTC (Wed) by HenrikH (subscriber, #31152) [Link]

Well for one it allowed people to enable TLS without having to open new ports in their firewalls. I work in the financial sector and having the IT department of a Bank to open a port is both something that take ages and also something that requires lots and lots of persuasion.

STARTTLS considered harmful

Posted Aug 25, 2021 14:33 UTC (Wed) by MarcB (subscriber, #101804) [Link]

STARTTLS was initially much easier to implement. No change to any infrastructure, just additional functionality on the application level in form of a backward compatible protocol extension. Very elegant - until you face the details and pitfalls.

Also, keep in mind that TLS for SMTP is inherently weaker than TLS for HTTP due to the MX indirection: Unless the MX record is protected via DNSSEC a man-in-the-middle attacker can bypass even implicit TLS by manipulating the MX query result. This is why "opportunistic encryption" was a thing in the first place and encryption without certificate verification still is a thing in the SMTP world.

This has led to constructs like MTA-STS or DANE where either the stronger guarantees of HTTPS are used or DNSSEC is required.

STARTTLS considered harmful

Posted Aug 18, 2021 23:04 UTC (Wed) by tialaramex (subscriber, #21167) [Link] (8 responses)

This is perhaps an odd time to pursue dedicated TLS ports for protocols that are doing STARTTLS. QUIC is finished, if you want to encrypt a protocol and you're happy to do a green field deployment you can use QUIC.

Those who can't transition to QUIC likely also can't transition to TLS on a dedicated port. Part of the reason STARTTLS was popular is that either you're already connecting to this service (and so STARTTLS can't make things worse) or you can't connect (and so by definition it didn't make things worse) whereas adding more TLS ports creates a split and it takes considerable community pressure to make any forward progress (e.g. HTTPS Everywhere).

One thing that changed since the high tide for more dedicated ports (versus just recommending STARTTLS) is DPRIVE (DoH, DoT, and some day DoQ), which means more users actually have a way to get working DNS that isn't tampered with and isn't hot garbage. Another thing that changed was that we figured out which carrots drive adoption of new DNS records in the authoritatives. For example lots of people having working CAA (or at least working *absence* of CAA rather than SERVFAIL) because of Let's Encrypt. Given the choices (a) Our web site says Insecure and some features don't work (b) We pay $$$ to a commercial CA and (c) Fix our DNS server -- it turns out people pick option (c).

In 2001 if you tried to ship encrypted upgrades to a protocol, you couldn't leverage DNS because your records weren't served by anyone and if you could get them served by some miracle they didn't reach your end users. Today you might actually make it work. But, if you can do that, why go to a new dedicated TLS port rather than QUIC?

At least some of the NO STARTTLS findings seem to apply to TLS setups too, the fact is these aren't protocol limitations they're poor quality software, and our experience is that poor quality software isn't fixed by upgrading the protocol. I don't buy for example that "We didn't bother checking the name on the certificate" is the sort of bug that isn't in your non-STARTTLS software.

STARTTLS considered harmful

Posted Aug 19, 2021 6:28 UTC (Thu) by pabs (subscriber, #43278) [Link] (7 responses)

My MUA has for years had a config option to do SMTP over TLS to any TCP port, but adding support for QUIC isn't on the roadmap.

STARTTLS considered harmful

Posted Aug 24, 2021 16:55 UTC (Tue) by flussence (guest, #85566) [Link] (6 responses)

Indeed, the point here is that the SMTPS port and supporting code _already exists_. The only reason it fell out of use was that some netadmins were terminally inconvenienced by having to poke two holes in their firewall instead of one.

And you'd have to do that with QUIC anyway.

STARTTLS considered harmful

Posted Aug 27, 2021 12:12 UTC (Fri) by MarcB (subscriber, #101804) [Link] (5 responses)

It fell out of use, because it didn't add much. Without additional information channels like DANE or MTA-STS you could not assume an MTA to be TLS capable. So if you got a "connection refused", you had to fall back to plain-text anyway. Man-in-the-middle attacks are even simpler than for STARTTLS: simply block the TCP handshake.

Under the assumption of a man-in-the-middle attacker, all SMTP encryption schemes are doomed, unless there is an additional information channel between the legitimate parties (HTTPS for MTA-STS, DNS with DNSSEC for DANE, proprietary solutions for others). For HTTPS this was only so easily fixable, because there were only four clients and client operators.

STARTTLS considered harmful

Posted Aug 31, 2021 14:16 UTC (Tue) by Wol (subscriber, #4433) [Link] (4 responses)

> unless there is an additional information channel between the legitimate parties

And? If receivers consider it important, they simply block the fallback route. Once that becomes common it will become the norm.

And once people like banks start saying "if you want to send me email, you MUST support encrypted", then the rest of the world will probably follow.

(Oh, and if mail follows a diversion to get round the fact it can't send direct, the recipient can flag it "received via an intermediary, this is untrusted". Again, it's under the control of the *recipient*, who *wants* security, and it provides pressure in the system for upgrading to good behaviour.)

Cheers,
Wol

STARTTLS considered harmful

Posted Sep 10, 2021 20:24 UTC (Fri) by nix (subscriber, #2304) [Link] (3 responses)

> And once people like banks start saying "if you want to send me email, you MUST support encrypted"

Really? How often do you send an email to your bank? (In my case, never ever in all my life.)

I frankly doubt this will be any kind of driver of adoption.

STARTTLS considered harmful

Posted Sep 10, 2021 21:00 UTC (Fri) by pizza (subscriber, #46) [Link] (1 responses)

> Really? How often do you send an email to your bank? (In my case, never ever in all my life.)

Dunno about that; it's quite common for banks (and medical offices) now all have "secure portals" for sending and receiving "electronic messages" via UIs that would make the worst of 1990s webmail pleasant in comparison.

STARTTLS considered harmful

Posted Sep 10, 2021 21:43 UTC (Fri) by Wol (subscriber, #4433) [Link]

Yup. I'm on the verge of complaining about my local coumcil, because they're sending our bills to my wife (despite being addressed to me), and sending it via an "encrypted portal".

Seeing as it's a bill, I believe they have a legal obligation to tell us what we're supposed to be paying. Personally, I don't think the electronic equivalent of postie's "sorry you weren't in you need to come to the post office to collect it", isn't good enough. And sending a bill - addressed to me - to my wife's email address, surely that's a big GDPR problem, along with all the laws about keeping accurate computer records ...

Still, I doubt I'll do anything about it 'til I have to ...

Cheers,
Wol

STARTTLS considered harmful

Posted Sep 10, 2021 21:36 UTC (Fri) by Wol (subscriber, #4433) [Link]

In the case of bank employees, quite a lot I would guess :-)

In the case of customers, I would like to be able to send cryptographically *signed* emails, but I can't see that happening.

Cheers,
Wol

STARTTLS considered harmful

Posted Aug 19, 2021 0:45 UTC (Thu) by scientes (guest, #83068) [Link] (6 responses)

You write "TLS" over and over again, but you do not know anything about ASN.1 because it is sucks. While it does not have certificates, WireGuard does not need this ASN.1 non-sense, which is so horrible that only the picoTLS library implements RFC 7250 Raw Public Keys that allows using encryption without X.509. This fact shows that the people using these protocols don't understand what they are using and why, which is always a bad sign.

In short:

ASN.1
X.509
(Hence TLS from Netscape, and they just _had_ to change the name from SSL because the world always needs more TLAs)

Considered harmful, and the things built on these pieces of trash, while poop by association, are a waste of time, like eBPF.

STARTTLS considered harmful

Posted Aug 19, 2021 2:04 UTC (Thu) by mjg59 (subscriber, #23239) [Link] (1 responses)

> While it does not have certificates, WireGuard does not need this ASN.1 non-sense

You can certainly have certificates without ASN.1 (as SSH demonstrates), but when you're relying on services to be able to establish trust with other services that are run by entirely separate people, you're going to want some sort of PKI. All the code for dealing with the horrible aspects of ASN.1 has already been written, so why not just re-use the existing web PKI rather than inventing something that would require entirely new infrastructure?

STARTTLS considered harmful

Posted Aug 31, 2021 15:18 UTC (Tue) by mstone_ (subscriber, #66309) [Link]

> why not just re-use the existing web PKI rather than inventing something that would require entirely new infrastructure?

It's not clear that inventing the new infrastructure would be harder than securing all existing code (and any new implementation) that tries to do ASN.1 and X.509. Experience has shown that it's just too easy to screw up your TLS implementation, and it's basically certain that new critical implementation flaws will be found soon. Sadly, experience has also shown that getting something new on the internet isn't easy either--so smart money will bet that we'll just keep drifting in apathy, with everything kind of working except when it doesn't.

STARTTLS considered harmful

Posted Aug 19, 2021 9:08 UTC (Thu) by chris_se (subscriber, #99706) [Link]

> You write "TLS" over and over again, but you do not know anything about ASN.1 because it is sucks.

Yeah, ASN.1 is way too complicated. But unfortunately nobody has proposed an actual alternative that has gained any kind of traction. Sure, in fixed deployments you don't need a PKI, but some kind of high-level key attestation mechanism is required for most use cases. Honestly, I'd love to see something way better in this space.

In general I'd like to observe that most crypto solutions are just plain horrible when it comes to the parts that aren't the core crypto itself, or in the other extreme they are overly simple so that many use cases can't be handled with them. I have yet to see something that strikes a good balance here.

> While it does not have certificates, WireGuard does not need this ASN.1 non-sense

But Wireguard only provides the low-level channel, and any Wireguard-based solution that actually competes with other available VPNs implements some manner of control plane external to the actual Wireguard protocol.

STARTTLS considered harmful

Posted Aug 19, 2021 10:01 UTC (Thu) by jschrod (subscriber, #1646) [Link] (2 responses)

Do you have anything to say about the actual topic of the article?

If yes, can you tell it like an adult without using childish faecal cuss words?

STARTTLS considered harmful

Posted Aug 22, 2021 9:30 UTC (Sun) by scientes (guest, #83068) [Link] (1 responses)

But you are doing the same thing the article and STARTTLS is doing.

You walk up to someone, say hi, and then demand they show you their identification.

Fuck you buddy.

STARTTLS considered harmful

Posted Aug 22, 2021 12:20 UTC (Sun) by Wol (subscriber, #4433) [Link]

Just don't walk into a drug store or off-licence ...

Cheers,
Wol

STARTTLS considered harmful

Posted Aug 19, 2021 12:28 UTC (Thu) by stybla (subscriber, #64681) [Link] (4 responses)

meddler-in-the-middle?

STARTTLS considered harmful

Posted Aug 19, 2021 13:22 UTC (Thu) by mathstuf (subscriber, #69389) [Link] (3 responses)

Seems more apt to me. A "man-in-the-middle" that was (almost) always represented as "Eve" (a fairly typical feminine name thanks to Genesis, but probably more reminiscent of "evil" for their role in communication examples) rather than "Evan" or even "Evel" (as in Knievel) is something that feels odd now that it's been brought to my attention.

A meddler also doesn't need to actively meddle; they can be in the "information gathering" stage to know what best to meddle with. Given the rise of automated enforcement, humans may not even be involved anymore too. And it's certainly not as awkward as some replacements like "chairperson" for sure, I find this to be a strict improvement while also keeping the MITM initialism.

STARTTLS considered harmful

Posted Aug 19, 2021 14:05 UTC (Thu) by excors (subscriber, #95769) [Link] (2 responses)

> A "man-in-the-middle" that was (almost) always represented as "Eve" (a fairly typical feminine name thanks to Genesis, but probably more reminiscent of "evil" for their role in communication examples) rather than "Evan" or even "Evel" (as in Knievel) is something that feels odd now that it's been brought to my attention.

"Eve" was chosen because it's reminiscent of "eavesdropper", which appears to be etymologically unrelated to "evil". And I think Eve is usually a passive MITM (i.e. one who observes but does not meddle), whereas an active MITM is more likely to be a Mallory (from "malicious"), which is a useful distinction to preserve.

If you do want a name reminiscent of evil, "Evel" is probably a bad choice, because Evel Knievel allegedly chose that spelling specifically to avoid that association (https://evelknievel.com/pages/the-man):

> After a police chase in 1956, in which he crashed his motorcycle, Knievel was taken to jail on a charge of reckless driving. When the night jailer came around to check roll call, he noted Robert Knievel in one cell and William Knofel in another. Knofel was well known as “Awful Knofel” (“awful” rhyming with “Knofel”) so Knievel began to be referred to as Evel Knievel (“Evel” rhyming with “Knievel”). He chose this misspelling because of his last name and because he didn’t want to be considered “evil”.

STARTTLS considered harmful

Posted Aug 19, 2021 15:04 UTC (Thu) by mathstuf (subscriber, #69389) [Link] (1 responses)

Ah, I missed the "eavesdropper" link. I don't think this is mentioned in most Alice/Bob scenarios (where I've picked it up through repetition rather than through any structured lesson about the terms).

Didn't know that about Knievel. I knew it was because it rhymed, but missed the explicit spelling and thought it was just copied from his last name.

STARTTLS considered harmful

Posted Aug 24, 2021 20:35 UTC (Tue) by stybla (subscriber, #64681) [Link]

Thank you both for clarification :)


Copyright © 2021, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds