44
Yep! We poked all your mail daemons State of Transport Security in the E-Mail Ecosystem at Large Cert.at ’ – Wilfried Mayer, Aaron Zauner, Marn Schmiedecker, Markus Huber

Yep! We poked all your mail daemons

Embed Size (px)

Citation preview

Page 1: Yep! We poked all your mail daemons

Yep! We poked allyour mail daemonsState of Transport Security inthe E-Mail Ecosystem at LargeCert.at ’16 –Wilfried Mayer, Aaron Zauner,

Mar�n Schmiedecker, Markus Huber

Page 2: Yep! We poked all your mail daemons

Overview

Background

Methodology

Results

Mi�ga�on

2

Page 3: Yep! We poked all your mail daemons

Background

Transport Layer Security• Most widely used cryptographic protocol• Lots of research for HTTP + TLS = HTTPS• Not for other applica�on layer protocols• Especially on high-confiden�ality systemslike E-mail

◦ Durumeric et al. (IMC’15 and 32C3)◦ Holz et al. (NDSS’16)

3

Page 4: Yep! We poked all your mail daemons

Background

E-Mail• Many people use public mail services(E.g. Gmail)

• Millions of smaller mail-daemonson the Internet

• E-mail not invented with security in mind• Crypto se�ngs?

4

Page 5: Yep! We poked all your mail daemons

Background

E-Mail Flow

5

Page 6: Yep! We poked all your mail daemons

Background

Port TLS Protocol Usage25 STARTTLS SMTP Transmission110 STARTTLS POP3 Retrieval143 STARTTLS IMAP Retrieval465 Implicit SMTPS Submission587 STARTTLS SMTP Submission993 Implicit IMAPS Retrieval995 Implicit POP3S Retrieval

6

Page 7: Yep! We poked all your mail daemons

Background

STARTTLS Implicit TLS

7

Page 8: Yep! We poked all your mail daemons

BackgroundTLS Handshake

8

Page 9: Yep! We poked all your mail daemons

BackgroundConcept of Cipher Suites

9

Page 10: Yep! We poked all your mail daemons

Methodology

Cipher Suite Scan

10

Page 11: Yep! We poked all your mail daemons

Methodology

General Process

more than 10 billion TLS handshakes

11

Page 12: Yep! We poked all your mail daemons

Methodology - Scan flow

12

Page 13: Yep! We poked all your mail daemons

MethodologyArchitecture

13

Page 14: Yep! We poked all your mail daemons

Methodology

Considera�ons• People will be pissed off!• ... they even might write to yourmanagement or unrelated 3rd par�es

• ... or call your office• ... or write offensive e-mails

14

Page 15: Yep! We poked all your mail daemons

Methodology

Organiza�on• Inform all responsible people• Depending on local law: maybe even agood team of lawyers

• Upstream ISP that is willing to help

15

Page 16: Yep! We poked all your mail daemons

Methodology - Ethics

Transparent Scanning• WHOIS / RIPE entry explaining• Webpage on the scan host explaining• No a�empt to hide

Abuse contact• Blacklis�ng mechanism• People complained• Handled professionally

16

Page 17: Yep! We poked all your mail daemons

Methodology - Abuse

Some sta�s�cs• 89 e-mails in total (august)• 52 auto generated by IDS• 16 simple blacklis�ng requests• A few were blatantly rude• A few very interested in our work• Spam?

17

Page 18: Yep! We poked all your mail daemons

Methodology - Abuse

You’ll recieve these mails as well

18

Page 19: Yep! We poked all your mail daemons

Methodology - Abuse

19

Page 20: Yep! We poked all your mail daemons

Methodology - AbuseYour scanner stupidly assumes TLS is enabled.... Yourscanner should QUIT a�er ’250 ’ as STARTTLS is notoffered. Root cause: Update your fuckwit scanner toREAD the data it is sent

Default ReplyNo! You’re using the broken tool. You fucking fix the shit

you use.

No reason to swear. I just checked, what the tooleffec�vely does is connect to any server on this port andtry if STARTTLS is supported.

... As I see it, you’re a lazy stupid cunt, who should rot inhell.

20

Page 21: Yep! We poked all your mail daemons

Results

Data Overview• 20,270,768 scans conducted• 18,381,936 valid reponses• 7 TCP ports, 5 TLS versions• ∼10 billion TLS handshakes

◦ Combinatorial explosion - protocols, ports,ciphersuites and SSL/TLS versions

• 90% rejected — 8% accepted — 2% error• April to August 2015

21

Page 22: Yep! We poked all your mail daemons

Results

Protocol Version Support

0

10

20

30

40

50

60

70

80

90

100

SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2

%

25110143465587993995

22

Page 23: Yep! We poked all your mail daemons

Results

