TLS Security - Where Do We Stand? Kenny Paterson Information Security - - PowerPoint PPT Presentation

tls security where do we stand
SMART_READER_LITE
LIVE PREVIEW

TLS Security - Where Do We Stand? Kenny Paterson Information Security - - PowerPoint PPT Presentation

TLS Security - Where Do We Stand? Kenny Paterson Information Security Group 1 Outline TLS overview TLS attacks and proofs Lucky 13 TLS Record Protocol and RC4 Discussion 2 TLS Overview SSL = Secure Sockets Layer.


slide-1
SLIDE 1

Information Security Group

TLS Security - Where Do We Stand? Kenny Paterson

1

slide-2
SLIDE 2

2

Outline

  • TLS overview
  • TLS attacks and proofs
  • Lucky 13
  • TLS Record Protocol and RC4
  • Discussion
slide-3
SLIDE 3

3

TLS Overview

  • SSL = Secure Sockets Layer.

– Developed by Netscape in mid 1990s. – SSLv1 broken at birth. – SSLv2 flawed, now IETF-deprecated (RFC 6176). – SSLv3 still widely supported.

  • TLS = Transport Layer Security.

– IETF-standardised version of SSL. – TLS 1.0 in RFC 2246 (1999). – TLS 1.1 in RFC 4346 (2006). – TLS 1.2 in RFC 5246 (2008).

slide-4
SLIDE 4

4

Importance of TLS

  • Originally designed for secure e-commerce, now used

much more widely.

– Retail customer access to online banking facilities. – Access to gmail, facebook, Yahoo, etc. – Mobile applications, including banking apps. – Payment infrastructures.

  • TLS has become the de facto secure protocol of choice.

– Used by hundreds of millions of people and devices every day. – A serious attack could be catastrophic, both in real terms and in terms of perception/confidence.

slide-5
SLIDE 5

5

Simplified View of TLS

Client Server

Handshake Protocol Record Protocol

Used by client and server to

  • 1. Negotiate ciphersuite
  • 2. Authenticate
  • 3. Establish keys used in the Record Protocol

Provides confidentiality and authenticity of application layer data using keys from Handshake Protocol

slide-6
SLIDE 6

TLS Protocol Architecture

TCP Record Protocol

Handshake Protocol Alert Protocol HTTP,

  • ther apps

Change Cipher Spec Protocol

6

slide-7
SLIDE 7

7

TLS Complexity

  • Multiple interacting sub-protocols.
  • Many different options for each sub-protocol.
  • Which option is used is negotiated during the

Handshake Protocol itself.

– And can be renegotiated using that protocol too.

  • Different versions of the protocol.
  • Many extensions of the basic protocol.
  • Specification versus implementation.

– Plenty of room for imprecision and error. – Spec. and code now contain layers of attack-specific fixes.

slide-8
SLIDE 8

8

Common Researcher Responses to TLS Complexity

  • Prove security of parts of the protocol.

– For example, just the cryptographic transform used in the Record Protocol. – Ignoring padding, compression, statefulness, fragementation,…

  • Idealise the protocol.

– For example, assume that Handshake Protocol uses CCA-secure public key encryption (it doesn’t!) – Or use a symbolic approach to cryptography.

slide-9
SLIDE 9

9

Positive Security Results for TLS

9

Theory for symmetric encryption in TLS:

  • [K01] Krawczyk, Crypto 2001
  • [MT10] Maurer and Tackmann, ACM-CCS 2010
  • [PRS11] Paterson, Ristenpart, Shrimpton, Asiacrypt 2011

Theory for key exchange in TLS:

  • [BR93] Bellare and Rogaway, Crypto 1993
  • [JK02] Jonsson and Kaliski Jr., Crypto 2002
  • [MSW08] Morrissey et al., Asiacrypt 2008
  • [JKSS12], Jager et al., Crypto 2012
  • [GKS13] Giesen et al., ACM-CCS 2013
  • [KPW13] Krawczyk et al., Crypto 2013
slide-10
SLIDE 10

10

