Practical Padding Oracle Attacks J. Rizzo T. Duong Black Hat - - PowerPoint PPT Presentation

practical padding oracle attacks
SMART_READER_LITE
LIVE PREVIEW

Practical Padding Oracle Attacks J. Rizzo T. Duong Black Hat - - PowerPoint PPT Presentation

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Practical Padding Oracle Attacks J. Rizzo T. Duong Black Hat Europe, 2010 J. Rizzo, T. Duong Practical Padding Oracle Attacks Introduction Finding Padding


slide-1
SLIDE 1

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary

Practical Padding Oracle Attacks

  • J. Rizzo
  • T. Duong

Black Hat Europe, 2010

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-2
SLIDE 2

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary

Outline

1

Introduction Review of CBC Mode Padding Oracle attacks

2

Finding Padding Oracles Find potential padding oracles Confirm the existence of padding oracles

3

Basic PO attacks Cracking CAPTCHA Decrypting JSF view states

4

Advanced PO attacks Using PO to encrypt Distributed cross-site PO attacks

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-3
SLIDE 3

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Outline

1

Introduction Review of CBC Mode Padding Oracle attacks

2

Finding Padding Oracles Find potential padding oracles Confirm the existence of padding oracles

3

Basic PO attacks Cracking CAPTCHA Decrypting JSF view states

4

Advanced PO attacks Using PO to encrypt Distributed cross-site PO attacks

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-4
SLIDE 4

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

CBC Mode

CBC mode is a mode of operation for a block cipher. Allows encryption of arbitrary length data. Encryption and decryption are defined by: Ci = eK(Pi ⊕Ci−1) Pi = dK(Ci)⊕Ci−1

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-5
SLIDE 5

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

CBC Mode

CBC mode is a mode of operation for a block cipher. Allows encryption of arbitrary length data. Encryption and decryption are defined by: Ci = eK(Pi ⊕Ci−1) Pi = dK(Ci)⊕Ci−1

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-6
SLIDE 6

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

CBC Mode

CBC mode is a mode of operation for a block cipher. Allows encryption of arbitrary length data. Encryption and decryption are defined by: Ci = eK(Pi ⊕Ci−1) Pi = dK(Ci)⊕Ci−1

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-7
SLIDE 7

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

CBC Mode

CBC mode is a mode of operation for a block cipher. Allows encryption of arbitrary length data. Encryption and decryption are defined by: Ci = eK(Pi ⊕Ci−1) Pi = dK(Ci)⊕Ci−1

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-8
SLIDE 8

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

CBC Mode Encryption and Decryption

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-9
SLIDE 9

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Bit Flipping in CBC Mode

Flipping bits in Ci−1 leads to controlled changes in Pi. Block Pi−1 is garbled.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-10
SLIDE 10

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding in CBC Mode

How should padding be added in CBC Mode? Numerous possibilities including:

Append unique removable pattern (“10...0” or “012...b” or “bb....b”). Append or prepend length information in field of fixed size, pad remaining bits in fixed way (e.g. 0’s).

Padding can also be used to enhance security:

Disguise the length of plaintexts. Prevent traffic analysis, or guessing based on plaintext length.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-11
SLIDE 11

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding in CBC Mode

How should padding be added in CBC Mode? Numerous possibilities including:

Append unique removable pattern (“10...0” or “012...b” or “bb....b”). Append or prepend length information in field of fixed size, pad remaining bits in fixed way (e.g. 0’s).

Padding can also be used to enhance security:

Disguise the length of plaintexts. Prevent traffic analysis, or guessing based on plaintext length.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-12
SLIDE 12

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding in CBC Mode

How should padding be added in CBC Mode? Numerous possibilities including:

Append unique removable pattern (“10...0” or “012...b” or “bb....b”). Append or prepend length information in field of fixed size, pad remaining bits in fixed way (e.g. 0’s).

Padding can also be used to enhance security:

Disguise the length of plaintexts. Prevent traffic analysis, or guessing based on plaintext length.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-13
SLIDE 13

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding in CBC Mode

How should padding be added in CBC Mode? Numerous possibilities including:

Append unique removable pattern (“10...0” or “012...b” or “bb....b”). Append or prepend length information in field of fixed size, pad remaining bits in fixed way (e.g. 0’s).

Padding can also be used to enhance security:

Disguise the length of plaintexts. Prevent traffic analysis, or guessing based on plaintext length.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-14
SLIDE 14

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding in CBC Mode

Can padding have a negative impact on security? Vaudenay (Eurocrypt 2002) showed that padding oracles and bit flipping can be used to build decryption oracle for CBC mode.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-15
SLIDE 15

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding in CBC Mode

Can padding have a negative impact on security? Vaudenay (Eurocrypt 2002) showed that padding oracles and bit flipping can be used to build decryption oracle for CBC mode.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-16
SLIDE 16

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Outline

1

Introduction Review of CBC Mode Padding Oracle attacks

2

Finding Padding Oracles Find potential padding oracles Confirm the existence of padding oracles

3

Basic PO attacks Cracking CAPTCHA Decrypting JSF view states

4

