Trick or Tweak On the (In)security of OTRs Tweaks Raphael Bost 1 , 2 - - PowerPoint PPT Presentation

trick or tweak
SMART_READER_LITE
LIVE PREVIEW

Trick or Tweak On the (In)security of OTRs Tweaks Raphael Bost 1 , 2 - - PowerPoint PPT Presentation

Trick or Tweak On the (In)security of OTRs Tweaks Raphael Bost 1 , 2 Olivier Sanders 3 1 Direction Gnrale de lArmement - Matrise de lInformation 2 Universit de Rennes 1 3 Orange Labs Asiacrypt 2016, Hanoi Raphael Bost, Olivier


slide-1
SLIDE 1

Trick or Tweak

On the (In)security of OTR’s Tweaks Raphael Bost1,2 Olivier Sanders3

1Direction Générale de l’Armement - Maîtrise de l’Information 2Université de Rennes 1 3Orange Labs

Asiacrypt 2016, Hanoi

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 1 / 22

slide-2
SLIDE 2

Offset Two Rounds (OTR)

CAESAR submission by K. Minematsu (Eurocrypt ’14) Rate-1 AE Tweakable blockcipher based Inverse-free version of OCB (only needs E, not E −1) Two rounds Feistel construction Defined for any block size n. M[1] M[2]

  • E N,1,0

K

  • E N,1,1

K

  • C[1]

C[2]

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 2 / 22

slide-3
SLIDE 3

Tweakable Blockcipher (TBC) [LRW02]

Add a public input to a blockcipher – the tweak – to add variability. Each tweak T ∈ T (the tweak space) yields an independent pseudo-random permutation.

Tweakable Blockcipher (a.k.a tweakable PRP)

The T ∈ T indexed permutation family EK(T, .) is indistinguishable from a random permutation family π(T, .) P[K

$

← K : A

  • EK (.,.) ⇒ 1] − P[

π

$

← Perm(T , n) : A

π(.,.) ⇒ 1] ≤ negl(λ)

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 3 / 22

slide-4
SLIDE 4

OTR Encryption (1/2)

M[1] M[2]

  • E N,1,0

K

  • E N,1,1

K

  • C[1]

C[2] . . . . . . M[2ℓ − 3] M[2ℓ − 2]

  • E N,ℓ−1,0

K

  • E N,ℓ−1,1

K

  • C[2ℓ − 3]

C[2ℓ − 2]

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 4 / 22

slide-5
SLIDE 5

OTR Encryption (2/2)

if m is even if m is odd Tag M[m − 1] M[m]

  • E N,ℓ,0

K

msb

  • pad
  • E N,ℓ,1

K

  • C[m − 1]

C[m] M[m] 0n

  • E N,ℓ,1

K

msb

  • C[m]

Σ

  • E ∗,N,ℓ,b1,b2

K

T

Σ = M[2] ⊕ . . . ⊕ M[m − 2] ⊕ Z ⊕ C[m] Σ = M[2] ⊕ . . . ⊕ M[m − 1] ⊕ M[m]

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 5 / 22

slide-6
SLIDE 6

OTR’s security

Theorem (Theorem 3 of [Min14])

If E is a tweakable PRP, OTR is CPA-secure (confidentiality) and INT-CTXT-secure (unforgeability).

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 6 / 22

slide-7
SLIDE 7

Instantiating the TBC

Remark

We are working in F2n represented as F2[X]/(P(X)) with P is a degree n primitive polynomial in F2. Use the XE construction: E N,i,j

K

(M) = EK(M + ∆N

i,j)

In [Rog04]: ∆N

i,j = X i(X + 1)jδ with δ = EK(N)

∆N

i+1,j = X · ∆N i,j

∆N

i,j+1 = (X + 1) · ∆N i,j

M

  • ∆N

i,j

EK C

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 7 / 22

slide-8
SLIDE 8

Instantiating the TBC

Remark

We are working in F2n represented as F2[X]/(P(X)) with P is a degree n primitive polynomial in F2. In OTRv1-v2 [Min14], for efficiency, an other masking scheme is used: ∆N

i,b = (X i+1 + b)δ

∆∗,N

ℓ,b1,b2 = [(X + 1)X ℓ+1 + X · b1 + b1 + b2]δ

∆N

i+1,0 = X · ∆N i,0

∆N

i,1 = ∆N i,0 + δ

M

  • ∆N

i,j

EK C

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 7 / 22

slide-9
SLIDE 9

The flaw

Lemma (Lemma 1 of [Min14])

The TBC is indistinguishable from a tweakable PRP. The proof of this lemma relies on the following claim

Claim

Let S1(δ) =

  • X i+1δ, (X i+1 + 1)δ,
  • (X i+2 + X i+1 + b1X + b2)δ
  • i=1,b1∈{0,1},b2∈{0,1}