Common Researcher Responses to TLS Complexity

  • Prove security of parts of the protocol.

– For example, just the cryptographic transform used in the Record Protocol. – Ignoring padding, compression, statefulness, fragementation,…

  • Idealise the protocol.

– For example, assume that Handshake Protocol uses CCA-secure public key encryption (it doesn’t!) – Or use a symbolic approach to cryptography.

  • Break (some aspect of) the protocol.
slide-11
SLIDE 11

11

TLS Attack Literature

11

  • [B98] Bleichenbacher, Crypto 1998
  • [V02] Vaudenay, Eurocrypt 2002
  • [M02] Moeller, http://www.openssl.org/~bodo/tls-cbc.txt, 2002
  • [CHVV03] Canvel et al., Crypto 2003
  • [B04] Bard, eprint 2004
  • [B06] Bard, SECRYPT 2006
  • [RD09] Ray and Dispensa, TLS renegotiation attack, 2009
  • [PRS11] Paterson et al., Asiacrypt 2011
  • [DR11] Duong and Rizzo, “Here come the XOR Ninjas”, 2011
  • [AP12] AlFardan and Paterson, NDSS 2012
  • [DR12] Duong and Rizzo, CRIME, 2012
  • [MVVP12] Mavrogiannopoulos et al.,CCS 2012
  • [AP13] N.J. AlFardan and K.G. Paterson, IEEE S&P, 2013
  • [ABPPS13 ] N.J. AlFardan et al., USENIX Security, 2013
  • [BFKPS13] Bhargavan et al., IEEE S&P, 2013
slide-12
SLIDE 12

12

TLS Attack Literature

12

  • [B98] Bleichenbacher, Crypto 1998
  • [V02] Vaudenay, Eurocrypt 2002
  • [M02] Moeller, http://www.openssl.org/~bodo/tls-cbc.txt, 2002
  • [CHVV03] Canvel et al., Crypto 2003
  • [B04] Bard, eprint 2004
  • [B06] Bard, SECRYPT 2006
  • [RD09] Ray and Dispensa, TLS renegotiation attack, 2009
  • [PRS11] Paterson et al., Asiacrypt 2011
  • [DR11] Duong and Rizzo, “Here come the XOR Ninjas”, 2011
  • [AP12] AlFardan and Paterson, NDSS 2012
  • [DR12] Duong and Rizzo, CRIME, 2012
  • [MVVP12] Mavrogiannopoulos et al.,CCS 2012
  • [AP13] N.J. AlFardan and K.G. Paterson, IEEE S&P, 2013
  • [ABPPS13 ] N.J. AlFardan et al., USENIX Security, 2013
  • [BFKPS13] Bhargavan et al., IEEE S&P, 2013
slide-13
SLIDE 13

13

TLS Attack Literature

13

  • [B98] Bleichenbacher, Crypto 1998
  • [V02] Vaudenay, Eurocrypt 2002
  • [M02] Moeller, http://www.openssl.org/~bodo/tls-cbc.txt, 2002
  • [CHVV03] Canvel et al., Crypto 2003
  • [B04] Bard, eprint 2004
  • [B06] Bard, SECRYPT 2006
  • [RD09] Ray and Dispensa, TLS renegotiation attack, 2009
  • [PRS11] Paterson et al., Asiacrypt 2011
  • [DR11] Duong and Rizzo, “Here come the XOR Ninjas”, 2011
  • [AP12] AlFardan and Paterson, NDSS 2012
  • [DR12] Duong and Rizzo, CRIME, 2012
  • [MVVP12] Mavrogiannopoulos et al.,CCS 2012
  • [AP13] N.J. AlFardan and K.G. Paterson, IEEE S&P, 2013
  • [ABPPS13 ] N.J. AlFardan et al., USENIX Security, 2013
  • [BFKPS13] Bhargavan et al., IEEE S&P, 2013
slide-14
SLIDE 14

14

TLS Attack Literature