Advanced PO attacks Using PO to encrypt Distributed cross-site PO attacks

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-17
SLIDE 17

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding Oracle attacks

Two assumptions:

Adversary can intercept padded messages encrypted in CBC mode. Adversary has access to a padding oracle.

What is a padding oracle?

Adversary submits a CBC mode ciphertext C to oracle ð. Oracle decrypts under fixed key K and checks correctness of padding. Oracle outputs VALID or INVALID according to correctness of padding: ð(C) =

  • 0,

invalid 1, valid

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-18
SLIDE 18

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding Oracle attacks

Two assumptions:

Adversary can intercept padded messages encrypted in CBC mode. Adversary has access to a padding oracle.

What is a padding oracle?

Adversary submits a CBC mode ciphertext C to oracle ð. Oracle decrypts under fixed key K and checks correctness of padding. Oracle outputs VALID or INVALID according to correctness of padding: ð(C) =

  • 0,

invalid 1, valid

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-19
SLIDE 19

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding Oracle attacks

Two assumptions:

Adversary can intercept padded messages encrypted in CBC mode. Adversary has access to a padding oracle.

What is a padding oracle?

Adversary submits a CBC mode ciphertext C to oracle ð. Oracle decrypts under fixed key K and checks correctness of padding. Oracle outputs VALID or INVALID according to correctness of padding: ð(C) =

  • 0,

invalid 1, valid

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-20
SLIDE 20

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding Oracle attacks

Two assumptions:

Adversary can intercept padded messages encrypted in CBC mode. Adversary has access to a padding oracle.

What is a padding oracle?

Adversary submits a CBC mode ciphertext C to oracle ð. Oracle decrypts under fixed key K and checks correctness of padding. Oracle outputs VALID or INVALID according to correctness of padding: ð(C) =

  • 0,

invalid 1, valid

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-21
SLIDE 21

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding Oracle attacks

Last word decryption algorithm pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). if ð(r|y) = 0 then increment i and go back to previous step. replace rb by rb ⊕i. for n = b down to 2

1

take r = r1...rb−n(rb−1+1 ⊕1)rb−n+2...rb

2

if ð(r|y) = 0 then stop and output (rb−n+1 ⊕n)...(rb ⊕n)

  • utput rb ⊕1.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-22
SLIDE 22

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding Oracle attacks

Last word decryption algorithm pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). if ð(r|y) = 0 then increment i and go back to previous step. replace rb by rb ⊕i. for n = b down to 2

1

take r = r1...rb−n(rb−1+1 ⊕1)rb−n+2...rb

2

if ð(r|y) = 0 then stop and output (rb−n+1 ⊕n)...(rb ⊕n)

  • utput rb ⊕1.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-23
SLIDE 23

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding Oracle attacks

Last word decryption algorithm pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). if ð(r|y) = 0 then increment i and go back to previous step. replace rb by rb ⊕i. for n = b down to 2

1

take r = r1...rb−n(rb−1+1 ⊕1)rb−n+2...rb

2

if ð(r|y) = 0 then stop and output (rb−n+1 ⊕n)...(rb ⊕n)

  • utput rb ⊕1.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-24
SLIDE 24

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding Oracle attacks

Last word decryption algorithm pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). if ð(r|y) = 0 then increment i and go back to previous step. replace rb by rb ⊕i. for n = b down to 2

1

take r = r1...rb−n(rb−1+1 ⊕1)rb−n+2...rb

2

if ð(r|y) = 0 then stop and output (rb−n+1 ⊕n)...(rb ⊕n)

  • utput rb ⊕1.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-25
SLIDE 25

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding Oracle attacks

Last word decryption algorithm pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). if ð(r|y) = 0 then increment i and go back to previous step. replace rb by rb ⊕i. for n = b down to 2

1

take r = r1...rb−n(rb−1+1 ⊕1)rb−n+2...rb

2

if ð(r|y) = 0 then stop and output (rb−n+1 ⊕n)...(rb ⊕n)

  • utput rb ⊕1.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-26
SLIDE 26

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Review of CBC Mode Padding Oracle attacks

Padding Oracle attacks

Last word decryption algorithm pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). if ð(r|y) = 0 then increment i and go back to previous step. replace rb by rb ⊕i. for n = b down to 2

1

take r = r1...rb−n(rb−1+1 ⊕1)rb−n+2...rb

2

if ð(r|y) = 0 then stop and output (rb−n+1 ⊕n)...(rb ⊕n)

  • utput rb ⊕1.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-27
SLIDE 27

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Outline

1

Introduction Review of CBC Mode Padding Oracle attacks

2

Finding Padding Oracles Find potential padding oracles Confirm the existence of padding oracles

3

Basic PO attacks Cracking CAPTCHA Decrypting JSF view states

4

Advanced PO attacks Using PO to encrypt Distributed cross-site PO attacks

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-28
SLIDE 28

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Finding potential padding oracles

Blackbox testing. Google hacking. Source code auditing.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-29
SLIDE 29

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Finding potential padding oracles

Blackbox testing. Google hacking. Source code auditing.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-30
SLIDE 30

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Finding potential padding oracles