Protocol Version Support

Only 25 465 587 RetrievalSSLv2 and SSLv3 0.2% 0.0% 0.0% 0.1%TLSv1.1 and TLSv1.2 0.1% 0.0% 0.5% 0.1%TLSv1 upwards 8% 45% 18% 32–37%

23

Page 24: Yep! We poked all your mail daemons

ResultsKey-exchange securityDiffie-Hellman - DH(E):

• Large amount of 512bit DH primes inSMTP (EXPORT!)

• DH group size below or equal to 1024 bitis very common in all protocols

Ellip�c Curve Diffie-Hellman - ECDH(E):• SMTP: 99% use secp256r1 curve• POP/IMAP: about 70% use secp384r1cuve

• Most use 256 bit group size24

Page 25: Yep! We poked all your mail daemons

Results

Key-exchange security: common primes• SMTP: a 512 bit prime used by 64%, a1024 bit prime used by 69% (Pos�ix)

• 512 bit Pos�ix prime:0x00883f00affc0c8ab835cde5c20f55d

f063f1607bfce1335e41c1e03f3ab17f6

635063673e10d73eb4eb468c4050e691a

56e0145dec9b11f6454fad9ab4f70ba5b

25

Page 26: Yep! We poked all your mail daemons

ResultsServer-preferred TLS 1.0 ciphersuitesTLS 1.0 most widely supported (above 90%support in each mail protocol):

• DHE-RSA-AES256-SHA25: 49.64% 110: 68.03% 143: 67.89% 465: 79.32%587: 47.72% 993: 68.39% 995: 69.65%

• ECDHE-RSA-AES256-SHA

25: 43.67% 110: 6.44% 143: 6.84% 465: 11.49%587: 23.01% 993: 7.43% 995: 6.13%

• AES256-SHA

25: 4.94% 110: 17.67% 143: 17.89% 465: 7.17% 587:16.41% 993: 17.23% 995: 17.25%

26

Page 27: Yep! We poked all your mail daemons

0

20

40

60

80

100

RC4 PFS AES-256 (GCM) Export grade

%

25110143465587993995

27

Page 28: Yep! We poked all your mail daemons

ResultsAUTH-PLAIN

• Not everything is crypto related• If you do plaintext authen�ca�on beforeyou upgrade to TLS, one can sniff/strip

• While some hosts offer AUTH-PLAINwithout STARTTLS support, a lot offer itbefore doing an upgrade

Port no STARTTLS STARTTLS Total Hosts25 12.90% 24.21% 7,114,171110 4.24% 63.86% 5,310,730143 4.38% 66.97% 4,843,513587 15.41% 42.80% 2,631,662

28

Page 29: Yep! We poked all your mail daemons

Results

LOGINDISABLED IPs PercentLOGINDISABLED 342,124 7.06%No LOGINDISABLED 4,501,389 92.94%

29

Page 30: Yep! We poked all your mail daemons

ResultsX.509 Cer�ficates: self vs. CA-signed

0

10

20

30

40

50

60

70

ssc ok local ssc chain

%

SMTPSSMTP

IMAPSIMAP

POP3SPOP3

Compared to Mozilla Truststore:ssc: self-signed, ok: CA signed, local: unable to get local issuer, ssc chain: self-signed in chain

30

Page 31: Yep! We poked all your mail daemons

ResultsX.509 Cer�ficates (cont.)

• 99% of leafs use RSA (vs. e.g. ECDSA)• Most SMTP(S) leafs and intermediatesabove 1024bit RSA (most 2k)

• Less than 10% use 4096bit RSA public keys• SHA1 Fingerprint: b16c...6e24 wasprovided on 85,635 IPs in 2 different /16 IPranges

Name Key Size IPsParallels Panel - Parallels 2048 306,852imap.example.com - IMAP server 1024 261,741Automa�c. . .POP3 SSL key - Courier Mail Server 1024 87,246Automa�c. . . IMAP SSL key - Courier Mail Server 1024 83,976Plesk - Parallels 2048 68,930localhost.localdomain - SomeOrganiza�onalUnit 1024 26,248localhost - Dovecot mail server 2048 13,134plesk - Plesk - SWso�, Inc. 2048 14,207

31

Page 32: Yep! We poked all your mail daemons

Common Name (Issuer Common Name) Fingerprint Port IPs*.nazwa.pl (nazwaSSL) b16c. . .6e24 25 40,568

465 81,514587 84,318993 85,637995 85,451

*.pair.com (USERTrust RSA Organiza�on . . . ) a42d. . . 768f 25 15,573110 60,588143 13,186465 63,248587 61,933993 64,682995 64,763

*.home.pl (RapidSSL SHA256 CA - G3) 8a4f. . .6932 110 126,174143 26,735587 125,075

