A Perfect CRIME? TIME Will Tell Tal Beery, Web research TL Agenda - - PowerPoint PPT Presentation

a perfect crime time will tell
SMART_READER_LITE
LIVE PREVIEW

A Perfect CRIME? TIME Will Tell Tal Beery, Web research TL Agenda - - PowerPoint PPT Presentation

A Perfect CRIME? TIME Will Tell Tal Beery, Web research TL Agenda BEAST + Modes of operation CRIME + Gzip compression + Compression + encryption leak data TIME + Timing + compression leak data Attacking responses 2


slide-1
SLIDE 1

A Perfect CRIME? TIME Will Tell

Tal Be’ery, Web research TL

slide-2
SLIDE 2

Agenda

§ BEAST

+ Modes of operation

§ CRIME

+ Gzip compression + Compression + encryption leak data

§ TIME

+ Timing + compression leak data

§ Attacking responses

CONFIDENTIAL 2

slide-3
SLIDE 3

CONFIDENTIAL

BEAST

  • CONFIDENTIAL -
slide-4
SLIDE 4

BEAST

§ Rizzo and Duong - 2011 § Browser Exploit Against SSL/TLS (BEAST) § Chosen Plaintext Attack § Targets deterministic Initialization Vectors of Cipher- Block Chaining (CBC)

CONFIDENTIAL 4

slide-5
SLIDE 5

Chosen Plaintext Attack Model

§ A chosen-plaintext attack (CPA) is an attack model for cryptanalysis which presumes that the attacker has the capability to choose arbitrary plaintexts to be encrypted and obtain the corresponding ciphertexts.

CONFIDENTIAL 5

ENC(XX)

slide-6
SLIDE 6

CPA and the web

§ Attacker is Eavesdropper – can see ciphered text § Attacker creates HTTP request interactively (via script)

+ Full control (almost): URL + Can predict: Most headers + Does not control or see: cookies

– Encrypted on wire – Not accessible from script

  • Same Origin Policy
  • “HTTP only”

CONFIDENTIAL 6

slide-7
SLIDE 7

Modes of operation

§ procedure of enabling the repeated and secure use of a block cipher under a single key

CONFIDENTIAL 7

slide-8
SLIDE 8

Modes of operation - CBC

§ Previous block encryption result is fed as an IV to the next block § Encryption becomes “Stateful”

CONFIDENTIAL 8

slide-9
SLIDE 9

1 + n

C

1 + n

P

CBC Oracle

§ Attacker can verify a guess of any plaintext block

CONFIDENTIAL 9

i

C

1 − i

C

i

P

n

P

n