Blackbox testing. Google hacking. Source code auditing.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-31
SLIDE 31

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Finding potential padding oracles

Blackbox testing. Google hacking. Source code auditing.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-32
SLIDE 32

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Outline

1

Introduction Review of CBC Mode Padding Oracle attacks

2

Finding Padding Oracles Find potential padding oracles Confirm the existence of padding oracles

3

Basic PO attacks Cracking CAPTCHA Decrypting JSF view states

4

Advanced PO attacks Using PO to encrypt Distributed cross-site PO attacks

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-33
SLIDE 33

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Determine the block size b

All padding oracle attacks need a correct b. Most common block sizes are 8 and 16 bytes. Of course we can use trial and error. How to determine the block size if len(C)%16 = 8, then stop and output 8. take y = C[−16 :], i.e. y is the last sixteen bytes of C. if ð(C|y) = 1, then stop and output 8.

  • utput 16.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-34
SLIDE 34

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Determine the block size b

All padding oracle attacks need a correct b. Most common block sizes are 8 and 16 bytes. Of course we can use trial and error. How to determine the block size if len(C)%16 = 8, then stop and output 8. take y = C[−16 :], i.e. y is the last sixteen bytes of C. if ð(C|y) = 1, then stop and output 8.

  • utput 16.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-35
SLIDE 35

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Determine the block size b

All padding oracle attacks need a correct b. Most common block sizes are 8 and 16 bytes. Of course we can use trial and error. How to determine the block size if len(C)%16 = 8, then stop and output 8. take y = C[−16 :], i.e. y is the last sixteen bytes of C. if ð(C|y) = 1, then stop and output 8.

  • utput 16.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-36
SLIDE 36

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Determine the block size b

All padding oracle attacks need a correct b. Most common block sizes are 8 and 16 bytes. Of course we can use trial and error. How to determine the block size if len(C)%16 = 8, then stop and output 8. take y = C[−16 :], i.e. y is the last sixteen bytes of C. if ð(C|y) = 1, then stop and output 8.

  • utput 16.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-37
SLIDE 37

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Determine the block size b

All padding oracle attacks need a correct b. Most common block sizes are 8 and 16 bytes. Of course we can use trial and error. How to determine the block size if len(C)%16 = 8, then stop and output 8. take y = C[−16 :], i.e. y is the last sixteen bytes of C. if ð(C|y) = 1, then stop and output 8.

  • utput 16.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-38
SLIDE 38

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Determine the block size b

All padding oracle attacks need a correct b. Most common block sizes are 8 and 16 bytes. Of course we can use trial and error. How to determine the block size if len(C)%16 = 8, then stop and output 8. take y = C[−16 :], i.e. y is the last sixteen bytes of C. if ð(C|y) = 1, then stop and output 8.

  • utput 16.
  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-39
SLIDE 39

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

We want the target to reveal as many different reactions to the modified ciphertexts as possible. The most important thing is to analyse and understand the meaning of these reactions. In short, you need to know when the padding is VALID, and when it’s INVALID. POET a.k.a Padding Oracle Exploitation Tool will be released right after BH Europe 2010.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-40
SLIDE 40

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

We want the target to reveal as many different reactions to the modified ciphertexts as possible. The most important thing is to analyse and understand the meaning of these reactions. In short, you need to know when the padding is VALID, and when it’s INVALID. POET a.k.a Padding Oracle Exploitation Tool will be released right after BH Europe 2010.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-41
SLIDE 41

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

We want the target to reveal as many different reactions to the modified ciphertexts as possible. The most important thing is to analyse and understand the meaning of these reactions. In short, you need to know when the padding is VALID, and when it’s INVALID. POET a.k.a Padding Oracle Exploitation Tool will be released right after BH Europe 2010.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-42
SLIDE 42

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Want to write your own tool to detect Padding Oracle? Follow this guideline (which is based on the algorithm in slide 22):

determine the block size b. pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). Send r|y to the target, where y is a valid ciphertext block. Record the value of i, content length, and content type of the

  • response. Increment i, and go back to step 2 until i > 255.

Now you have 256 responses. If all of them are the same, then the target is not easily showing you that it is vulnerable to Padding Oracle attack. Otherwise, look at each value of i where the responses are different from the rest. Examine carefully each response to see what happened.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-43
SLIDE 43

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Want to write your own tool to detect Padding Oracle? Follow this guideline (which is based on the algorithm in slide 22):

determine the block size b. pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). Send r|y to the target, where y is a valid ciphertext block. Record the value of i, content length, and content type of the

  • response. Increment i, and go back to step 2 until i > 255.

Now you have 256 responses. If all of them are the same, then the target is not easily showing you that it is vulnerable to Padding Oracle attack. Otherwise, look at each value of i where the responses are different from the rest. Examine carefully each response to see what happened.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-44
SLIDE 44

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Want to write your own tool to detect Padding Oracle? Follow this guideline (which is based on the algorithm in slide 22):

determine the block size b. pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). Send r|y to the target, where y is a valid ciphertext block. Record the value of i, content length, and content type of the

  • response. Increment i, and go back to step 2 until i > 255.

