Slide 1

Slide 1 text

The first 200 milliseconds of HTTPS 1 Joshua Thijssen jaytaph

Slide 2

Slide 2 text

2

Slide 3

Slide 3 text

➡ What’s happening in the first 200+ milliseconds in a initial HTTPS connection. 2

Slide 4

Slide 4 text

➡ What’s happening in the first 200+ milliseconds in a initial HTTPS connection. ➡ Give tips and hints on hardening your setup. 2

Slide 5

Slide 5 text

➡ What’s happening in the first 200+ milliseconds in a initial HTTPS connection. ➡ Give tips and hints on hardening your setup. ➡ Give you insights in new and upcoming technologies. 2

Slide 6

Slide 6 text

➡ What’s happening in the first 200+ milliseconds in a initial HTTPS connection. ➡ Give tips and hints on hardening your setup. ➡ Give you insights in new and upcoming technologies. ➡ Show you things to you (probably) didn’t knew. 2

Slide 7

Slide 7 text

This talk is inspired by a blogpost from Jeff Moser http://www.moserware.com/2009/06/first-few-milliseconds-of-https.html Unknown fact! 3

Slide 8

Slide 8 text

HTTPS == HTTP on top of TLS 4

Slide 9

Slide 9 text

Transport Layer Security (TLS) 5

Slide 10

Slide 10 text

Secure Socket Layer (SSL) 6 A short and scary history

Slide 11

Slide 11 text

then now 7

Slide 12

Slide 12 text

then now SSL 1.0 Vaporware 1994 7

Slide 13

Slide 13 text

then now feb 1995 SSL 2.0 Not-so-secure-socket-layer SSL 1.0 Vaporware 1994 7

Slide 14

Slide 14 text

then now feb 1995 SSL 2.0 Not-so-secure-socket-layer jun 1996 SSL 3.0 Something stable! SSL 1.0 Vaporware 1994 7

Slide 15

Slide 15 text

then now feb 1995 SSL 2.0 Not-so-secure-socket-layer jun 1996 SSL 3.0 Something stable! jan 1999 TLS 1.0 SSL 3.1 SSL 1.0 Vaporware 1994 7

Slide 16

Slide 16 text

then now feb 1995 SSL 2.0 Not-so-secure-socket-layer jun 1996 SSL 3.0 Something stable! jan 1999 TLS 1.0 SSL 3.1 apr 2006 TLS 1.1 SSL 1.0 Vaporware 1994 7

Slide 17

Slide 17 text

then now feb 1995 SSL 2.0 Not-so-secure-socket-layer jun 1996 SSL 3.0 Something stable! jan 1999 TLS 1.0 SSL 3.1 apr 2006 TLS 1.1 TLS 1.2 aug 2008 SSL 1.0 Vaporware 1994 7

Slide 18

Slide 18 text

https://www.trustworthyinternet.org/ssl-pulse/ 25,7% 99,6% 99,3% 18,2% 20,7% SSL 2.0 SSL 3.0 TLS 1.0 TLS 1.1 TLS 1.2 8 November 2013

Slide 19

Slide 19 text

https://www.trustworthyinternet.org/ssl-pulse/ 25,7% 99,6% 99,3% 18,2% 20,7% SSL 2.0 SSL 3.0 TLS 1.0 TLS 1.1 TLS 1.2 8 19,4% 98,0% 99,3% 42,0% 44,3% SSL 2.0 SSL 3.0 TLS 1.0 TLS 1.1 TLS 1.2 November 2013 Oct 2014

Slide 20

Slide 20 text

https://www.trustworthyinternet.org/ssl-pulse/ 25,7% 99,6% 99,3% 18,2% 20,7% SSL 2.0 SSL 3.0 TLS 1.0 TLS 1.1 TLS 1.2 8 19,4% 98,0% 99,3% 42,0% 44,3% SSL 2.0 SSL 3.0 TLS 1.0 TLS 1.1 TLS 1.2 November 2013 Oct 2014 16,6% 60,6% 99,5% 45,4% 48,1% SSL 2.0 SSL 3.0 TLS 1.0 TLS 1.1 TLS 1.2 Nov 2014

Slide 21

Slide 21 text

RFC 5246 (TLS v1.2) 9

Slide 22

Slide 22 text

10 Record Layer

Slide 23

Slide 23 text

10 Record Layer Type Version Length

Slide 24

Slide 24 text

10 Record Layer Type Version Length Protocol

Slide 25

Slide 25 text

10 Record Layer Type Version Length Protocol Protocol Protocol

Slide 26

Slide 26 text

10 Record Layer Type Version Length Protocol Protocol Protocol Record Layer Type Version Length Protocol

Slide 27

Slide 27 text