14

  • [B98] Bleichenbacher, Crypto 1998
  • [V02] Vaudenay, Eurocrypt 2002
  • [M02] Moeller, http://www.openssl.org/~bodo/tls-cbc.txt, 2002
  • [CHVV03] Canvel et al., Crypto 2003
  • [B04] Bard, eprint 2004
  • [B06] Bard, SECRYPT 2006
  • [RD09] Ray and Dispensa, TLS renegotiation attack, 2009
  • [PRS11] Paterson et al., Asiacrypt 2011
  • [DR11] Duong and Rizzo, “Here come the XOR Ninjas”, 2011
  • [AP12] AlFardan and Paterson, NDSS 2012
  • [DR12] Duong and Rizzo, CRIME, 2012
  • [MVVP12] Mavrogiannopoulos et al.,CCS 2012
  • [AP13] N.J. AlFardan and K.G. Paterson, IEEE S&P, 2013
  • [ABPPS13 ] N.J. AlFardan et al., USENIX Security, 2013
  • [BFKPS13] Bhargavan et al., IEEE S&P, 2013
slide-15
SLIDE 15

15

TLS Attack Literature

15

  • [B98] Bleichenbacher, Crypto 1998
  • [V02] Vaudenay, Eurocrypt 2002
  • [M02] Moeller, http://www.openssl.org/~bodo/tls-cbc.txt, 2002
  • [CHVV03] Canvel et al., Crypto 2003
  • [B04] Bard, eprint 2004
  • [B06] Bard, SECRYPT 2006
  • [RD09] Ray and Dispensa, TLS renegotiation attack, 2009
  • [PRS11] Paterson et al., Asiacrypt 2011
  • [DR11] Duong and Rizzo, “Here come the XOR Ninjas”, 2011
  • [AP12] AlFardan and Paterson, NDSS 2012
  • [DR12] Duong and Rizzo, CRIME, 2012
  • [MVVP12] Mavrogiannopoulos et al.,CCS 2012
  • [AP13] N.J. AlFardan and K.G. Paterson, IEEE S&P, 2013
  • [ABPPS13 ] N.J. AlFardan et al., USENIX Security, 2013
  • [BFKPS13] Bhargavan et al., IEEE S&P, 2013
slide-16
SLIDE 16

16

Outline

  • TLS overview
  • TLS attacks and proofs
  • Lucky 13*
  • TLS Record Protocol and RC4
  • Discussion

*AlFardan and Paterson, Lucky 13: Breaking the TLS and DTLS Record Protocols, IEEE Security and Privacy Symposium, 2013. (www.isg.rhul.ac.uk/tls/lucky13.html)

slide-17
SLIDE 17

MAC SQN || HDR Payload Padding Encrypt Ciphertext MAC tag Payload HDR

TLS Record Protocol: MAC-Encode-Encrypt (MEE)

MAC

HMAC-MD5, HMAC-SHA1, HMAC-SHA256

Encrypt

CBC-AES128, CBC-AES256, CBC-3DES, RC4-128

17

Padding

“00” or “01 01” or “02 02 02” or …. or “FF FF….FF”

slide-18
SLIDE 18

TLS Record Protocol: Authenticated Encryption

  • TLS 1.2 additionally supports authenticated encryption

– AES-GCM in RFC 5288 – AES-CCM in RFC 6655

  • However, TLS 1.2 is not yet widely supported

SSL Pulse: Webserver TLS support Browser TLS support (out-of-the-box) TLS v1.1 TLS v1.1 TLS v1.0 TLS v1.0 TLS v1.0

slide-19
SLIDE 19

19

Lucky 13

  • Distinguishing attacks and full plaintext recovery

attacks against TLS-CBC implementations following implementation advice in the TLS 1.2 spec.

– And variant attacks against those that do not.

  • Applies to all versions of SSL/TLS.

– SSLv3.0, TLS 1.0, 1.1, 1.2. – And DTLS.

  • Demonstrated in the lab against OpenSSL and

GnuTLS.

slide-20
SLIDE 20

20

History: TLS and Padding Oracles

[V02,CHVV03]:

  • Specifics of TLS padding format can be

exploited to mount a plaintext recovery attack.

  • The attack depends on being able to distinguish