Now you have 256 responses. If all of them are the same, then the target is not easily showing you that it is vulnerable to Padding Oracle attack. Otherwise, look at each value of i where the responses are different from the rest. Examine carefully each response to see what happened.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-45
SLIDE 45

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Want to write your own tool to detect Padding Oracle? Follow this guideline (which is based on the algorithm in slide 22):

determine the block size b. pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). Send r|y to the target, where y is a valid ciphertext block. Record the value of i, content length, and content type of the

  • response. Increment i, and go back to step 2 until i > 255.

Now you have 256 responses. If all of them are the same, then the target is not easily showing you that it is vulnerable to Padding Oracle attack. Otherwise, look at each value of i where the responses are different from the rest. Examine carefully each response to see what happened.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-46
SLIDE 46

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Want to write your own tool to detect Padding Oracle? Follow this guideline (which is based on the algorithm in slide 22):

determine the block size b. pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). Send r|y to the target, where y is a valid ciphertext block. Record the value of i, content length, and content type of the

  • response. Increment i, and go back to step 2 until i > 255.

Now you have 256 responses. If all of them are the same, then the target is not easily showing you that it is vulnerable to Padding Oracle attack. Otherwise, look at each value of i where the responses are different from the rest. Examine carefully each response to see what happened.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-47
SLIDE 47

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Find potential padding oracles Confirm the existence of padding oracles

Confirm the existence of padding oracles

Want to write your own tool to detect Padding Oracle? Follow this guideline (which is based on the algorithm in slide 22):

determine the block size b. pick a few random words r1,...,rb, and take i = 0. pick r = r1r2...rb−1(rb ⊕i). Send r|y to the target, where y is a valid ciphertext block. Record the value of i, content length, and content type of the

  • response. Increment i, and go back to step 2 until i > 255.

Now you have 256 responses. If all of them are the same, then the target is not easily showing you that it is vulnerable to Padding Oracle attack. Otherwise, look at each value of i where the responses are different from the rest. Examine carefully each response to see what happened.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-48
SLIDE 48

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Outline

1

Introduction Review of CBC Mode Padding Oracle attacks

2

Finding Padding Oracles Find potential padding oracles Confirm the existence of padding oracles

3

Basic PO attacks Cracking CAPTCHA Decrypting JSF view states

4

Advanced PO attacks Using PO to encrypt Distributed cross-site PO attacks

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-49
SLIDE 49

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

A broken CAPTCHA system ERC = eK,IV (rand()). ...<img src=”/captcha?token=ERC” />... ERC is stored as either a hidden field or a cookie in the CAPTCHA form. Once a user submits, the server decrypts ERC, and compares it with the code that the user has entered. If equal, the server accepts the request; it denies the request otherwise.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-50
SLIDE 50

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

A broken CAPTCHA system ERC = eK,IV (rand()). ...<img src=”/captcha?token=ERC” />... ERC is stored as either a hidden field or a cookie in the CAPTCHA form. Once a user submits, the server decrypts ERC, and compares it with the code that the user has entered. If equal, the server accepts the request; it denies the request otherwise.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-51
SLIDE 51

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

A broken CAPTCHA system ERC = eK,IV (rand()). ...<img src=”/captcha?token=ERC” />... ERC is stored as either a hidden field or a cookie in the CAPTCHA form. Once a user submits, the server decrypts ERC, and compares it with the code that the user has entered. If equal, the server accepts the request; it denies the request otherwise.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-52
SLIDE 52

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

A broken CAPTCHA system ERC = eK,IV (rand()). ...<img src=”/captcha?token=ERC” />... ERC is stored as either a hidden field or a cookie in the CAPTCHA form. Once a user submits, the server decrypts ERC, and compares it with the code that the user has entered. If equal, the server accepts the request; it denies the request otherwise.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-53
SLIDE 53

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

Bypass the broken CAPTCHA system

Since the system decrypts any ERC sent to it, it is vulnerable to Padding Oracle attack. The only remaining problem now is to know when padding is VALID, and when it’s not. Fortunately, most CAPTCHA systems would send back an error notification when they fail to decrypt ERC, i.e. padding is INVALID. In addition, when we modify ERC so that the padding is VALID, most systems would display an image with a broken code. Now we have a Padding Oracle, and we can use it to decrypt any ERC, thus bypass the CAPTCHA completely.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-54
SLIDE 54

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

Bypass the broken CAPTCHA system

Since the system decrypts any ERC sent to it, it is vulnerable to Padding Oracle attack. The only remaining problem now is to know when padding is VALID, and when it’s not. Fortunately, most CAPTCHA systems would send back an error notification when they fail to decrypt ERC, i.e. padding is INVALID. In addition, when we modify ERC so that the padding is VALID, most systems would display an image with a broken code. Now we have a Padding Oracle, and we can use it to decrypt any ERC, thus bypass the CAPTCHA completely.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-55
SLIDE 55

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

Bypass the broken CAPTCHA system

Since the system decrypts any ERC sent to it, it is vulnerable to Padding Oracle attack. The only remaining problem now is to know when padding is VALID, and when it’s not. Fortunately, most CAPTCHA systems would send back an error notification when they fail to decrypt ERC, i.e. padding is INVALID. In addition, when we modify ERC so that the padding is VALID, most systems would display an image with a broken code. Now we have a Padding Oracle, and we can use it to decrypt any ERC, thus bypass the CAPTCHA completely.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-56
SLIDE 56

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

