skip to content

STARTTLS, MTA-STS & DANE

SMTP encrypts by STARTTLS on ports 25 and 587 or implicit TLS on 465, and an attacker can strip opportunistic STARTTLS. Interviewers ask how MTA-STS, DANE and TLS-RPT enforce it.

on this pageshow

questions

6

Why does opportunistic STARTTLS between mail servers not guarantee an encrypted, authenticated hop, and what can a domain do about it?

level: juniorimportance: must knowfreq 50%

answer

  1. the offer itself travels in cleartext
  2. best effort by design
  3. any certificate is accepted
  4. the MX name comes from unsigned DNS
  5. policies that make TLS required

basics

~20 s

The STARTTLS offer arrives in cleartext, so an on-path party can remove it and the sender, by design, carries on unencrypted; opportunistic senders also accept any certificate. MTA-STS, DANE or per-destination mandatory TLS make the hop required and authenticated.

solid answer

~50 s

Between MTAs, TLS is **opportunistic**: the server lists `STARTTLS` in its cleartext `EHLO` reply, and the sender uses TLS if it sees the offer and sends in the clear if it does not. RFC 3207 itself notes that deleting the `250 STARTTLS` line from the reply turns the session into plaintext, and neither end can tell that from a peer that simply lacks TLS. Even when TLS is negotiated, an opportunistic sender does not verify the certificate name, because the MX host name came from unsigned DNS; Postfix's `may` level, for example, delivers even when the certificate is untrusted or bears the wrong name. So the hop resists passive eavesdropping but not an active attacker who removes the offer or redirects the connection. The fixes make TLS required: a per-destination mandatory policy in the sending MTA, or a receiving domain's MTA-STS (RFC 8461) or DANE (RFC 7672) records, with TLS reporting (RFC 8460) to see failures.

go deeper

for a junior

Remember that opportunistic means best effort: TLS is used if offered, cleartext otherwise, and any certificate is accepted.

for a middle

Explain why the STARTTLS offer in the cleartext EHLO reply is the weak point and why a forged MX answer defeats an unverified certificate.

for a senior

Show how you would detect silent downgrades with Received fields, sender logs and TLS reports, and which per-destination policy you would set for a sensitive partner.

for a principal

Weigh the controls: sender-side mandatory TLS for named partners against publishing MTA-STS or DANE for everyone, and what each costs when the other side misconfigures.

## What "opportunistic" means here **Opportunistic TLS** means "encrypt when both sides can, otherwise deliver anyway". It is the default between mail transfer agents (MTAs) for a structural reason: RFC 3207 says a **publicly referenced** SMTP server, the port-25 host that a domain's MX record names, MUST NOT require STARTTLS before accepting mail for local delivery. Senders must therefore be ready to talk to peers without TLS, and so they fall back to cleartext whenever TLS does not happen. Postfix shows the same model in its client settings. At `smtp_tls_security_level = may` it uses TLS if the remote server offers it and otherwise sends in plaintext, and after a failed TLS handshake it retries without TLS once the message has waited `minimal_backoff_time` in the queue. postconf(5) gives `may` as the default from Postfix 3.11 (with `compatibility_level` 3.11); earlier releases left it empty, which meant no TLS unless older settings enabled it. ## Where the downgrade happens The weakness is that the decision to encrypt is negotiated in the clear: 1. The sender connects to port 25 and reads the cleartext greeting. 2. It sends `EHLO` and receives the extension list, still in cleartext. 3. If `STARTTLS` is in that list, it upgrades; if not, it continues without TLS. RFC 3207 section 6 names the risk directly: removing the `250 STARTTLS` line from the server's reply makes the client never try TLS. RFC 8461 and RFC 7672 repeat it as the reason they exist. This is stated here as the exposure a policy closes, not as a technique: the point for a defender is that **nothing the receiving server does during the session can prevent it**, because the sender is the party that decides to continue in cleartext. ## Encryption without authentication Even when the session is encrypted, an opportunistic sender usually does not check whom it is talking to: - The MX host name came from a DNS answer that is normally unsigned, so a forged MX answer could send it to a different server, and checking the certificate against that forged name would prove nothing. - MTAs have no shared list of trusted certificate authorities and no person to "click OK", so strict checking would bounce mail to the many servers with self-signed certificates. - Postfix's documentation states that with opportunistic TLS, delivery continues even if the server certificate is untrusted or bears the wrong name. The result protects against **passive** eavesdropping only. An **active** party who can remove the offer or redirect the connection defeats it. ## Why neither side notices The receiving MTA sees a client that did not issue `STARTTLS`, which is ordinary behaviour for many legitimate senders. The sending MTA sees a server that did not offer it, which is also ordinary. Nothing fails, nothing bounces, and the message is delivered. Evidence appears only after the fact: a Received field without the ESMTPS transmission type or a TLS clause, or a sender's log showing a plaintext session to a host that normally uses TLS. That silence is why reporting (TLSRPT, RFC 8460) is part of the fix. ## What closes the gap | Control | Who sets it | What it requires | Cost | |---|---|---|---| | Per-destination mandatory TLS | The sending MTA's administrator | A policy entry per partner, for example Postfix's `smtp_tls_policy_maps` with `encrypt`, `verify` or `secure` | Does not scale beyond agreed partners; mail is deferred when the partner breaks TLS | | MTA-STS (RFC 8461) | The receiving domain | A `_mta-sts` TXT record, an HTTPS policy file and CA-issued certificates on each MX | The first contact is unprotected until the policy is cached | | DANE for SMTP (RFC 7672) | The receiving domain | DNSSEC-signed zones and TLSA records at `_25._tcp` of each MX | DNSSEC operations, and validating resolvers at senders | | TLS reporting (RFC 8460) | The receiving domain | A `_smtp._tls` TXT record with `v=TLSRPTv1` | Reports only; enforces nothing | The first is chosen by the sender for specific destinations; the next two are published by a receiving domain for every sender that honours them. ## What one encrypted hop does not give you - TLS on SMTP is **hop by hop**. A message may cross several MTAs, and each hop negotiates on its own, so encrypting one says nothing about the next. - The message is stored in cleartext on every server it passes through. Protecting the content itself end to end is message-level encryption, a separate subject. - Authenticating a TLS client says nothing about who wrote the message; sender authentication is handled by other mechanisms.

  • Does the receiving server know that a session was downgraded?
    Generally no. From its side the client simply never issued `STARTTLS`, which many legitimate senders also do. Detection has to come from the sending side or from aggregate reporting: TLSRPT lets senders that honour a domain's policy report sessions that failed to negotiate TLS, and a sudden run of plaintext sessions from a sender that normally uses TLS is the signal to investigate.
  • Why doesn't a sending MTA just verify the server certificate by default?
    Because it would have nothing safe to verify against. The MX host name comes from DNS that is usually unsigned, the recipient domain name is often absent from the MX's certificate because third parties handle much of the mail, and MTAs share no common list of trusted authorities. Strict checking would bounce mail to many legitimate servers without adding protection, which is why verification is switched on per destination or by a published MTA-STS or DANE policy.