C

) ( ) ( ) (

~ 1 ~ 1 1 1 ~ 1 1 i i n i i n n n n i i n n

P C Enc C P C C Enc C P Enc C P C C P ⊕ = ⊕ ⊕ ⊕ = ⊕ = ⊕ ⊕ =

− − + + − +

i n i i i i i n i i

C C P P C P C Enc C P P ≠ ⇒ ≠ = ⊕ = ⇒ =

+ − + 1 ~ 1 1 ~

) (

slide-10
SLIDE 10

Using the CBC oracle to decrypt the Cookie

§ Attacker knows in which block the cookie resides § Attacker controls the block contents so she can guess

  • nly one byte at a time and verify with the oracle

+ 256 guesses on worst case

§ Repeat the process to discover all bytes in Cookie

CONFIDENTIAL 10

slide-11
SLIDE 11

Practical issues

§ HTTP requests are not a good vehicle for BEAST:

+ New requests may cause new SSL connection + First bytes are fixed: GET /POST /, etc. + URL cannot be arbitrary: Only some characters are allowed

§ The attacker needs a real bi-directional connection

+ Web sockets, Java, Silverlight + All of these technologies respect SOP

§ So to exploit, extra vulnerbaility is needed:

+ SOP bug in the implementation + XSS in victim site

CONFIDENTIAL 11

NOT PRACTICAL

slide-12
SLIDE 12

And yet...

CONFIDENTIAL 12

slide-13
SLIDE 13

Mitigations

§ TLS 1.1 mitigates

+ Explicit IV + Not widely adopted

§ Some advise to switch to SSL with stream ciphers

+ RC4

CONFIDENTIAL 13

slide-14
SLIDE 14

CONFIDENTIAL

CRIME

  • CONFIDENTIAL -
slide-15
SLIDE 15

CRIME

§ Rizzo and Duong – 2012 § Compression Ratio Info-leak Made Easy (CRIME) § Chosen Plaintext Attack § Targets compression information leakage

CONFIDENTIAL 15

slide-16
SLIDE 16

Compression – LZ algorithms

§ Lempel Ziv, late 70s § Compress repeating strings

+ Lossless + Asymptotically optimal + No overhead (No extra dictionary)

CONFIDENTIAL 16

slide-17
SLIDE 17

LZ Compression – Example

§ 001:001 In the beginning God created<25, 5>heaven an<14, 6>earth. 0<63, 5>2 A<23, 12> was without form,<55, 5>void;<9, 5>darkness<40, 4> <0, 7>upo<132, 6>face of<11, 5>deep.<93, 9>Spirit<27, 4><158, 4>mov<156, 3><54, 4><67, 9><62, 16>w<191, 3>rs

CONFIDENTIAL 17

slide-18
SLIDE 18

Huffman code

§ David Huffman - 1952 § Assign shorter codes (in bits) for frequent letters § Note - Prefix code is a must!

+ Since we cannot rely on length to parse

CONFIDENTIAL 18

slide-19
SLIDE 19

Compression & Encryption

CONFIDENTIAL 19

slide-20
SLIDE 20

Compression & Encryption

CONFIDENTIAL 20

slide-21
SLIDE 21

Compression on the web

§ Content compression

+ GZIP on response + On request body (Uncommon)

§ Header compression

+ SSL/TLS Compression

– Servers: Open SSL, others – Clients: Chrome

+ SPDY

– Servers: Apache MOD_SSL, others – Clients: All but IE

CONFIDENTIAL 21

slide-22
SLIDE 22

Compression leaks data

§ Again

+ Use the URL attacker controls + Guess byte by byte + Verify with an oracle

– If we had guessed correctly then packet size will be shorter

22 CONFIDENTIAL

slide-23
SLIDE 23

CRIME in a slide

CONFIDENTIAL 23

  • ung & Rizzo original presentation

https://docs.google.com/presentation/d/11eBmGiHbYcHR9gL5nDyZChu_-lCa2GizeuOfaLU2HOU/present#slide=id.g1d134dff_1_157

slide-24
SLIDE 24

Practical issues

§ HTTP requests are a good vehicle for CRIME:

+ New requests over SPDY use the same SSL connection and

compression context

+ The controlled part is “location tolerant” + The controlled part can express needed alphabet

§ Some issues with Huffman coding

+ Some chars representation < 1 byte + Good guess might get unnoticed

§ Solutions

+ Mostly tricks to make GZIP compress with not so aggressive

Huffman coding

CONFIDENTIAL 24

slide-25
SLIDE 25

Impact

§ Actual impact

+ SPDY implementations cancel/modify header compression + Chrome disabled SSL compression

§ PR Impact

+ Much less than BEAST + The boy who cried BEAST syndrome

CONFIDENTIAL 25

slide-26
SLIDE 26

CONFIDENTIAL

TIME

  • CONFIDENTIAL -
slide-27
SLIDE 27

TIME

§ Imperva – 2013 § Timing Info-leak Made Easy (TIME) § Chosen Plaintext Attack § Targets compression and timing information leakage

CONFIDENTIAL 27

slide-28
SLIDE 28

Attack Model

§ Attacker has the capability to choose arbitrary plaintexts to be compressed and obtain timing observations on their traffic § Attacker is no longer an Eavesdropper - attack might be useful against plaintext too!

CONFIDENTIAL 28

F(Comp(XX))

slide-29
SLIDE 29

Timing oracle

§ Client send a window of TCP packets § Waits RTT for ACK to send another § RTT time is noticeable § attacker can easily distinguish

+ Size(request) <= window + Size(request) > window

§ If payload length is exactly on data boundary, attacker can determine 1 byte differences

CONFIDENTIAL 29

http://ulam2.cs.luc.edu/ebook/chap03.html

slide-30
SLIDE 30

HTTP Request’s Time Measurements

§ Create HTTP request with XHR

+ XHR adheres to SOP + Allows GET requests to flow

– If headers allow show response – If not, abort

+ We don’t care for the response + Timing leaks the request size

§ Use getTime() on XHR events

+ onreadystatechange

§ Noise elimination

+ Repeat the process (say 10 times) and obtain Minimal time

CONFIDENTIAL 30

slide-31
SLIDE 31

Compression leaks data

§ Again

+ Use the URL attacker controls + Guess byte by byte + Verify with an oracle

– If we had guessed correctly: packet size will be shorter and so will the time

31 CONFIDENTIAL

slide-32
SLIDE 32

RTT Gap in the wild

CONFIDENTIAL 32

§ Sent with Chrome § Sends 2 packets and wait § If you need to send 3 packets – pay extra RTT

slide-33
SLIDE 33

RTT Gap in the wild – implementing the Oracle

§ HTML with Javascript Sending method is XHR § Testing cnn.com § Timing can be correctly captured § Results are conclusive

CONFIDENTIAL 33

Script results

slide-34
SLIDE 34

CONFIDENTIAL

Attacking responses

  • CONFIDENTIAL -
slide-35
SLIDE 35

Attacking response

§ Detecting size – remains the same § Generating requests – remains the same § Main change

+ Attacker can only control the response indirectly + For example with the search functionality

CONFIDENTIAL 35

slide-36
SLIDE 36

Attack PoC

CONFIDENTIAL 36

slide-37
SLIDE 37

Attack PoC demo

CONFIDENTIAL 37

slide-38
SLIDE 38

HTTP Response Time Measurements

§ Create HTTP request with iframe

+ iframe adhere to SOP + Doesn’t allow parent to access the response content + Timing leaks the response size

§ Use getTime() on iframe events

+ onLoad + Onreadystatechange (IE)

§ Noise elimination – as before

CONFIDENTIAL 38

slide-39
SLIDE 39

HTTP Response Time Measurements

CONFIDENTIAL 39

slide-40
SLIDE 40

Candidate?

§ Get the Twitter username of a logged in user

CONFIDENTIAL 40

slide-41
SLIDE 41

Candidate?

CONFIDENTIAL 41