The elements of S1(δ) are pairwise different.

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 8 / 22

slide-10
SLIDE 10

The flaw

Lemma (Lemma 1 of [Min14])

The TBC is indistinguishable from a tweakable PRP. The proof of this lemma relies on the following claim

Claim

Let S1(δ) =

  • X i+1δ, (X i+1 + 1)δ,
  • (X i+2 + X i+1 + b1X + b2)δ
  • i=1,b1∈{0,1},b2∈{0,1}

The elements of S1(δ) are pairwise different.

Our attack

This is not true in general!

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 8 / 22

slide-11
SLIDE 11

The trick

In [Rog04], bound i and j, so that i + αj are all different, with α = logX(X + 1) ⇒ {X i(X + 1)j} are pairwise distinct.

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 9 / 22

slide-12
SLIDE 12

The trick

In [Rog04], bound i and j, so that i + αj are all different, with α = logX(X + 1) ⇒ {X i(X + 1)j} are pairwise distinct. In [Min14], we cannot show that, for some q, elements are pairwise distinct in

  • X i+1, X i+1 + 1
  • X i+2 + X i+1 + b1X + b2
  • 1≤i≤q,(b1,b2)∈{0,1}2 .

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 9 / 22

slide-13
SLIDE 13

The trick

In [Rog04], bound i and j, so that i + αj are all different, with α = logX(X + 1) ⇒ {X i(X + 1)j} are pairwise distinct. In [Min14], we cannot show that, for some q, elements are pairwise distinct in

  • X i+1, X i+1 + 1
  • X i+2 + X i+1 + b1X + b2
  • 1≤i≤q,(b1,b2)∈{0,1}2 .

If P(X) = X n + X j + 1, there is a collision between X n and X j + 1 in F2n = F2[X]/(P(X)).

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 9 / 22

slide-14
SLIDE 14

The trick

In [Rog04], bound i and j, so that i + αj are all different, with α = logX(X + 1) ⇒ {X i(X + 1)j} are pairwise distinct. In [Min14], we cannot show that, for some q, elements are pairwise distinct in

  • X i+1, X i+1 + 1
  • X i+2 + X i+1 + b1X + b2
  • 1≤i≤q,(b1,b2)∈{0,1}2 .

If P(X) = X n + X j + 1, there is a collision between X n and X j + 1 in F2n = F2[X]/(P(X)). For more than half of n ≤ 10000, there is an irreducible trinomial P.

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 9 / 22

slide-15
SLIDE 15

For actual block sizes (n = 64, 128)?

If 8|n, F2n = F2[X]/(P(X)) with P with at least 5 non-zero coefficient (P(X) = X n + X j1 + X j2 + X j3 + 1). ⇒ no immediate collision in general.

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 10 / 22

slide-16
SLIDE 16

For actual block sizes (n = 64, 128)?

If 8|n, F2n = F2[X]/(P(X)) with P with at least 5 non-zero coefficient (P(X) = X n + X j1 + X j2 + X j3 + 1). ⇒ no immediate collision in general. For SW/HW efficiency, we usually choose P such that its non-zero coefficients are close to each other, preferably in the least significant bytes. P64(X) = X 64 + X 4 + X 3 + X + 1 P128(X) = X 128 + X 7 + X 2 + X + 1

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 10 / 22

slide-17
SLIDE 17

For actual block sizes (n = 64, 128)?

If 8|n, F2n = F2[X]/(P(X)) with P with at least 5 non-zero coefficient (P(X) = X n + X j1 + X j2 + X j3 + 1). ⇒ no immediate collision in general. For SW/HW efficiency, we usually choose P such that its non-zero coefficients are close to each other, preferably in the least significant bytes. P64(X) = X 64 + X 4 + X 3 + X + 1 P128(X) = X 128 + X 7 + X 2 + X + 1 For n = 64 with the usual P, we have a collision of the type X i = X j+1 + X j + X + 1 : X 64 = X 4 + X 3 + X + 1

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 10 / 22

slide-18
SLIDE 18

Consequences

Problem

There is a flaw in the proof of OTR, even for practical parameters. Does the confidentiality of OTR break? Does the unforgeability of OTR break?

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 11 / 22

slide-19
SLIDE 19

Typology of collisions

  • X i+1, X i+1 + 1
  • 1≤i≤q ∪
  • X i+2 + X i+1 + b1X + b2
  • 1≤i≤q,(b1,b2)∈{0,1}2

There are three types of collision among the tweaks’ polynomials: X i = X j + 1 (1) X i = X j+1 + X j + r(X) (2) X i+1 + X i = X j+1 + X j + r(X) (3) with r(X) ∈ {0, 1, X, X + 1}.

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 12 / 22

slide-20
SLIDE 20

Attacks

Out attack