Opportunistic STARTTLS is a courier who locks the parcel in a box only if the front desk, speaking through an open window, says it has a key. Anyone standing at that window can answer no, and the courier hands the parcel over unlocked. A required-TLS policy is the recipient telling the courier in advance never to hand over an unlocked parcel.

  • If the server offers STARTTLS, the hop is always encrypted
  • Opportunistic TLS verifies the certificate matches the recipient domain
  • Opportunistic TLS protects a hop against an active on-path attacker
  • TLS on one hop protects the message all the way to the mailbox
  • A downgraded session produces a bounce the sender can see
open as a page

In SMTP, how does STARTTLS on ports 25 and 587 differ from implicit TLS on port 465, and which does RFC 8314 prefer for submission?

level: juniorimportance: must knowfreq 55%

basics

~20 s

STARTTLS (RFC 3207) begins in cleartext and upgrades the same connection; implicit TLS on port 465 handshakes before any SMTP is spoken. RFC 8314 (2018) prefers implicit TLS for submission, while relay between servers stays on port 25 with STARTTLS.

open as a page

How does an MTA-STS policy (RFC 8461) tell sending MTAs to require authenticated TLS, and what do its enforce, testing and none modes change?

level: middleimportance: should knowfreq 32%

basics

~20 s

A domain publishes a _mta-sts TXT record (v=STSv1 and an id) and serves a policy over HTTPS from mta-sts.<domain>/.well-known/mta-sts.txt. Under enforce, senders deliver only to listed MX hosts presenting valid certificates; testing only reports; none withdraws the policy.

open as a page

An SMTP TLS report (RFC 8460) for a partner domain whose MTA-STS policy is in testing shows certificate-host-mismatch on one MX; what happened to that mail, and what must change before enforce?

level: seniorimportance: should knowfreq 16%

basics

~20 s

Senders found that MX's certificate lacked its MX host name, but testing mode let them deliver anyway, most likely over unauthenticated TLS. Before enforce, the MX needs a certificate naming its host, or senders will refuse it and queue the mail.

open as a page

For SMTP between your bank and three partner domains that must never travel in cleartext, how do you choose between bilateral mandatory TLS, MTA-STS enforce and DANE in each direction?

level: principalimportance: should knowfreq 18%

basics

~20 s

Outbound, set a mandatory, authenticated TLS policy per partner in your own MTA. Inbound, publish MTA-STS enforce, DANE if you can run DNSSEC, and TLS reporting, and have each partner pin mandatory TLS toward you.

open as a page

For DANE on SMTP (RFC 7672), where does a receiving domain publish TLSA records, and why are DANE-EE(3) and DANE-TA(2) the usages to use?

level: seniorimportance: nice to knowfreq 12%

basics

~20 s

TLSA records sit at _25._tcp.<MX host> in a DNSSEC-signed zone. DANE-EE(3) pins the server's own key and skips name and expiry checks; DANE-TA(2) pins an issuing CA and keeps name checks. Port-25 records SHOULD NOT use PKIX-TA(0) or PKIX-EE(1).

open as a page