• Aucun résultat trouvé

Example chosen-ciphertext attacks

Dans le document Lecture Notes on Cryptography (Page 112-116)

Block ciphers and modes of operation

6.11 Example chosen-ciphertext attacks

Chosen-ciphertext attacks are powerful enough to break all the standard modes of operation, even those like CTR and CBC that (as we will see later) are secure against chosen-plaintext attack. The one-time pad scheme is also vulnerable to a chosen-ciphertext attack: perfect security only takes into account chosen-plaintext attacks. Let us now illustrate a few chosen-ciphertext attacks.

6.11.1 Attack on CTR

Let F:{0,1}k × {0,1}l → {0,1}L be a family of functions and let SE = (K,E,D) be the associated R-CTR symmetric encryption scheme as described in Scheme 6.5. The weakness of the scheme that makes it susceptible to a chosen-ciphertext attack is the following. SayC[0]C[1] is a ciphertext of someL-bit message M, and we flip bit i of C[1], resulting in a new ciphertextC[0]C0[1]. LetM0 be the message obtained by decrypting the new ciphertext. Then M0 equals M with thei-th bit flipped. (You should check that you understand why by looking at Scheme 6.5.) Thus, by making a decryption oracle query ofC[0]C0[1] one can learn M0 and thus M. In the following, we show how this idea can be applied to break the scheme in our model by figuring out in which world an adversary has been placed.

Proposition 6.26 LetF:{0,1}k× {0,1}l→ {0,1}Lbe a family of functions and letSE= (K,E,D) be the corresponding R-CTR symmetric encryption scheme as described in Scheme 6.5. Then

Advind-cca

SE (t,1, L,1, l+L) = 1

Cryptography: Lecture Notes 113

fort=O(l+L) plus the time for one application ofF.

The advantage of this adversary is 1 even though it uses hardly any resources: just one query to each oracle.

That is clearly an indication that the scheme is insecure.

Proof of Proposition 6.26: We will present an adversary algorithmA, having time-complexityt, making 1 query to its lr-encryption oracle, this query being of length L, making 1 query to its decryption oracle, this query being of lengthl+L, and having

Advind-cca

SE,A = 1. The Proposition follows.

Remember the the lr-encryption oracleEK(LR(·,·, b)) takes input a pair of messages, and returns an encryp-tion of either the left or the right message in the pair, depending on the value of b. The goal of A is to determine the value ofb. Our adversary works like this:

AdversaryAEK(LR(·,·,b)),DK(·) M0←0L ; M1←1L

C[0]C[1]← EK(LR(M0, M1, b)) C0[1]←C[1]⊕1L ; C0←C[0]C0[1]

M ← DK(C0)

IfM =M0 then return 1 else return 0

The adversary’s single lr-encryption oracle query is the pair of distinct messages M0, M1, each one block long. It is returned a ciphertextC[0]C[1]. It flips the bits ofC[1] to getC0[1] and then feeds the ciphertext C[0]C0[1] to the decryption oracle. It bets on World 1 if it gets back M0, and otherwise on World 0. It is important thatC[0]C0[1]6=C[0]C[1], so the decryption oracle query is legitimate. Now, we claim that

Ph

Expind-cca-1 SE,A = 1i

= 1

Ph

Expind-cca-0 SE,A = 1i

= 0. Hence Advind-cca

SE,A = 1−0 = 1. And A achieved this advantage by making just one lr-encryption oracle query, whose length, which as per our conventions is just the length ofM0, isLbits, and just one decryption oracle query, whose length isl+L bits. SoAdvind-cca

SE (t,1, L,1, l+L) = 1.

Why are the two equations claimed above true? You have to return to the definitions of the quantities in question, as well as the description of the scheme itself, and walk it through. In World 1, meaning when b= 1, letC[0]C[1] denote the ciphertext returned by the lr-encryption oracle, and letR=StN(C[0]). Then

C[1] = FK(NtSl(R+ 1))⊕M1 = FK(NtSl(R+ 1))⊕1L. Now notice that

M = DK(C[0]C0[1])

= FK(NtSl(R+ 1))⊕C0[1]

= FK(NtSl(R+ 1))⊕C[1]⊕1L

= FK(NtSl(R+ 1))⊕(FK(NtSl(R+ 1))⊕1L)⊕1L

= 0L

= M0.

Thus, the decryption oracle will returnM0, and thus Awill return 1. In World 0, meaning whenb= 0, let C[0]C[1] denote the ciphertext returned by the lr-encryption oracle, and letR=StN(C[0]). Then

C[1] = FK(NtSl(R+ 1))⊕M0 = FK(NtSl(R+ 1))⊕0L. Now notice that

M = DK(C[0]C0[1])

= FK(NtSl(R+ 1))⊕C0[1]

