On Recovering Affine Encodings in White-Box Implementations Patrick - - PowerPoint PPT Presentation

on recovering affine encodings in white box
SMART_READER_LITE
LIVE PREVIEW

On Recovering Affine Encodings in White-Box Implementations Patrick - - PowerPoint PPT Presentation

On Recovering Affine Encodings in White-Box Implementations Patrick Derbez 1 , Pierre-Alain Fouque 1 , Baptiste Lambin 1 , Brice Minaud 2 1 Univ Rennes, CNRS, IRISA 2 Royal Holloway University of London Baptiste Lambin On Recovering Affine


slide-1
SLIDE 1

On Recovering Affine Encodings in White-Box Implementations

Patrick Derbez 1, Pierre-Alain Fouque1, Baptiste Lambin1, Brice Minaud2

1Univ Rennes, CNRS, IRISA 2Royal Holloway University of London Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 1 / 21

slide-2
SLIDE 2

1

Introduction

2

Generic algorithm

3

Dedicated attack on Baek et al.’s scheme

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 2 / 21

slide-3
SLIDE 3

Introduction

1

Introduction

2

Generic algorithm

3

Dedicated attack on Baek et al.’s scheme

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 3 / 21

slide-4
SLIDE 4

Introduction

Black box vs. White box

in

AESK

  • ut

Black box model

in

AESK

  • ut

Gray box model

leakage

in

key = 0x1337. . . key schedule(key)

  • ut = in

for i in 0. . .10 round i(out,key) return out

  • ut

White box model

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 4 / 21

slide-5
SLIDE 5

Introduction

White box implementation

Attacker:

  • extracting key information from

the implementation

  • computing

decryption scheme from encryption scheme Designer:

  • provide sound and secure imple-

mentation Main application:

  • Digital Rights Management
  • Fast (post-quantum

) public-key encryption scheme

in

key = 0x1337. . . key schedule(key)

  • ut = in

for i in 0. . .10 round i(out,key) return out

  • ut

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 5 / 21

slide-6
SLIDE 6

Introduction

Two main design strategies

Table lookup

First proposal by Chow et al. in 2002: broken Xiao and Lai in 2009: broken Karroumi et al. in 2011: broken Baek et al. in 2016: our target WhiteBlock from Fouque et al.: secure (but weird model)

ASASA-like designs

SASAS construction: broken in 2001 by Biryukov and Shamir ASASA proposals (Biryukov et al., 2014): broken Recent proposals at ToSC’17 by Biryukov et al. to use more layers, leading to SA. . . SAS

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 6 / 21

slide-7
SLIDE 7

Introduction

CEJO Framework

Derived from Chow et al. first white-box candidate constructions. Block cipher decomposed into R round functions. Round functions obfuscated using encodings. Obfuscated round functions implemented and evaluated using several tables (of reasonable size) · · · ◦ f (r+1)−1 ◦ E (r) ◦ f (r)

  • table
  • f (r)−1 ◦ E (r−1) ◦ f (r−1)
  • table
  • . . .

Increase security with external encodings The affine and non-linear part of all f (r) is often structured for efficient implementations !

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 7 / 21

slide-8
SLIDE 8

Introduction

Affine Equivalence Algorithm