*.home.pl (AlphaSSL CA - SHA256 - G2) c4db. . .a488 993 128,839995 126,102

*.sakura.ne.jp (RapidSSL SHA256 CA - G3) 964b. . . c39e 25 16,573*.prod.phx3.secureserver.net (Starfield . . . ) f336. . .ac57 993 61,307

995 61,250

Table: Common leaf cer�ficates

32

Page 33: Yep! We poked all your mail daemons

ResultsX.509 Cer�ficates: weak RSA keys

• Analyzed 40,268,806 collectedcer�ficates similar to Heninger et al.“Mining Your Ps and Qs”

• 30,757,242 RSA moduli• 2,354,090 uniques• Fast-GCD (algo. due to djb, impl. due toHeninger et al.)

• 456 GCDs found (= RSA private keysrecovered)

33

Page 34: Yep! We poked all your mail daemons

Results

Collateral damage• open-source mail daemons are easilyDoS’ed - test carefully

• (re)discovered a dovecot bug:(CVE-2015-3420, inves�gated andreported by Hanno Boeck)

34

Page 35: Yep! We poked all your mail daemons

Results

Collateral damage• OpenSSL will establish EXPORTciphersuites with TLS 1.1 and 1.2 (althoughthe spec explicitly says MUST NOT).Core-team reponse: confusion and finally”not a security issue”. you areimplemen�ng a network security / cryptoprotocol the wrong way?! (AFAIK unfixed)

35

Page 36: Yep! We poked all your mail daemons

Mi�ga�onSolid server configura�ons & awareness

• bettercrypto.org

• Mozilla Server TLS Security guidehttps://wiki.mozilla.org/Security/Server_Side_TLS

• RFC 7457 Summarizing Known A�acks onTLS and DTLS

• RFC 7525 Recommenda�ons for SecureUse of TLS and DTLS

• Educa�ng administrators, managers andopera�onal people

36

Page 37: Yep! We poked all your mail daemons

Mi�ga�on

Key pinning• Public keys get pinned on first use (TOFU)• Elegant solu�on but difficult deploymentmodel (non-technies won’t deploy)

• HPKP (for HTTPS) available, not reallydeployed yet

• TACK(.io) is a universal TLS extension thatwould also fit e.g. STARTTLS protocols(deadlocked in IETF)

37

Page 38: Yep! We poked all your mail daemons

Mi�ga�on

DNSSEC / DANE• DANE is a very nice protocol but:• DNSSEC shi�s trust to TLDs instead of CAs• DNSSEC has huge deployment problems(especially on end-user devices)

• It’s s�ll one op�on that could work, sowhy not deploy in addi�on?

38

Page 39: Yep! We poked all your mail daemons

Mi�ga�on

Especially if you’re hos�ng a large environmentyouMUST deploy:

• DKIM (DomainKeys Iden�fied Mail)• SPF (Sender Policy Framework)• DMARC (Domain-based MessageAuthen�ca�on, Repor�ng, andConformance)

39

Page 40: Yep! We poked all your mail daemons

Mi�ga�onNew efforts in IETF and beyond

• DEEP (Deployable Enhanced Email Privacy) -similar to how HSTS works for HTTPS (MUA toServer)

• Let’s Encrypt by EFF et al. (600,000 certs)• draft-ietf-uta-email-tls-certs-05:Iden�ty verifica�on forSMTP/POP/IMAP/ManageSieve updates variousRFCs

• IETF works on a new OpenPGP spec• Con�nued scans necessary to track change over�me

• Publish all data sets!40

Page 41: Yep! We poked all your mail daemons

Mi�ga�on - MTA to MTA

SMTP-STS (”Strict Transport Security”)Pro:

• Good feedback Loop to detect ac�ve MITM• Might work well for large ISPs/ESPs and protect atleast this mail volume

41

Page 42: Yep! We poked all your mail daemons

Mi�ga�on - MTA to MTASMTP-STS (”Strict Transport Security”)Con:

• Engineered by & only built for large Mail hos�ngCompanies

• Issues with Threat Model & Deployment at Scalehttps://github.com/mrisher/smtp-sts/issues/1

• Somewhat depends on DNSSEC• Reinvents the wheel for public key pinning /caching

• Out-of-band authen�ca�on via Webserver and‘.well-known‘ URL m(

42

Page 43: Yep! We poked all your mail daemons

Mi�ga�on - MTA to MTA

Working on a updated, fi�ed TACK(.io) plusSMTP extension solu�on for MTA-MTA security

• We need operator feedback• We need ac�ve tes�ng• We s�ll have some open issues (MXindirec�on, MTA specific cert handling,..)& need to write a proper Internet Dra�

43

Page 44: Yep! We poked all your mail daemons

Ques�[email protected]

44