Bypass the broken CAPTCHA system

Since the system decrypts any ERC sent to it, it is vulnerable to Padding Oracle attack. The only remaining problem now is to know when padding is VALID, and when it’s not. Fortunately, most CAPTCHA systems would send back an error notification when they fail to decrypt ERC, i.e. padding is INVALID. In addition, when we modify ERC so that the padding is VALID, most systems would display an image with a broken code. Now we have a Padding Oracle, and we can use it to decrypt any ERC, thus bypass the CAPTCHA completely.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-57
SLIDE 57

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

Bypass the broken CAPTCHA system

Since the system decrypts any ERC sent to it, it is vulnerable to Padding Oracle attack. The only remaining problem now is to know when padding is VALID, and when it’s not. Fortunately, most CAPTCHA systems would send back an error notification when they fail to decrypt ERC, i.e. padding is INVALID. In addition, when we modify ERC so that the padding is VALID, most systems would display an image with a broken code. Now we have a Padding Oracle, and we can use it to decrypt any ERC, thus bypass the CAPTCHA completely.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-58
SLIDE 58

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

CAPTCHA with secret IV

Since P0 = IV ⊕dð(C0), we need to know the IV to get P0. If the IV is secret, we can’t know P0, thus can’t crack CAPTCHA systems whose P0 contains part of the random code. The solution is: IV = Human ⊕dð(C0), where Human denotes that somebody reads P0 from the CAPTCHA image.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-59
SLIDE 59

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

CAPTCHA with secret IV

Since P0 = IV ⊕dð(C0), we need to know the IV to get P0. If the IV is secret, we can’t know P0, thus can’t crack CAPTCHA systems whose P0 contains part of the random code. The solution is: IV = Human ⊕dð(C0), where Human denotes that somebody reads P0 from the CAPTCHA image.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-60
SLIDE 60

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Cracking CAPTCHA

CAPTCHA with secret IV

Since P0 = IV ⊕dð(C0), we need to know the IV to get P0. If the IV is secret, we can’t know P0, thus can’t crack CAPTCHA systems whose P0 contains part of the random code. The solution is: IV = Human ⊕dð(C0), where Human denotes that somebody reads P0 from the CAPTCHA image.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-61
SLIDE 61

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Outline

1

Introduction Review of CBC Mode Padding Oracle attacks

2

Finding Padding Oracles Find potential padding oracles Confirm the existence of padding oracles

3

Basic PO attacks Cracking CAPTCHA Decrypting JSF view states

4

Advanced PO attacks Using PO to encrypt Distributed cross-site PO attacks

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-62
SLIDE 62

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Decrypting JSF view states

Introduction

JavaServer Faces (JSF) is a popular Java-based standard for building server-side user interfaces. Like ASP.NET, JSF stores the state of the view in a hidden field. Although JSF specification advises that view state should be encrypted and tamper evident, but no implementation follows that advice. In other words, we can use Padding Oracle attacks to decrypt the view states of most JSF frameworks.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-63
SLIDE 63

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Decrypting JSF view states

Introduction

JavaServer Faces (JSF) is a popular Java-based standard for building server-side user interfaces. Like ASP.NET, JSF stores the state of the view in a hidden field. Although JSF specification advises that view state should be encrypted and tamper evident, but no implementation follows that advice. In other words, we can use Padding Oracle attacks to decrypt the view states of most JSF frameworks.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-64
SLIDE 64

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Decrypting JSF view states

Introduction

JavaServer Faces (JSF) is a popular Java-based standard for building server-side user interfaces. Like ASP.NET, JSF stores the state of the view in a hidden field. Although JSF specification advises that view state should be encrypted and tamper evident, but no implementation follows that advice. In other words, we can use Padding Oracle attacks to decrypt the view states of most JSF frameworks.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-65
SLIDE 65

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Decrypting JSF view states

Introduction

JavaServer Faces (JSF) is a popular Java-based standard for building server-side user interfaces. Like ASP.NET, JSF stores the state of the view in a hidden field. Although JSF specification advises that view state should be encrypted and tamper evident, but no implementation follows that advice. In other words, we can use Padding Oracle attacks to decrypt the view states of most JSF frameworks.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-66
SLIDE 66

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Decrypting JSF view states

Padding Oracle in JSF frameworks

By default, all JSF frameworks would display a very detailed error message if it fails to decrypt a view state. Padding Oracle in default installations of JSF frameworks if we see javax.crypto.BadPaddingException, then it’s INVALID padding it’s VALID padding otherwise.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-67
SLIDE 67

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Decrypting JSF view states

Padding Oracle in JSF frameworks

By default, all JSF frameworks would display a very detailed error message if it fails to decrypt a view state. Padding Oracle in default installations of JSF frameworks if we see javax.crypto.BadPaddingException, then it’s INVALID padding it’s VALID padding otherwise.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-68
SLIDE 68

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Decrypting JSF view states