➡ Handshake protocol records ➡ Setup communication ➡ Change Cipher Spec protocol records ➡ Change communication ➡ Alert protocol records ➡ Errors ➡ Application Data protocol records ➡ Actual data transfers 11

Slide 28

Slide 28 text

12 https://github.com/vincentbernat/rfc5077/blob/master/ssl-handshake.svg

Slide 29

Slide 29 text

Attention: (live) wiresharking up ahead 13

Slide 30

Slide 30 text

14

Slide 31

Slide 31 text

TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 15

Slide 32

Slide 32 text

TLS ECDHE_ECDSA WITH AES_128_GCM SHA256 16

Slide 33

Slide 33 text

TLS ECDHE_ECDSA WITH AES_128_GCM SHA256 Cipher for exchanging key information 16

Slide 34

Slide 34 text

TLS ECDHE_ECDSA WITH AES_128_GCM SHA256 Cipher for exchanging key information Cipher for authenticating key information 16

Slide 35

Slide 35 text

TLS ECDHE_ECDSA WITH AES_128_GCM SHA256 Cipher for exchanging key information Cipher for authenticating key information Actual cipher (and length) used for communication 16

Slide 36

Slide 36 text

TLS ECDHE_ECDSA WITH AES_128_GCM SHA256 Cipher for exchanging key information Cipher for authenticating key information Hash algo for message authenticating Actual cipher (and length) used for communication 16

Slide 37

Slide 37 text

TLS_RSA_WITH_AES_256_CBC_SHA256 17

Slide 38

Slide 38 text

TLS_NULL_WITH_NULL_NULL 18

Slide 39

Slide 39 text

Client gives cipher options, Server ultimately decides on cipher! 19

Slide 40

Slide 40 text

THIS IS WHY YOU SHOULD ALWAYS CONFIGURE YOUR CIPHERS ON YOUR WEB SERVER! 20 Unknown fact!

Slide 41

Slide 41 text

21 https://cipherli.st SSLCipherSuite AES256+EECDH:AES256+EDH SSLProtocol All -SSLv2 -SSLv3 SSLCompression off # Requires Apache >= 2.4 SSLHonorCipherOrder On SSLUseStapling on # Requires Apache >= 2.4 SSLStaplingCache "shmcb:logs/stapling-cache(150000)" # Requires >= Apache 2.4 Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains" Header always set X-Frame-Options DENY ssl_ciphers 'AES256+EECDH:AES256+EDH'; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_session_cache builtin:1000 shared:SSL:10m; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; add_header X-Frame-Options DENY; ssl_stapling on; # Requires nginx >= 1.3.7 ssl_stapling_verify on; # Requires nginx => 1.3.7 resolver $DNS-IP-1 $DNS-IP-2 valid=300s; resolver_timeout 5s; Apache: nginx:

Slide 42

Slide 42 text

https://www.ssllabs.com/ssltest/ 22

Slide 43

Slide 43 text

23

Slide 44

Slide 44 text

24

Slide 45

Slide 45 text

25 ➡ SNI (Server Name Indication) ➡ Extension 0x0000 ➡ Pretty much every decent browser / server. ➡ IE6, Win XP, Blackberry, Android 2.x, java 1.6.x ➡ So no worries!

Slide 46

Slide 46 text

26

Slide 47

Slide 47 text

What an SSL certificate is NOT: 27 ➡ SSL certificate (but a X.509 certificate) ➡ Automatically secure ➡ Automatically trustworthy ➡ In any way better self-signed certificates ➡ Cheap

Slide 48

Slide 48 text

What an SSL certificate is: 28 ➡ The best way (but not perfect) to prove authenticity ➡ A way to bootstrap encrypted communication ➡ Misleading ➡ (Too) Expensive

Slide 49

Slide 49 text

29

Slide 50

Slide 50 text

29 ➡ X.509 Certificate

Slide 51

Slide 51 text

29 ➡ X.509 Certificate ➡ Owner info (who is this owner)

Slide 52

Slide 52 text

29 ➡ X.509 Certificate ➡ Owner info (who is this owner) ➡ Domain info (for which domain(s) is this certificate valid)

Slide 53

Slide 53 text

29 ➡ X.509 Certificate ➡ Owner info (who is this owner) ➡ Domain info (for which domain(s) is this certificate valid) ➡ Expiry info (from when to when is this certificate valid)

Slide 54

Slide 54 text

30 yourdomain.com

Slide 55

Slide 55 text

30 yourdomain.com Intermediate CA

Slide 56

Slide 56 text

30 yourdomain.com Intermediate CA

Slide 57

Slide 57 text

30 yourdomain.com Root CA Intermediate CA

Slide 58

Slide 58 text

30 yourdomain.com Root CA Intermediate CA

Slide 59

Slide 59 text

30 yourdomain.com Root CA Intermediate CA

Slide 60

Slide 60 text