good from bad padding.

– In practice, this is done via a timing side-channel. – The MAC is only checked if the padding is good, and the MAC is always bad in the attack. – Distinguish cases by timing TLS error messages.

slide-21
SLIDE 21

21

Countermeasures?

  • Redesign TLS:

– Pad-MAC-Encrypt or Pad-Encrypt-MAC. – Too invasive, did not happen.

  • Switch to RC4?
  • Or add a fix to ensure uniform errors?

– If attacker can’t tell difference between MAC and pad errors, then maybe TLS’s MEE construction is secure? – So how should TLS implementations ensure uniform errors?

slide-22
SLIDE 22

22

Ensuring Uniform Errors

From the TLS 1.2 specification: …implementations MUST ensure that record processing time is essentially the same whether or not the padding is correct. In general, the best way to do this is to compute the MAC even if the padding is incorrect, and only then reject the packet. Compute the MAC on what though?

22

slide-23
SLIDE 23

23

Ensuring Uniform Errors

For instance, if the pad appears to be incorrect, the implementation might assume a zero-length pad and then compute the MAC.

  • This approach is adopted in many implementations,

including OpenSSL, NSS (Chrome, Firefox), BouncyCastle, OpenJDK, …

  • One alternative (GnuTLS and others) is to remove as

many bytes as are indicated by the last byte of plaintext and compute the MAC on what’s left.

23

slide-24
SLIDE 24

24

Ensuring Uniform Errors

… This leaves a small timing channel, since MAC performance depends to some extent on the size of the data fragment, but it is not believed to be large enough to be exploitable, due to the large block size of existing MACs and the small size of the timing signal.

24

slide-25
SLIDE 25

25

Ensuring Uniform Errors

… This leaves a small timing channel, since MAC performance depends to some extent on the size of the data fragment, but it is not believed to be large enough to be exploitable, due to the large block size of existing MACs and the small size of the timing signal.

25

slide-26
SLIDE 26

26

Lucky 13 – Plaintext Recovery

XOR 2-byte Δ here and submit for decryption Produces valid patterns “01 01”

  • r “00”,

OR bad pad.

26

Ct Pt

dK

Ct-1

dK

R2 R1

dK dK

IV

(HMAC-SHA-1 + AES-CBC)

slide-27
SLIDE 27

27

Case: “01 01” (or longer valid pad)

XOR 2-byte Δ here and submit for decryption

27

Ct Pt

dK

Ct-1

dK

R2 R1

dK dK

IV

SQN||HDR

13 + 16 + 16 + 10 = 55 bytes 20 bytes

4 SHA-1 compression function evaluations

“01 01” (or longer valid pad)

slide-28
SLIDE 28

28

Case: “00”

XOR 2-byte Δ here and submit for decryption

28

Ct Pt

dK

Ct-1

dK

R2 R1

dK dK

IV

SQN||HDR

56 bytes 20 bytes

5 SHA-1 compression function evaluations

“00”

slide-29
SLIDE 29

29

Case: Bad padding

XOR 2-byte Δ here and submit for decryption

29

Ct Pt

dK

Ct-1

dK

R2 R1

dK dK

IV

SQN||HDR

57 bytes 20 bytes

5 SHA-1 compression function evaluations

zero-length pad

slide-30
SLIDE 30

30

Lucky 13 – Plaintext Recovery

  • The injected ciphertext causes bad padding and/or a bad

MAC.

– This leads to a TLS error message – The attacker times its appearance on the network.

  • There is a timing difference between “01 01” case and the
  • ther 2 cases.

– A single SHA-1 compression function evaluation. – Roughly 1000 clock cycles, 1µs range on typical processor. – Measurable difference on same host, LAN, or a few hops away.

  • Detecting the “01 01” case allows last 2 plaintext bytes in the

target block Ct to be recovered.

– Using some standard CBC algebra.

  • Attack then extends easily to all bytes.

30

slide-31
SLIDE 31

31

Experimental Results

  • Byte 14 of plaintext set to 01; byte 15 set to FF.
  • OpenSSLv1.0.1 on server running at 1.87Ghz.
  • 100 Mbit LAN.
  • Median times (noise not shown).