In 2003, Biryukov, De Canni` ere, Braeken and Preneel proposed an algorithm to solve the following problem: Given two bijections S1 and S2 on n bits, find affine mappings A and B such that S2 = B ◦ S1 ◦ A, if they exist. Ascertain whether such mappings exist Enumerate all solutions Time complexity in O

  • n322n

, O

  • n32n

if A, B linears Improved by Dinur at Eurocrypt’18 to O

  • n32n

in the affine case, but with a few limitations

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 8 / 21

slide-9
SLIDE 9

Generic algorithm

1

Introduction

2

Generic algorithm

3

Dedicated attack on Baek et al.’s scheme

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 9 / 21

slide-10
SLIDE 10

Generic algorithm

Problem to solve for the attacker

Given F

known

=

affine

B

secret

  • non-linear

  S1 . . . Sk  

known

  • affine

A

secret

without knowing F −1 Find an equivalent representation ˜ F of F such that ˜ F −1 is easily computable (leads to a decryption function). Find which A and B were used (leads to a key recovery).

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 10 / 21

slide-11
SLIDE 11

Generic algorithm

Overview of the algorithm

2-step algorithm:

1 Isolate the input and output subspaces of each Sbox

(essentially the technique from Biryukov and Shamir in their SASAS cryptanalysis)

2 Apply the generic affine equivalence algorithm to each Sbox separately Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 11 / 21

slide-12
SLIDE 12

Generic algorithm

Finding input subspace of each S-box

Sk S3 S2 S1

B A ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆

m n n dim n − m dim n − m

* * * * * *

V1

U1

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 12 / 21

slide-13
SLIDE 13

Generic algorithm

Building V1

Testing if ∆ ∈ V1 : X = {xi ∈ Fn

2, xi random} ”big enough”

U = {F(xi) ⊕ F(xi ⊕ ∆), xi ∈ X} (output difference space) If dim(Span(U)) = n − m, then ∆ ∈ V1 w.h.p. Build a basis of V1 by doing the same test on independent vectors, and by testing if the resulting output difference space is the same. Do this k times to build all V1, . . . , Vk.

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 13 / 21

slide-14
SLIDE 14

Generic algorithm

Finding input subspace of each S-box

Sk S3 S2 S1

B A ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆ ⋆

dim m dim m

* *

Vi = I1

  • i=1

O1

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 14 / 21

slide-15
SLIDE 15

Generic algorithm

Recovering affine layers

B ◦   S1 . . . Sk   ◦ A Ii Oi dim m dim m Fm

2

Fm

2

Pi Qi Apply the Affine Equivalence Algorithm on each Fi = Qi ◦ F ◦ Pi Lead to 2 affine mappings Ai, Bi such that Fi = Bi ◦ Si ◦ Ai Build A′ from all Ai’s and Pi’s, B′ from all Bi’s and Qi’s such that B′ ◦ (S1, . . . , Sk) ◦ A′ = F We can now inverse F easily as F −1 = A

′−1 ◦

  • S−1

1 , . . . , S−1 k

  • B

′−1 ! Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 15 / 21

slide-16
SLIDE 16

Generic algorithm

Complexities

Complexity of solving the problem: Biryukov et al.: O(n322n), Dinur : O(n32n) Baek et al.: O

  • min(nm+422m/m, n log(n)2n/2)
  • Our (best case): O
  • 2mn3 + n4

m + 2mm2n

  • Our (different Sboxes): O
  • 2mn3 + n4

m + 2mmn2

Our (worst case, e.g. AES S-box): O

  • 2mn3 + n4

m + 22mm2n

  • Applications:

128-bit block cipher, AES S-box (8 bits) : ∼ 230 operations Baek et al. proposal (256-bit block, AES S-box) : ∼ 235 operations

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 16 / 21

slide-17
SLIDE 17

Dedicated attack on Baek et al.’s scheme

1

Introduction

2

Generic algorithm

3

Dedicated attack on Baek et al.’s scheme

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 17 / 21

slide-18
SLIDE 18

Dedicated attack on Baek et al.’s scheme

The Baek, Cheon and Hong proposal

Round function of AES : AES(r) = MC ◦ SR ◦ SB ◦ ARK A(r)

256-bit

AES(r) AES(r)

  • A(r+1)−1

256-bit

A(r)

256-bit

K (r) K (r)

S . . . S S . . . S

  • A(r+1)−1

MC ◦ SR MC ◦ SR M(r)

table

256-bit

Security claim : 110 bits

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 18 / 21

slide-19
SLIDE 19

Dedicated attack on Baek et al.’s scheme

Overview of the attack

From encoded round functions F ≃ B ◦ S ◦ A with A ≃ ∗ ∗

∗ ∗

...

∗ ∗

  • 1 Reduce the problem to block diagonal encodings :

⇒ F = B ◦ S ◦ A′ with A′ block diagonal.

2 Compute candidates for each block: 1

Using a projection, P ◦ B ◦ S ◦ A′

i is affine equivalent to S.

2

Use the affine equivalence algorithm from [BCBP03] to get some candidates for A′

i.

3 Identify the correct blocks :

Use a MITM technique to filter the wrong candidates See our paper for more details !

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 19 / 21

slide-20
SLIDE 20

Dedicated attack on Baek et al.’s scheme

Implementation (Intel Core i7-6600U CPU @ 2.60GHz): ∼ 2000 C++ code lines Main cost : 64 calls to the affine equivalence algorithm (∼ 64 × 225) Generic algorithm complexity : ∼ 235 (Decryption function) Dedicated attack complexity : ∼ 231 (Key-recovery) Total time : ∼ 12s, negligible memory Implementation available at http://wbcheon.gforge.inria.fr/. Fixing the construction for 60-bit security would require n = 213 parallel AES, leading to an implementation of size ∼ 212TB

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 20 / 21

slide-21
SLIDE 21

Dedicated attack on Baek et al.’s scheme

Conclusion

Given F = B ◦ (S1, . . . , Sk) ◦ A, with A and B secret, we provide a generic algorithm to efficiently compute F −1. This efficiently solve a critical step when attacking table-based white box implementations. Best case complexity : O

  • 2mn3 + n4

m + 2mm2n

  • In practice with AES parameters : ∼ 230

Scale linearly if S-boxes are different We mounted a dedicated attack on Baek et al.’s scheme, leading to a key recovery in about 231 operations.

Baptiste Lambin On Recovering Affine Encodings in White-Box Implementations 21 / 21