Type 1 (X i = X j + 1) Break confidentiality and unforgeability. Type 2 (X i = X j+1 + X j + r(X)) Break confidentiality if i < j. Break unforgeability o/w. Type 3 (X i+1 + X i = X j+1 + X j + r(X)) Break unforgeability. Idea: use the collision to have relations between block cipher’s inputs and create collisions on the outputs. Only one query to the encryption oracle, with a message of max(i, j) blocks. For n = 64: 1kB message.

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 13 / 22

slide-21
SLIDE 21

n = 128 in practice

Usually, for n = 128, we choose P(X) = X 128 + X 7 + X 2 + X + 1. There is no trivial collision.

Remark

This is not true for all irreducible P of degree 128. Ex: P(X) = X 128 + X 127 + X 61 + X 60 + 1 Can we find a collision among tweaks polynomials?

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 14 / 22

slide-22
SLIDE 22

In search for lost collision

We are only interested in collisions with i and j < 264: the security proof of OTR only holds up to the birthday bound.

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 15 / 22

slide-23
SLIDE 23

In search for lost collision

We are only interested in collisions with i and j < 264: the security proof of OTR only holds up to the birthday bound. We cannot find such collisions by constructing a collision in F264 and then lifting it in F2128.

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 15 / 22

slide-24
SLIDE 24

In search for lost collision

We are only interested in collisions with i and j < 264: the security proof of OTR only holds up to the birthday bound. We cannot find such collisions by constructing a collision in F264 and then lifting it in F2128. Our only hope: exhaustive search.

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 15 / 22

slide-25
SLIDE 25

In search for lost collision

We are only interested in collisions with i and j < 264: the security proof of OTR only holds up to the birthday bound. We cannot find such collisions by constructing a collision in F264 and then lifting it in F2128. Our only hope: exhaustive search. Generate, sort and match tweak polynomials (Embarrassingly parallelizable).

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 15 / 22

slide-26
SLIDE 26

In search for lost collision

We are only interested in collisions with i and j < 264: the security proof of OTR only holds up to the birthday bound. We cannot find such collisions by constructing a collision in F264 and then lifting it in F2128. Our only hope: exhaustive search. Generate, sort and match tweak polynomials (Embarrassingly parallelizable). Problem: requires O(n2n/2) memory and O(n2n/2) time ...

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 15 / 22

slide-27
SLIDE 27

In search for lost collisions

We used time/memory tradeoffs to search for any collision with i, j < 245.

Theorem

There is no collision among the tweaks polynomials for i, j < 245 when F2128 is defined as F2[X]/(X 128 + X 7 + X 2 + X + 1). The exhaustive search took 15 CPU-years using 3TB of RAM.

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 16 / 22

slide-28
SLIDE 28

In search for lost collisions

We used time/memory tradeoffs to search for any collision with i, j < 245.

Theorem

There is no collision among the tweaks polynomials for i, j < 245 when F2128 is defined as F2[X]/(X 128 + X 7 + X 2 + X + 1). The exhaustive search took 15 CPU-years using 3TB of RAM.

Question

What about 245 ≤ i, j ?

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 16 / 22

slide-29
SLIDE 29

Probable collision before the birthday bound

If tweak polynomials behaved like random polynomials, we should have a collision just before the birthday bound. For n = 32, 64, we enumerated the irreducible polynomials over F2 of degree n and search for the lowest degree colliding polynomials.

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 17 / 22

slide-30
SLIDE 30

First collision for n = 32

4 < d ≤ 5 5 < d ≤ 6 6 < d ≤ 7 7 < d ≤ 8 11 < d ≤ 12 12 < d ≤ 13 13 < d ≤ 14 14 < d ≤ 15 15 < d ≤ 16 16 < d ≤ 17 10 2 4 8 52 140 117 18

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 18 / 22

slide-31
SLIDE 31

First collision for n = 64

5 < d ≤ 6 6 < d ≤ 26 26 < d ≤ 27 27 < d ≤ 28 28 < d ≤ 29 29 < d ≤ 30 30 < d ≤ 31 31 < d ≤ 32 32 < d ≤ 33 6 4 10 48 164 536 572 46

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 19 / 22

slide-32
SLIDE 32

Conjecture for n = 128

Conjecture

There is no collision among the tweaks polynomials for i, j < 260 when F2128 is defined as F2[X]/(X 128 + X 7 + X 2 + X + 1).

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 20 / 22

slide-33
SLIDE 33

Conclusion

OTRv2 is insecure for many block sizes. OTRv2 is secure for n = 128 when the message length is limited to 245 blocks. OTRv2 is probably secure for n = 128 almost up to the birthday bound. OTRv3 fixes the issue (using masks from [Rog04]).

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 21 / 22

slide-34
SLIDE 34

Thank you!

Paper: ia.cr/2016/234

Raphael Bost, Olivier Sanders Trick or Tweak Asiacrypt ’16 22 / 22