Apache MyFaces error-page

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-69
SLIDE 69

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Decrypting JSF view states

Padding Oracle in JSF frameworks

Most JSF frameworks allow developers to turn off error

  • messages. Then we can use the following simple trick:

Padding Oracle in JSF frameworks when error-page is turned off Say we want to decrypt block Ci of an encrypted view state C0|C1|...|Cn−1, then we send C0|C1|...|Cn−1|Crandom|Ci to the target. Since Java ignores those extra blocks while decrypting and deserializing view states, it’s VALID padding if the target returns the same page as when the view state is unaltered. And it’s probably INVALID padding if we see something else, e.g. a HTTP 500 error message.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-70
SLIDE 70

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Decrypting JSF view states

Padding Oracle in JSF frameworks

Most JSF frameworks allow developers to turn off error

  • messages. Then we can use the following simple trick:

Padding Oracle in JSF frameworks when error-page is turned off Say we want to decrypt block Ci of an encrypted view state C0|C1|...|Cn−1, then we send C0|C1|...|Cn−1|Crandom|Ci to the target. Since Java ignores those extra blocks while decrypting and deserializing view states, it’s VALID padding if the target returns the same page as when the view state is unaltered. And it’s probably INVALID padding if we see something else, e.g. a HTTP 500 error message.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-71
SLIDE 71

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Cracking CAPTCHA Decrypting JSF view states

Decrypting JSF view states

Padding Oracle in JSF frameworks

Most JSF frameworks allow developers to turn off error

  • messages. Then we can use the following simple trick:

Padding Oracle in JSF frameworks when error-page is turned off Say we want to decrypt block Ci of an encrypted view state C0|C1|...|Cn−1, then we send C0|C1|...|Cn−1|Crandom|Ci to the target. Since Java ignores those extra blocks while decrypting and deserializing view states, it’s VALID padding if the target returns the same page as when the view state is unaltered. And it’s probably INVALID padding if we see something else, e.g. a HTTP 500 error message.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-72
SLIDE 72

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Outline

1

Introduction Review of CBC Mode Padding Oracle attacks

2

Finding Padding Oracles Find potential padding oracles Confirm the existence of padding oracles

3

Basic PO attacks Cracking CAPTCHA Decrypting JSF view states

4

Advanced PO attacks Using PO to encrypt Distributed cross-site PO attacks

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-73
SLIDE 73

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

An introduction to CBC-R

CBC-R turns a decryption oracle into an encryption oracle. We all know that CBC decryption works as following: Pi = dK(Ci)⊕Ci−1 C0 = IV We can use a Padding Oracle to get dK(Ci), and we control Ci−1. In other words, we can produce any Pi as we want.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-74
SLIDE 74

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

An introduction to CBC-R

CBC-R turns a decryption oracle into an encryption oracle. We all know that CBC decryption works as following: Pi = dK(Ci)⊕Ci−1 C0 = IV We can use a Padding Oracle to get dK(Ci), and we control Ci−1. In other words, we can produce any Pi as we want.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-75
SLIDE 75

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

An introduction to CBC-R

CBC-R turns a decryption oracle into an encryption oracle. We all know that CBC decryption works as following: Pi = dK(Ci)⊕Ci−1 C0 = IV We can use a Padding Oracle to get dK(Ci), and we control Ci−1. In other words, we can produce any Pi as we want.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-76
SLIDE 76

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

How CBC-R works

CBC-R pseudocode choose a plaintext message P0|...|Pn−1 that you want to encrypt. pick a random Cn−1. for i = n −1 down to 1: Ci−1 = Pi ⊕dð(Ci) IV = P0 ⊕dð(C0)

  • utput IV |C0|C1|...|Cn−1. This ciphertext would be decrypted

to P0|...|Pn−1.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-77
SLIDE 77

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

How CBC-R works

CBC-R pseudocode choose a plaintext message P0|...|Pn−1 that you want to encrypt. pick a random Cn−1. for i = n −1 down to 1: Ci−1 = Pi ⊕dð(Ci) IV = P0 ⊕dð(C0)

  • utput IV |C0|C1|...|Cn−1. This ciphertext would be decrypted

to P0|...|Pn−1.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-78
SLIDE 78

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

How CBC-R works

CBC-R pseudocode choose a plaintext message P0|...|Pn−1 that you want to encrypt. pick a random Cn−1. for i = n −1 down to 1: Ci−1 = Pi ⊕dð(Ci) IV = P0 ⊕dð(C0)

  • utput IV |C0|C1|...|Cn−1. This ciphertext would be decrypted

to P0|...|Pn−1.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-79
SLIDE 79

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

How CBC-R works

CBC-R pseudocode choose a plaintext message P0|...|Pn−1 that you want to encrypt. pick a random Cn−1. for i = n −1 down to 1: Ci−1 = Pi ⊕dð(Ci) IV = P0 ⊕dð(C0)

  • utput IV |C0|C1|...|Cn−1. This ciphertext would be decrypted

to P0|...|Pn−1.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-80
SLIDE 80

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

How CBC-R works