31

Hardware Cycles Calculated by Adversary⇥

⇥15 0xFE

50 100 150 200 250 1.286 ⇤106 1.287 ⇤106 1.288 ⇤106 1.289 ⇤106 1.290 ⇤106 1.291 ⇤106 1.292 ⇤106

15

slide-32
SLIDE 32

32

Lucky 13 – Countermeasures

  • We really need constant-time decryption for TLS-CBC.
  • Add dummy hash compression function computations when

padding is good to ensure total is the same as when padding is bad.

  • Add dummy padding checks to ensure number of iterations

done is independent of padding length and/or correctness of padding.

  • Watch out for length sanity checks too.

– Need to ensure there’s enough space for some plaintext after removing padding and MAC, but without leaking any information about amount of padding removed.

  • TL;DR:

– It’s a bit of a nightmare.

32

slide-33
SLIDE 33

33

Lucky 13 – Impact

  • OpenSSL patched in versions 1.0.1d, 1.0.0k and 0.9.8y, released

05/02/2013.

  • NSS (Firefox, Chrome) patched in version 3.14.3, released

15/02/2013.

  • Opera patched in version 12.13, released 30/01/2013
  • Oracle released a special critical patch update of JavaSE,

19/02/2013.

  • BouncyCastle patched in version 1.48, 10/02/2013
  • Also GnuTLS, PolarSSL, CyaSSL, MatrixSSL.
  • Microsoft “determined that the issue had been adequately

addressed in previous modifications to their TLS and DTLS implementation”.

  • Apple: status unknown.

(Full details at: www.isg.rhul.ac.uk/tls/lucky13.html)

33

slide-34
SLIDE 34

34

Other Lucky 13 Countermeasures?

  • Introduce random delays during decryption.

– Surprisingly ineffective, analysis in [AP13].

  • Redesign TLS:

– Pad-MAC-Encrypt or Pad-Encrypt-MAC. – Currently, some discussion on TLS mailing lists. – TLS 1.3?

  • Switch to TLS 1.2

– Has support for AES-GCM and AES-CCM. – Some encouraging signs of increasing adoption.

  • Use RC4?
slide-35
SLIDE 35

35

Outline

  • TLS overview
  • TLS attacks and proofs
  • Lucky 13
  • TLS Record Protocol and RC4*
  • Discussion

*AlFardan, Bernstein, Paterson, Poettering, Schudlt, On the Security of RC4 in TLS. USENIX Security Symposium, 2013. (www.isg.rhul.ac.uk/tls)

slide-36
SLIDE 36

MAC SQN || HDR Payload Padding Encrypt Ciphertext MAC tag Payload HDR

TLS Record Protocol: MEE

MAC

HMAC-MD5, HMAC-SHA1, HMAC-SHA256

Encrypt

CBC-AES128, CBC-AES256, CBC-3DES, RC4-128

36

Padding

“00” or “01 01” or “02 02 02” or …. or “FF FF….FF”

slide-37
SLIDE 37

MAC SQN || HDR Payload Encrypt Ciphertext MAC tag Payload HDR MAC

HMAC-MD5, HMAC-SHA1, HMAC-SHA256

Encrypt

CBC-AES128, CBC-AES256, CBC-3DES, RC4-128

37

TLS Record Protocol: RC4-128

slide-38
SLIDE 38

MAC SQN || HDR Payload Encrypt Ciphertext MAC tag Payload HDR MAC

HMAC-MD5, HMAC-SHA1, HMAC-SHA256

Encrypt

CBC-AES128, CBC-AES256, CBC-3DES, RC4-128

38

TLS Record Protocol: RC4-128

MAC tag HDR RC4 Key scheduling RC4 Keystream generation RC4 State Byte permutation and indices i and j

slide-39
SLIDE 39
  • In the face of the attacks on CBC-based ciphersuites