= FK(NtSl(R+ 1))⊕C[1]⊕1L

= FK(NtSl(R+ 1))⊕(FK(NtSl(R+ 1))⊕0L)⊕1L

= 1L

= M1.

Thus, the decryption oracle will returnM1, and thusAwill return 0, meaning will return 1 with probability zero.

An attack on C-CTR (cf. Scheme 6.6) is similar, and is left to the reader.

6.11.2 Attack on CBC

LetE:{0,1}k× {0,1}l→ {0,1}lbe a block cipher and letSE= (K,E,D) be the associated CBC symmetric encryption scheme as described in Scheme 6.4. The weakness of the scheme that makes it susceptible to a chosen-ciphertext attack is the following. SayC[0]C[1] is a ciphertext of some l-bit messageM, and we flip bitiof the IVC[0], resulting in a new ciphertextC0[0]C[1]. Let M0 be the message obtained by decrypting the new ciphertext. Then M0 equals M with the i-th bit flipped. (You should check that you understand why by looking at Scheme 6.4.) Thus, by making a decryption oracle query ofC0[0]C[1] one can learn M0 and thus M. In the following, we show how this idea can be applied to break the scheme in our model by figuring out in which world an adversary has been placed.

Proposition 6.27 Let E:{0,1}k × {0,1}l → {0,1}l be a block cipher and let SE = (K,E,D) be the corresponding CBC symmetric encryption scheme as described in Scheme 6.4. Then

Advind-cca

SE (t,1, l,1,2l) = 1 fort=O(l) plus the time for one application ofF.

The advantage of this adversary is 1 even though it uses hardly any resources: just one query to each oracle.

That is clearly an indication that the scheme is insecure.

Proof of Proposition 6.27: We will present an adversary algorithmA, having time-complexityt, making 1 query to its lr-encryption oracle, this query being of lengthl, making 1 query to its decryption oracle, this query being of length 2l, and having

Advind-cca

SE,A = 1. The Proposition follows.

Remember the the lr-encryption oracleEK(LR(·,·, b)) takes input a pair of messages, and returns an encryp-tion of either the left or the right message in the pair, depending on the value of b. The goal of A is to determine the value ofb. Our adversary works like this:

Cryptography: Lecture Notes 115

AdversaryAEK(LR(·,·,b)),DK(·) M0←0l ; M1←1l

C[0]C[1]← EK(LR(M0, M1, b)) C0[0]←C[0]⊕1L ; C0←C0[0]C[1]

M ← DK(C0)

IfM =M0 then return 1 else return 0

The adversary’s single lr-encryption oracle query is the pair of distinct messages M0, M1, each one block long. It is returned a ciphertext C[0]C[1]. It flips the bits of the IV C[0] to get a new IV C0[0] and then feeds the ciphertextC0[0]C[1] to the decryption oracle. It bets on World 1 if it gets back M0, and otherwise on World 0. It is important that C0[0]C[1]6=C[0]C[1], so the decryption oracle query is legitimate. Now, we claim that

Ph

Expind-cca-1 SE,A = 1i

= 1

Ph

Expind-cca-0 SE,A = 1i

= 0. Hence Advind-cca

SE,A = 1−0 = 1. And A achieved this advantage by making just one lr-encryption oracle query, whose length, which as per our conventions is just the length ofM0, islbits, and just one decryption oracle query, whose length is 2l bits. SoAdvind-cca

SE (t,1, l,1,2l) = 1.

Why are the two equations claimed above true? You have to return to the definitions of the quantities in question, as well as the description of the scheme itself, and walk it through. In World 1, meaning when b= 1, the lr-encryption oracle returnsC[0]C[1] with

C[1] = EK(C[0]⊕M1) = EK(C[0]⊕1l). Now notice that

M = DK(C0[0]C[1])

= EK1(C[1])⊕C0[0]

= EK1(EK(C[0]⊕1l))⊕C0[0]

= (C[0]⊕1l)⊕C0[0]

= (C[0]⊕1l)⊕(C[0]⊕1l)

= 0l

= M0.

Thus, the decryption oracle will returnM0, and thusAwill return 1. In World 0, meaning whenb= 0, the lr-encryption oracle returnsC[0]C[1] with

C[1] = EK(C[0]⊕M0) = EK(C[0]⊕0l). Now notice that

M = DK(C0[0]C[1])

= EK1(C[1])⊕C0[0]

= EK1(EK(C[0]⊕0l))⊕C0[0]

= (C[0]⊕0l)⊕C0[0]

= (C[0]⊕0l)⊕(C[0]⊕1l)

= 1l

= M1.

Thus, the decryption oracle will returnM1, and thusAwill return 0, meaning will return 1 with probability zero.

Dans le document Lecture Notes on Cryptography (Page 112-116)