CBC-R pseudocode choose a plaintext message P0|...|Pn−1 that you want to encrypt. pick a random Cn−1. for i = n −1 down to 1: Ci−1 = Pi ⊕dð(Ci) IV = P0 ⊕dð(C0)

  • utput IV |C0|C1|...|Cn−1. This ciphertext would be decrypted

to P0|...|Pn−1.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-81
SLIDE 81

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Without Controlling IV

CBC-R allows us to encrypt any message, but if we cannot set the IV , then first plaintext block P0 will be random and meaningless. If the victim expects the decrypted message to start with a standard header, then it will ignore the forged message constructed by CBC-R. We have not found generic way to overcome this limitation. However, we have found workarounds for particular cases.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-82
SLIDE 82

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Without Controlling IV

CBC-R allows us to encrypt any message, but if we cannot set the IV , then first plaintext block P0 will be random and meaningless. If the victim expects the decrypted message to start with a standard header, then it will ignore the forged message constructed by CBC-R. We have not found generic way to overcome this limitation. However, we have found workarounds for particular cases.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-83
SLIDE 83

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Without Controlling IV

CBC-R allows us to encrypt any message, but if we cannot set the IV , then first plaintext block P0 will be random and meaningless. If the victim expects the decrypted message to start with a standard header, then it will ignore the forged message constructed by CBC-R. We have not found generic way to overcome this limitation. However, we have found workarounds for particular cases.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-84
SLIDE 84

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Without Controlling IV

Using captured ciphertexts as prefix Pvalid = dK(Ccaptured|IVCBC−R|PCBC−R). The block at the position of IVCBC−R is still garbled. We can make the garbled block becomes part of some string that doesn’t affect the semantic of the message such as comment or textbox label.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-85
SLIDE 85

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Without Controlling IV

Using captured ciphertexts as prefix Pvalid = dK(Ccaptured|IVCBC−R|PCBC−R). The block at the position of IVCBC−R is still garbled. We can make the garbled block becomes part of some string that doesn’t affect the semantic of the message such as comment or textbox label.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-86
SLIDE 86

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Without Controlling IV

Using captured ciphertexts as prefix Pvalid = dK(Ccaptured|IVCBC−R|PCBC−R). The block at the position of IVCBC−R is still garbled. We can make the garbled block becomes part of some string that doesn’t affect the semantic of the message such as comment or textbox label.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-87
SLIDE 87

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Without Controlling IV

Brute-forcing C0 CBC-R can produce many different ciphertexts that decrypted to the same plaintext block chain Pn−1,...,P1. The only difference is the first plaintext block which is computed as following: P0 = dK(C0)⊕IV A valid header means that the first few bytes of P0 must match some magic numbers. There are also systems that accept a message if the first byte of its P0 matches its size. If this is the case, and if the message is short enough, we can try our luck by brute-forcing C0.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-88
SLIDE 88

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Without Controlling IV

Brute-forcing C0 CBC-R can produce many different ciphertexts that decrypted to the same plaintext block chain Pn−1,...,P1. The only difference is the first plaintext block which is computed as following: P0 = dK(C0)⊕IV A valid header means that the first few bytes of P0 must match some magic numbers. There are also systems that accept a message if the first byte of its P0 matches its size. If this is the case, and if the message is short enough, we can try our luck by brute-forcing C0.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-89
SLIDE 89

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Without Controlling IV

Brute-forcing C0 CBC-R can produce many different ciphertexts that decrypted to the same plaintext block chain Pn−1,...,P1. The only difference is the first plaintext block which is computed as following: P0 = dK(C0)⊕IV A valid header means that the first few bytes of P0 must match some magic numbers. There are also systems that accept a message if the first byte of its P0 matches its size. If this is the case, and if the message is short enough, we can try our luck by brute-forcing C0.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-90
SLIDE 90

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Applications

sudo make me a CAPCHA

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-91
SLIDE 91

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Applications

sudo make me a CAPCHA

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-92
SLIDE 92

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Applications

Creating malicious JSF view states Which view states to create? How to solve the garbled block problem?

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-93
SLIDE 93

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Using PO to encrypt

CBC-R Applications

Creating malicious JSF view states Which view states to create? How to solve the garbled block problem?

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-94
SLIDE 94

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Outline

1

Introduction Review of CBC Mode Padding Oracle attacks

2

Finding Padding Oracles Find potential padding oracles Confirm the existence of padding oracles

3

Basic PO attacks Cracking CAPTCHA Decrypting JSF view states

4

Advanced PO attacks Using PO to encrypt Distributed cross-site PO attacks

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-95
SLIDE 95

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Distributed cross-site PO attacks

All attackers need to exploit Padding Oracle is a single bit of information. Cross-domain information leakage bugs in web browsers can help. One example: <img> + onerror()/onload() events. if the image is loaded, then it’s VALID padding; otherwise, it’s INVALID padding.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-96
SLIDE 96

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Distributed cross-site PO attacks

All attackers need to exploit Padding Oracle is a single bit of information. Cross-domain information leakage bugs in web browsers can help. One example: <img> + onerror()/onload() events. if the image is loaded, then it’s VALID padding; otherwise, it’s INVALID padding.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-97
SLIDE 97

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Distributed cross-site PO attacks