in TLS, switching to RC4 has been a recommended mitigation (e.g. Qualys, F5).

  • Use of RC4 in the wild:
  • Problem:
  • RC4 is known to have statistical weaknesses.
  • (RC4 widely considered weak because of WEP debacle.)

Use of RC4 in TLS

ICSI Certificate Notary Recent survey of 16 billion TLS connections:

  • Approx. 50% protected via RC4 ciphersuites
slide-40
SLIDE 40

Single-byte Biases in the RC4 Keystream

  • [Mantin-Shamir 2001]:
  • [Mironov 2002]:

– Described distribution of (bias away from 0, sine-like distribution)

  • [Maitra-Paul-Sen Gupta 2011]: for
  • [Sen Gupta-Maitra-Paul-Sakar 2011]:

Zi = value of i-th keystream byte

l = keylength

slide-41
SLIDE 41
  • Our approach in [ABPPS13]:

– Based on the output from 245 random independent 128-bit RC4 keys, estimate the keystream byte distribution of the first 256 bytes ..

  • Revealed many new biases in the RC4 keystream.

– (Some of these were independently discovered by [Isobe et al. 2013].)

Complete Keystream Byte Distributions

Z1 ... Z2 Z3 ... ...

slide-42
SLIDE 42

Keystream Distribution at Position 1

Probability

0.003906

Byte value

0.003950 0.003878

slide-43
SLIDE 43

Keystream Distribution at Position 2

Probability

0.003906

Byte value

0.003950 0.003878

slide-44
SLIDE 44

Keystream Distribution at Position 3

Probability

0.003906

Byte value

0.003950 0.003878

slide-45
SLIDE 45

Keystream Distribution at Position 4

Probability

0.003906

Byte value

0.003950 0.003878

slide-46
SLIDE 46

Keystream Distribution at Position 5

Probability

0.003906

Byte value

0.003950 0.003878

slide-47
SLIDE 47

Keystream Distribution at Position 6

Probability

0.003906

Byte value

0.003950 0.003878

slide-48
SLIDE 48

Keystream Distribution at Position 7

Probability

0.003906

Byte value

0.003950 0.003878

slide-49
SLIDE 49

Keystream Distribution at Position 8

Probability

0.003906

Byte value

0.003950 0.003878

slide-50
SLIDE 50

Keystream Distribution at Position 9

Probability

0.003906

Byte value

0.003950 0.003878

slide-51
SLIDE 51

Keystream Distribution at Position 10

Probability

0.003906

Byte value

0.003950 0.003878

slide-52
SLIDE 52

Keystream Distribution at Position 11

Probability

0.003906

Byte value

0.003950 0.003878

slide-53
SLIDE 53

Keystream Distribution at Position 12

Probability

0.003906

Byte value

0.003950 0.003878

slide-54
SLIDE 54

Keystream Distribution at Position 13

Probability

0.003906

Byte value

0.003950 0.003878

slide-55
SLIDE 55

Keystream Distribution at Position 14

Probability

0.003906

Byte value

0.003950 0.003878

slide-56
SLIDE 56

Keystream Distribution at Position 15

Probability

0.003906

Byte value

0.003950 0.003878

slide-57
SLIDE 57

Keystream Distribution at Position 16

Probability

0.003906

Byte value

0.003950 0.003878

slide-58
SLIDE 58

Keystream Distribution at Position 17

Probability

0.003906

Byte value

0.003950 0.003878

slide-59
SLIDE 59

Keystream Distribution at Position 18

Probability

0.003906

Byte value

0.003950 0.003878

slide-60
SLIDE 60

Keystream Distribution at Position 19

Probability

0.003906

Byte value

0.003950 0.003878

slide-61
SLIDE 61

Keystream Distribution at Position 20

Probability

0.003906

Byte value

0.003950 0.003878

slide-62
SLIDE 62

Keystream Distribution at Position 21

Probability

0.003906

Byte value

0.003950 0.003878

slide-63
SLIDE 63

Keystream Distribution at Position 22

Probability

0.003906

Byte value

0.003950 0.003878

slide-64
SLIDE 64

Keystream Distribution at Position 23

Probability

0.003906

Byte value

0.003950 0.003878