31 IMPLIED TRU$T

Slide 61

Slide 61 text

➡ (Root) Certificate Authorities ➡ They are built into your browser / OS and you will automatically trust them. 32

Slide 62

Slide 62 text

33 wget http://mxr.mozilla.org/mozilla-central/source/security/nss/lib/ckfw/builtins/certdata.txt\?raw\=1 -O - -q | grep Issuer | sort | uniq | wc -l

Slide 63

Slide 63 text

33 wget http://mxr.mozilla.org/mozilla-central/source/security/nss/lib/ckfw/builtins/certdata.txt\?raw\=1 -O - -q | grep Issuer | sort | uniq | wc -l 182 And rising...

Slide 64

Slide 64 text

34

Slide 65

Slide 65 text

34 ➡ X.509 certificates are used to authenticate the server.

Slide 66

Slide 66 text

34 ➡ X.509 certificates are used to authenticate the server. ➡ Servers can ask clients to authenticate themselves as well.

Slide 67

Slide 67 text

34 ➡ X.509 certificates are used to authenticate the server. ➡ Servers can ask clients to authenticate themselves as well. ➡ APIs

Slide 68

Slide 68 text

35

Slide 69

Slide 69 text

36 Generating secrets:

Slide 70

Slide 70 text

36 pre master secret server rand client rand Generating secrets: + +

Slide 71

Slide 71 text

36 pre master secret server rand client rand master secret Generating secrets: + +

Slide 72

Slide 72 text

36 pre master secret server rand client rand master secret master secret server rand client rand Generating secrets: + + + +

Slide 73

Slide 73 text

36 pre master secret server rand client rand master secret master secret server rand client rand key buffer Generating secrets: + + + +

Slide 74

Slide 74 text

36 pre master secret server rand client rand master secret client MAC client KEY client IV server MAC server KEY server IV master secret server rand client rand key buffer Generating secrets: + + + +

Slide 75

Slide 75 text

https://github.com/jaytaph/TLS-decoder 37 http://www.adayinthelifeof.nl/2013/12/30/decoding-tls-with-php/ Try it yourself, php style:

Slide 76

Slide 76 text

38

Slide 77

Slide 77 text

39

Slide 78

Slide 78 text

40

Slide 79

Slide 79 text

41 Wireshark CAN decrypt your HTTPS traffic Unknown fact! SSLKEYLOGFILE https://isc.sans.edu/forums/diary/Psst+Your+Browser+Knows+All+Your+Secrets+/16415

Slide 80

Slide 80 text

42 launchctl setenv SSLKEYLOGFILE /tmp/keylog.secret on a mac:

Slide 81

Slide 81 text

➡ TLS has overhead in computation and transfers. But definitely worth it. ➡ Google likes it. ➡ Some ciphersuites are better, but slower. ➡ Speed / Security compromise ➡ (try: “openssl speed”) 43

Slide 82

Slide 82 text

Are we safe yet? 44

Slide 83

Slide 83 text

euh,.. no :/ 45

Slide 84

Slide 84 text

46 PRE MASTER SECRET

Slide 85

Slide 85 text

What if somebody* got hold of the site private key? 47

Slide 86

Slide 86 text

48

Slide 87

Slide 87 text

49

Slide 88

Slide 88 text

50

Slide 89

Slide 89 text

51

Slide 90

Slide 90 text

(PERFECT) FORWARDING SECRECY 52

Slide 91

Slide 91 text

Compromising the pre-master secret does not compromise our communication. 53

Slide 92

Slide 92 text

PFS: Can’t compromise other keys with a compromised key. 54

Slide 93

Slide 93 text

Unfortunately.. 55

Slide 94

Slide 94 text

56 PFS needs server AND browser support

Slide 95

Slide 95 text

57 http://news.netcraft.com/archives/2013/06/25/ssl-intercepted-today-decrypted-tomorrow.html

Slide 96

Slide 96 text

58 http://news.netcraft.com/archives/2013/06/25/ssl-intercepted-today-decrypted-tomorrow.html

Slide 97

Slide 97 text

Update your cipher suite list and place PFS ciphers at the top 59

Slide 98

Slide 98 text

But beware: heavy computations 60

Slide 99

Slide 99 text

61 SSL Test https://www.ssllabs.com/ssltest/

Slide 100

Slide 100 text

-ETOOMUCHINFO 62

Slide 101

Slide 101 text

63 https://www.ssllabs.com/projects/best-practices/index.html

Slide 102

Slide 102 text

http://farm1.static.flickr.com/73/163450213_18478d3aa6_d.jpg 64

Slide 103

Slide 103 text

65 Find me on twitter: @jaytaph Find me for development and training: www.noxlogic.nl Find me on email: jthijssen@noxlogic.nl Find me for blogs: www.adayinthelifeof.nl