All attackers need to exploit Padding Oracle is a single bit of information. Cross-domain information leakage bugs in web browsers can help. One example: <img> + onerror()/onload() events. if the image is loaded, then it’s VALID padding; otherwise, it’s INVALID padding.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-98
SLIDE 98

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Distributed cross-site PO attacks

All attackers need to exploit Padding Oracle is a single bit of information. Cross-domain information leakage bugs in web browsers can help. One example: <img> + onerror()/onload() events. if the image is loaded, then it’s VALID padding; otherwise, it’s INVALID padding.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-99
SLIDE 99

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Distributed cross-site PO attacks

We have decrypted all CAPTCHA on a web site using only JavaScript hosted locally. One can inject JavaScript code into popular web sites, and turn this into a distriubuted attack. It is possible to distributively build a code book.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-100
SLIDE 100

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Distributed cross-site PO attacks

We have decrypted all CAPTCHA on a web site using only JavaScript hosted locally. One can inject JavaScript code into popular web sites, and turn this into a distriubuted attack. It is possible to distributively build a code book.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-101
SLIDE 101

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary Using PO to encrypt Distributed cross-site PO attacks

Distributed cross-site PO attacks

We have decrypted all CAPTCHA on a web site using only JavaScript hosted locally. One can inject JavaScript code into popular web sites, and turn this into a distriubuted attack. It is possible to distributively build a code book.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-102
SLIDE 102

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary

Summary

Padding oracle attacks allow one to decrypt ciphertext without knowing the key. We can use padding oracle attacks to crack CAPTCHA, and decrypt JSF view state, etc. CBC-R turns a decryption oracle into an encryption oracle, and allow us to create malicious JSF view states. Distributed cross-site padding oracle attacks allow one to distributively build a code book to map all ciphertexts to corresponding plaintexts.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-103
SLIDE 103

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary

Summary

Padding oracle attacks allow one to decrypt ciphertext without knowing the key. We can use padding oracle attacks to crack CAPTCHA, and decrypt JSF view state, etc. CBC-R turns a decryption oracle into an encryption oracle, and allow us to create malicious JSF view states. Distributed cross-site padding oracle attacks allow one to distributively build a code book to map all ciphertexts to corresponding plaintexts.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-104
SLIDE 104

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary

Summary

Padding oracle attacks allow one to decrypt ciphertext without knowing the key. We can use padding oracle attacks to crack CAPTCHA, and decrypt JSF view state, etc. CBC-R turns a decryption oracle into an encryption oracle, and allow us to create malicious JSF view states. Distributed cross-site padding oracle attacks allow one to distributively build a code book to map all ciphertexts to corresponding plaintexts.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-105
SLIDE 105

Introduction Finding Padding Oracles Basic PO attacks Advanced PO attacks Summary

Summary

Padding oracle attacks allow one to decrypt ciphertext without knowing the key. We can use padding oracle attacks to crack CAPTCHA, and decrypt JSF view state, etc. CBC-R turns a decryption oracle into an encryption oracle, and allow us to create malicious JSF view states. Distributed cross-site padding oracle attacks allow one to distributively build a code book to map all ciphertexts to corresponding plaintexts.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-106
SLIDE 106

Appendix For Further Reading

For Further Reading I

Black and H. Urtubia. Side-Channel Attacks on Symmetric Encryption Schemes: The Case for Authenticated Encryption. In Proceedings of the 11th USENIX Security Symposium, San Francisco, CA, USA, August 5-9, 2002, pages 327–338. USENIX, 2002. K.G. Paterson and A. Yau. Padding Oracle Attacks on the ISO CBC Mode Padding Standard. In T. Okamoto, editor, Topics in Cryptology — CT-RSA 2004, volume 2964 of Lecture Notes in Computer Science, pages 305–323. Springer-Verlag, 2004.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-107
SLIDE 107

Appendix For Further Reading

For Further Reading II

  • S. Vaudenay. Security Flaws Induced by CBC Padding —

Applications to SSL, IPSEC, WTLS...In L. Knudsen, editor, Advances in Cryptology — EUROCRYPT 2002, volume 2332

  • f Lecture Notes in Computer Science, pages 534–545.

Springer-Verlag, 2002.

  • B. Canvel, A. Hiltgen, S. Vaudenay, and M. Vuagnoux.

Password Interception in a SSL/TLS Channel. In Proc. CRYPTO 2003, D. Boneh (ed.), LNCS Vol. 2729, pp. 583–599, 2003.

  • V. Klima and T. Rosa. Side Channel Attacks on CBC

Encrypted Messages in the PKCS#7 Format. Cryptology ePrint Archive, Report 2003/098, 2003.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks

slide-108
SLIDE 108

Appendix For Further Reading

For Further Reading III

  • A. K. L. Yau, K. G. Paterson, and C. J. Mitchell. Padding

Oracle Attacks on CBC- Mode Encryption with Secret and Random IVs. In H. Gilbert and H. Handschuh, editors, Proceedings of FSE 2005, volume 3557 of LNCS, pages 299–319. Springer- Verlag, 2005.

  • J. Rizzo, T. Duong

Practical Padding Oracle Attacks