slide-65
SLIDE 65

Keystream Distribution at Position 24

Probability

0.003906

Byte value

0.003950 0.003878

slide-66
SLIDE 66

Keystream Distribution at Position 25

Probability

0.003906

Byte value

0.003950 0.003878

slide-67
SLIDE 67

Keystream Distribution at Position 26

Probability

0.003906

Byte value

0.003950 0.003878

slide-68
SLIDE 68

Keystream Distribution at Position 27

Probability

0.003906

Byte value

0.003950 0.003878

slide-69
SLIDE 69

Keystream Distribution at Position 28

Probability

0.003906

Byte value

0.003950 0.003878

slide-70
SLIDE 70

Keystream Distribution at Position 29

Probability

0.003906

Byte value

0.003950 0.003878

slide-71
SLIDE 71

Keystream Distribution at Position 30

Probability

0.003906

Byte value

0.003950 0.003878

slide-72
SLIDE 72

Keystream Distribution at Position 31

Probability

0.003906

Byte value

0.003950 0.003878

slide-73
SLIDE 73

Keystream Distribution at Position 32

Probability

0.003906

Byte value

0.003950 0.003878

slide-74
SLIDE 74
  • Based on the keystream byte distribution, we can

construct a plaintext recovery attack.

– Exploits all single-byte biases in the initial part of the RC4 keystream.

  • The attack requires the same plaintext to be encrypted

under many different keys.

– Applicable when using TLS?

Plaintext Recovery

slide-75
SLIDE 75
  • Javascript

– Uses XMLHttpRequest objects to generate POST requests. – Request to secure site possible due to Cross-Origin Resource Sharing. – Number of requests generated by script must be balanced to avoid browser overload.

Targeting Secure HTTP Cookies

TLS Client https://secure.com Malicious server Secure cookie HTTP request (cookie attached) TLS

slide-76
SLIDE 76

Plaintext Recovery

C1 C2 C3 Cn ... r Pr Pr Pr Pr ... Induced distribution on Zr combine with

Likelihood of Pr being correct plaintext byte Recovery algorithm: Compute most likely plaintext byte Encryptions of plaintext under different keys Plaintext candidate byte Pr

slide-77
SLIDE 77

Success Probability 220 Sessions

slide-78
SLIDE 78

Success Probability 221 Sessions

slide-79
SLIDE 79

Success Probability 222 Sessions

slide-80
SLIDE 80

Success Probability 223 Sessions

slide-81
SLIDE 81

Success Probability 224 Sessions

slide-82
SLIDE 82

Success Probability 225 Sessions

slide-83
SLIDE 83

Success Probability 226 Sessions

slide-84
SLIDE 84

Success Probability 227 Sessions

slide-85
SLIDE 85

Success Probability 228 Sessions

slide-86
SLIDE 86

Success Probability 229 Sessions

slide-87
SLIDE 87

Success Probability 230 Sessions

slide-88
SLIDE 88

Success Probability 231 Sessions

slide-89
SLIDE 89

Success Probability 232 Sessions

slide-90
SLIDE 90

Limitations of Attack

  • Requires 228 ~ 232 TLS connections for reliable recovery.
  • Attacker has to force TLS session renegotiation /

resumption.

– No known mechanism from within Javascript.

  • Only the first 220 bytes of application data can be

targeted.

  • Initial 36 bytes used to encrypt last message of Handshake protocol.
  • In reality, first 220 bytes of application data usually contain uninteresting

HTTP headers.

slide-91
SLIDE 91

A Second Attack

  • Fluhrer and McGrew

identified biases for consecutive keystream bytes.

– Persistent throughout keystream.

  • Based on these, we

construct an attack which:

– Can target any plaintext byte positions; – Does not require session renegotiation / resumption.

i : keystream byte position mod 256

slide-92
SLIDE 92
  • Align plaintext with repeating Fluhrer-McGrew biases
  • Exploit overlapping nature of plaintext byte pairs to obtain

approximate likelihood for plaintext candidates.

Plaintext copies P P P

A Second Attack

RC4 Keystream TLS Ciphertexts C1 C2 C3 P3 P4 P2 P3 P1 P2 P1 P2 P3 P4 P5 P6 ...

Approximate likelihood for P = P1P2P3P4P5P6 Recovery algorithm: Viterbi-style algorithm to determine P with highest approximate likelihood

slide-93
SLIDE 93

Success Probability

Recovery of 16 byte cookie Recovery of individual bytes

slide-94
SLIDE 94

Countermeasures

  • Possible countermeasures against the attacks

– Discard initial keystream bytes. – Fragment initial records at the application layer. – Add random length padding to records. – Limit lifetime of cookies or number of times cookies can be sent. – Stop using RC4 in TLS.

  • Vendor response

– Opera has been implementing a combination of countermeasures. – Google seems focused on implementing TLS 1.2 and AES-GCM in Chrome. – RC4 is disabled by default for TLS in Windows Preview 8.1. – Draft RFC for Salsa20 just published.

slide-95
SLIDE 95

Summary of RC4 in TLS

  • Plaintext recovery attacks against RC4 in TLS are

feasible although not truly practical.

– 228 ~ 232 sessions for reliable recovery of initial bytes. – 233 ~ 234 encryptions for reliable recovery of 16 bytes anywhere in plaintext.

  • The attacks illustrate that RC4 in TLS provides a

security level far below the strength suggested by the key size of 128 bits.

  • Furthermore, attacks only becomes better with time.
  • Our recommendation: phase out the use of RC4 in

TLS as soon as possible.

slide-96
SLIDE 96

96

Outline

  • TLS overview
  • TLS attacks and proofs
  • Lucky 13
  • TLS Record Protocol and RC4
  • Discussion
slide-97
SLIDE 97

97

Discussion

  • TLS’s ad hoc MAC-Encode-Encrypt construction is hard

to implement securely and hard to prove positive security results about.

– Long history of attacks and fixes for CBC-mode, culminating in this year’s “Lucky 13” attack. – Each fix was the “easiest option at the time”. – Now reached point where a 500 line patch to OpenSSL was needed to fully eliminate the Lucky 13 attack on CBC-mode. – Attacks show that small details matter. – Suitably detailed analysis for MEE-TLS-CBC only completed in 2011.

97

slide-98
SLIDE 98

98

Discussion

  • RC4 was known to be weak for many years.

– Actual exploitation of its weaknesses in a TLS context went unexplored. – Needed multi-session mechanism (BEAST technology) to make the attack plausible. – Borrowing tools from outside cryptography.

  • Once a bad cryptographic choice is out there in

implementations, it’s very hard to undo.

– Old versions of TLS hang around for a long time. – There is no TLS product recall programme! – Slow uptake of TLS 1.1, 1.2.

98

slide-99
SLIDE 99

99

Discussion

  • TLS is coming under sustained pressure from attacks.

– BEAST, Lucky 13 and RC4 attacks are providing incentives to move to TLS 1.2. – Good vendor response to BEAST, CRIME, Lucky 13, less so to RC4 attack.

  • First three are fixable, the other not (really).
  • Having a cool name for your attack is important.
  • Attacks really do improve with age.

– BEAST (1995 – 2011), Lucky 13 (Feb. 2013 – Mar. 2013). – RC4 attacks are currently only “semi-practical” but we ignore such attacks at our peril.

99

slide-100
SLIDE 100

100

Research Directions?

  • TLS Record Protocol cryptography has now been heavily

analysed.

– Still some mileage in looking at AE implementations?

  • Major recent progress in analysing TLS Handshake protocol.

– [JKSS12], [KPW13], [GKS12].

  • Can still expect implementation issues to emerge.

– Check the “OpenSSL Fact” twitter feed regularly!

  • TLS’s complex system of interacting protocols can still throw

up surprises.

– Alert Protocol desynchronisation attack [BFKPS13]. – TLS Renegotiation attack [RD09].

100

slide-101
SLIDE 101

101

TLS – Current Status?

101

“This is a dead parrot.” “He’s not dead. He’s just resting.”