Generic Attacks against MAC algorithms G. Leurent (Inria) Generic - - PowerPoint PPT Presentation

generic attacks against mac algorithms
SMART_READER_LITE
LIVE PREVIEW

Generic Attacks against MAC algorithms G. Leurent (Inria) Generic - - PowerPoint PPT Presentation

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion Generic Attacks against MAC algorithms G. Leurent (Inria) Generic Attacks against MAC algorithms ASK 2015 1 / 59 Gatan Leurent Inria Rocquencourt,


slide-1
SLIDE 1

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Generic Attacks against MAC algorithms

Gaëtan Leurent

Inria Rocquencourt, France

ASK 2015

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 1 / 59

slide-2
SLIDE 2

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Confjdentiality and authenticity

▶ Cryptography has two main objectives:

Confjdentiality keeping the message secret Authenticity making sure the message is authentic

▶ Authenticity is often more important than confidentiality

▶ Email signature ▶ Software update ▶ Credit cards ▶ Sensor networks ▶ Remote control (e.g. garage door, car) ▶ Remote access (e.g. password authentication)

▶ Authenticity achieved with signatures (asymmetric),

  • r MACs (symmetric)
  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 2 / 59

slide-3
SLIDE 3

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Message Authentication Codes

Alice Bob M, t

▶ Alice sends a message to Bob ▶ Bob wants to authenticate the message. ▶ Alice uses a key k to compute a tag:

t = MACk(M)

▶ Bob verifies the tag with the same key k:

t

?

= MACk(M)

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 3 / 59

slide-4
SLIDE 4

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Security notions

▶ Key-recovery: given access to a MAC oracle, extract the key ▶ Forgery: given access to a MAC oracle, forge a valid pair

▶ For a message chosen by the adversary: existential forgery ▶ For a challenge given to the adversary: universal forgery

▶ Distinguishing games:

▶ Distinguish MACH

k from a PRF: distinguishing-R

e.g. distinguish HMAC from a PRF

▶ Distinguish MACH

k from MACPRF k

: distinguishing-H e.g. distinguish HMAC-SHA1 from HMAC-PRF

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 4 / 59

slide-5
SLIDE 5

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

CBC-MAC

P0 E P1 E P2 E E′ T

▶ One of the first MAC

[NIST, ANSI, ISO, ’85?]

▶ Designed by practitioners, to be used with DES ▶ Based on CBC encryption mode ▶ Security proof

[Bellare, Kilian & Rogaway ’94]

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 5 / 59

slide-6
SLIDE 6

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Security of modes of operations

▶ Initially, security of CBC-MAC-DES was an assumption ▶ To reduce the number of assumptions,

study the block cipher and the mode independently

1 Security proof for the mode

▶ Assume that the block cipher is good, prove that the MAC is good ▶ Lower bound on the security of the mode

2 Cryptanalysis of the block cipher

▶ Try to show non-random behavior

3 Generic attacks for the mode

▶ Attack that work for any choice of the block cipher ▶ Upper bound on the security of the mode

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 6 / 59

slide-7
SLIDE 7

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Security of modes of operations

▶ Initially, security of CBC-MAC-DES was an assumption ▶ To reduce the number of assumptions,

study the block cipher and the mode independently

1 Security proof for the mode

▶ Assume that the block cipher is good, prove that the MAC is good ▶ Lower bound on the security of the mode

2 Cryptanalysis of the block cipher

▶ Try to show non-random behavior

3 Generic attacks for the mode

▶ Attack that work for any choice of the block cipher ▶ Upper bound on the security of the mode

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 6 / 59

slide-8
SLIDE 8

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Security of modes of operations

▶ Initially, security of CBC-MAC-DES was an assumption ▶ To reduce the number of assumptions,

study the block cipher and the mode independently

1 Security proof for the mode

▶ Assume that the block cipher is good, prove that the MAC is good ▶ Lower bound on the security of the mode

2 Cryptanalysis of the block cipher

▶ Try to show non-random behavior

3 Generic attacks for the mode

▶ Attack that work for any choice of the block cipher ▶ Upper bound on the security of the mode

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 6 / 59

slide-9
SLIDE 9

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Security of modes of operations

▶ Initially, security of CBC-MAC-DES was an assumption ▶ To reduce the number of assumptions,

study the block cipher and the mode independently

1 Security proof for the mode

▶ Assume that the block cipher is good, prove that the MAC is good ▶ Lower bound on the security of the mode

2 Cryptanalysis of the block cipher

▶ Try to show non-random behavior

3 Generic attacks for the mode

▶ Attack that work for any choice of the block cipher ▶ Upper bound on the security of the mode

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 6 / 59

slide-10
SLIDE 10

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Generic Attack against Iterated Deterministic MACs

Ik x y MAC

1 Find internal collisions

[Preneel & van Oorschot ’95]

▶ Query 2n/2 random short messages ▶ 1 internal collision expected, detected in the output

2 Query t = MAC(x ‖ m) 3 􏿵y ‖ m, t􏿸 is a forgery

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 7 / 59

slide-11
SLIDE 11

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Generic Attack against Iterated Deterministic MACs

Ik x y m MAC

1 Find internal collisions

[Preneel & van Oorschot ’95]

▶ Query 2n/2 random short messages ▶ 1 internal collision expected, detected in the output

2 Query t = MAC(x ‖ m) 3 􏿵y ‖ m, t􏿸 is a forgery

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 7 / 59

slide-12
SLIDE 12

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Generic Attack against Iterated Deterministic MACs

Ik x y m MAC

1 Find internal collisions

[Preneel & van Oorschot ’95]

▶ Query 2n/2 random short messages ▶ 1 internal collision expected, detected in the output

2 Query t = MAC(x ‖ m) 3 􏿵y ‖ m, t􏿸 is a forgery

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 7 / 59

slide-13
SLIDE 13

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Generic Attack against Iterated Deterministic MACs

Ik x y m MAC

1 Find internal collisions

[Preneel & van Oorschot ’95]

▶ Query 2n/2 random short messages ▶ 1 internal collision expected, detected in the output

2 Query t = MAC(x ‖ m) 3 􏿵y ‖ m, t􏿸 is a forgery

Problem

▶ CBC-MAC with DES is unsafe after 232 queries

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 7 / 59

slide-14
SLIDE 14

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Security Proofs

What’s a security proof?

▶ Advprf CBC-F(q, t) ≤ Advprp F (mq, t + O(mqn)) + q2m2 2n−1 ▶ Bound on the success probability of an adversary against the MAC

q number of queries t time m max query length

▶ “If DES is a secure PRF, then CBC-MAC-DES is a secure PRF”

Limitations

▶ Birthday-bound security

▶ Bound meaningless when mq ≈ 2n/2

▶ No information on security degradation after the birthday bound

▶ Usually assumed that key-recovery attacks require more...

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 8 / 59

slide-15
SLIDE 15

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Remaining of this talk

MAC security is well understood

▶ Good MAC constructions have birthday bound security proof ▶ We have a generic existential forgery attack with birthday complexity

Or is it?

▶ Difgerent MACs have difgerent security loss after the birthday bound! ▶ We need to study generic attack to understand the security of modes

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 9 / 59

slide-16
SLIDE 16

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

PMAC

E E E

0L 1L

1 2L

A1 A2 A3 E E E

0L 1L

A1 A2 A′

3

A′

3

pad

▶ PMAC: parallelisable block-cipher based MAC

[Black & Rogaway ’02]

▶ Uses secret ofgsets to the block cipher input: L = Ek(0)

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 10 / 59

slide-17
SLIDE 17

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

PMAC

E E E

0L 1L

1 2L

A1 A2 A3 E E E

0L 1L

A1 A2 A′

3

A′

3

pad

▶ Collision attack: two sets of messages

[Lee & al ’06]

▶ Ax = [x], |x| = 128

▶ Full block ▶ MAC(Ax) = E([x] ⊕ 1

2L)

▶ By = [y], |y| < 128

▶ Partial block ▶ MAC(By) = E(pad([y]))

▶ Collision (Ax, By)?

▶ The MAC collide ifg

[x] ⊕ 1

2L = pad([y])

▶ Deduce L ▶ Universal forgery attack

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 10 / 59

slide-18
SLIDE 18

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

AEZ

E E E E

9J 10J 11J

A1 A2 A3 E E E E

9J 10J 8J

A1 A2 A3 A3 pad

▶ AEZ uses a variant of PMAC

[Hoang, Krovetz & Rogaway ’15]

▶ A collision gives J: [x] ⊕ 9J = pad([y]) ⊕ 8J ▶ Key derivation (AEZ v2) J = E0(k) ▶ Collisions reveal the master key!

[FLS, AC’15]

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 11 / 59

slide-19
SLIDE 19

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Security of block cipher based MACs

Proofs CBC-MAC, PMAC, and AEZ have security proofs up to the birthday bound Attacks Efgect of collision attacks with 2n/2 queries

▶ CBC-MAC: almost universal forgeries

[Jia & al ’09]

▶ PMAC: universal forgeries ▶ AEZ: key recovery

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 12 / 59

slide-20
SLIDE 20

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Outline

Introduction MACs Security Proofs Hash-based MACs Hash-based MACs State recovery attacks Using multi-collisions Using the cycle structure Short messages attacks using chains Universal forgery attacks Using cycles Using chains Key-recovery attacks HMAC-GOST

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 13 / 59

slide-21
SLIDE 21

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Hash-based MACs

h

m0 x0 h

m1 x1 h

m2 x2 x3 MACk(M)

ℓ n

|M| Ik gk

▶ ℓ-bit chaining value ▶ n-bit output ▶ k-bit key

we focus on ℓ = n = k

▶ Key-dependant initial value Ik ▶ Unkeyed compression function h ▶ Key-dependant finalization, with message length gk

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 14 / 59

slide-22
SLIDE 22

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

HMAC

▶ HMAC has been designed by Bellare, Canetti, and Krawczyk in 1996 ▶ Standardized by ANSI, IETF, ISO, NIST. ▶ Used in many applications:

▶ To provide authentication: ▶ SSL, IPSEC, ... ▶ To provide identification: ▶ Challenge-response protocols ▶ CRAM-MD5 authentication in SASL, POP3, IMAP, SMTP, ... ▶ For key-derivation: ▶ HMAC as a PRF in IPsec ▶ HMAC-based PRF in TLS

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 15 / 59

slide-23
SLIDE 23

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Security of hash-based MACS

▶ Security proofs up to the birthday bound ▶ Generic attacks based on collisions

▶ Proof is tight for some security notions ▶ Existential forgery ▶ Distinguishing-R

▶ What is the remaining security above the birthday bound?

▶ Generic distinguishing-H attack? ▶ Generic state-recovery attack? ▶ Generic universal forgery attack? ▶ Generic key-recovery attack?

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 16 / 59

slide-24
SLIDE 24

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Outline

Introduction MACs Security Proofs Hash-based MACs Hash-based MACs State recovery attacks Using multi-collisions Using the cycle structure Short messages attacks using chains Universal forgery attacks Using cycles Using chains Key-recovery attacks HMAC-GOST

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 17 / 59

slide-25
SLIDE 25

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Bibliography

  • Y. Naito, Y. Sasaki, L. Wang, K. Yasuda

Generic State-Recovery and Forgery Attacks on ChopMD-MAC and

  • n NMAC/HMAC

IWSEC 2013

  • G. Leurent, T. Peyrin, L. Wang

New Generic Attacks against Hash-Based MACs ASIACRYPT 2013

  • I. Dinur, G. Leurent

Improved Generic Attacks against Hash-Based MACs and HAIFA CRYPTO 2014

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 18 / 59

slide-26
SLIDE 26

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Multi-collision based attack

[Naito, Sasaki, Wang & Yasuda ’13]

h

m0 x0 h

m1 x1 h

x2 x3 MACK(M)

ℓ n

|M| IK gK

▶ Using a fixed message block, we apply a fixed function ▶ Starting point and ending point unknown because of the key

Can we detect properties of the function h0 ∶ x ↦ h(x, 0)?

▶ Use bias in the output of the compression function

▶ Some outputs are more likely than others ▶ With 2ℓ−𝜁 work, find a value x∗ with ℓ preimages (offmine)

▶ How to detect when this state is reached?

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 19 / 59

slide-27
SLIDE 27

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Multi-collision based attack

[Naito, Sasaki, Wang & Yasuda ’13]

h

m0 x0 h

m1 x1 h

x2 x3 MACK(M)

ℓ n

|M| IK gK

▶ Using a fixed message block, we apply a fixed function ▶ Starting point and ending point unknown because of the key

Can we detect properties of the function h0 ∶ x ↦ h(x, 0)?

▶ Use bias in the output of the compression function

▶ Some outputs are more likely than others ▶ With 2ℓ−𝜁 work, find a value x∗ with ℓ preimages (offmine)

▶ How to detect when this state is reached?

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 19 / 59

slide-28
SLIDE 28

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Building fjlters

Filters to compare online and online states Test whether the state reached after processing M is equal to x

▶ Collisions are preserved by the finalization

(for same-length messages)

1 Find a collision:

h(x, c) = h(x, c′) x

h1 h1

c c′ Offmine Structure

2 MAC(M ‖ c) ?

= MAC(M ‖ c′) Ik x?

h0

M

h1 h1

c c′

gk

Online Structure

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 20 / 59

slide-29
SLIDE 29

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Building fjlters

Filters to compare online and online states Test whether the state reached after processing M is equal to x

▶ Collisions are preserved by the finalization

(for same-length messages)

1 Find a collision:

h(x, c) = h(x, c′) x

h1 h1

c c′ Offmine Structure

2 MAC(M ‖ c) ?

= MAC(M ‖ c′) Ik x?

h0

M

h1 h1

c c′

gk

Online Structure

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 20 / 59

slide-30
SLIDE 30

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Building fjlters

Filters to compare online and online states Test whether the state reached after processing M is equal to x

▶ Collisions are preserved by the finalization

(for same-length messages)

1 Find a collision:

h(x, c) = h(x, c′) x

h1 h1

c c′ Offmine Structure

2 MAC(M ‖ c) ?

= MAC(M ‖ c′) Ik x?

h0

M

h1 h1

c c′

gk

Online Structure

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 20 / 59

slide-31
SLIDE 31

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

First state-recovery attack

[Naito, Sasaki, Wang & Yasuda ’13]

h

m0 x0 h

m1 x1 h

m2 x2 x3 MACk(M)

l n

|M| Ik gk

1 Fix a message block m1 = [0].

With 2ℓ−𝜁 work, find a value x∗ with ℓ preimages

2 Find a collision h(x∗, c) = h(x∗, c′) 3 For random m0, compare MAC(m0 ‖ [0] ‖ c) and MAC(m0 ‖ [0] ‖ c′)

If they are equal, x2 = x∗

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 21 / 59

slide-32
SLIDE 32

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

First state-recovery attack

[Naito, Sasaki, Wang & Yasuda ’13]

h

m0 x0 h

x1 h

m2 x2 x3 MACk(M)

l n

|M| Ik gk

1 Fix a message block m1 = [0].

With 2ℓ−𝜁 work, find a value x∗ with ℓ preimages

2 Find a collision h(x∗, c) = h(x∗, c′) 3 For random m0, compare MAC(m0 ‖ [0] ‖ c) and MAC(m0 ‖ [0] ‖ c′)

If they are equal, x2 = x∗

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 21 / 59

slide-33
SLIDE 33

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

First state-recovery attack

[Naito, Sasaki, Wang & Yasuda ’13]

h

m0 x0 h

x1 h

m2 x2 x3 MACk(M)

l n

|M| Ik gk

1 Fix a message block m1 = [0].

With 2ℓ−𝜁 work, find a value x∗ with ℓ preimages

2 Find a collision h(x∗, c) = h(x∗, c′) 3 For random m0, compare MAC(m0 ‖ [0] ‖ c) and MAC(m0 ‖ [0] ‖ c′)

If they are equal, x2 = x∗

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 21 / 59

slide-34
SLIDE 34

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

First state-recovery attack

[Naito, Sasaki, Wang & Yasuda ’13]

h

m0 x0 h

x1 h

c/c′ x2 x3 MACk(M)

l n

|M| Ik gk

1 Fix a message block m1 = [0].

With 2ℓ−𝜁 work, find a value x∗ with ℓ preimages

2 Find a collision h(x∗, c) = h(x∗, c′) 3 For random m0, compare MAC(m0 ‖ [0] ‖ c) and MAC(m0 ‖ [0] ‖ c′)

If they are equal, x2 = x∗

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 21 / 59

slide-35
SLIDE 35

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

First state-recovery attack

[Naito, Sasaki, Wang & Yasuda ’13]

h

m0 x0 h

x1 h

c/c′ x2 x3 MACk(M)

l n

|M| Ik gk

1 Fix a message block m1 = [0].

With 2ℓ−𝜁 work, find a value x∗ with ℓ preimages

2 Find a collision h(x∗, c) = h(x∗, c′) 3 For random m0, compare MAC(m0 ‖ [0] ‖ c) and MAC(m0 ‖ [0] ‖ c′)

If they are equal, x2 = x∗

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 21 / 59

slide-36
SLIDE 36

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Structure of state-recovery attacks

1 Identify special states easier to reach 2 Build filter for special states 3 Build messages to reach special states

Test if special state reached using filters

▶ In this attack, steps 1 & 2 offmine, step 3 online.

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 22 / 59

slide-37
SLIDE 37

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Cycle based attack

h

x0 h

x1 h

x2 x3 MACK(M)

ℓ n

|M| IK gK

▶ Using a fixed message block, we iterate a fixed function ▶ Starting point and ending point unknown because of the key

Can we detect properties of the function h0 ∶ x ↦ h(x, 0)?

▶ Study the cycle structure of random mappings ▶ Used to attack HMAC in related-key setting

[Peyrin, Sasaki & Wang, Asiacrypt 12]

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 23 / 59

slide-38
SLIDE 38

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Cycle based attack

h

x0 h

x1 h

x2 x3 MACK(M)

ℓ n

|M| IK gK

▶ Using a fixed message block, we iterate a fixed function ▶ Starting point and ending point unknown because of the key

Can we detect properties of the function h0 ∶ x ↦ h(x, 0)?

▶ Study the cycle structure of random mappings ▶ Used to attack HMAC in related-key setting

[Peyrin, Sasaki & Wang, Asiacrypt 12]

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 23 / 59

slide-39
SLIDE 39

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Random Mappings

x0 x1 x2 x3 x4 x5 x6 x7

▶ Functional graph of a random mapping

x → f(x)

▶ Iterate f: xi = f(xi−1) ▶ Collision after ≈ 2ℓ/2 iterations

▶ Cycles

▶ Trees rooted in the cycle ▶ Several components

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 24 / 59

slide-40
SLIDE 40

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Random Mappings

▶ Functional graph of a random mapping

x → f(x)

▶ Iterate f: xi = f(xi−1) ▶ Collision after ≈ 2ℓ/2 iterations

▶ Cycles

▶ Trees rooted in the cycle ▶ Several components

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 24 / 59

slide-41
SLIDE 41

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Random Mappings

▶ Functional graph of a random mapping

x → f(x)

▶ Iterate f: xi = f(xi−1) ▶ Collision after ≈ 2ℓ/2 iterations

▶ Cycles

▶ Trees rooted in the cycle ▶ Several components

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 24 / 59

slide-42
SLIDE 42

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Cycle structure

Expected properties of a random mapping over N points:

▶ # Components: 1 2 log N ▶ # Cyclic nodes: √𝜌N/2 ▶ Tail length: √𝜌N/8 ▶ Rho length: √𝜌N/2 ▶ Largest tree: 0.48N ▶ Largest component: 0.76N

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 25 / 59

slide-43
SLIDE 43

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Cycle structure

Expected properties of a random mapping over N points:

▶ # Components: 1 2 log N ▶ # Cyclic nodes: √𝜌N/2 ▶ Tail length: √𝜌N/8 ▶ Rho length: √𝜌N/2 ▶ Largest tree: 0.48N ▶ Largest component: 0.76N

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 25 / 59

slide-44
SLIDE 44

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Using the cycle length

1 Offmine: find the cycle length L of the main component of h0 2 Online: query t = MAC(r ‖ [0]2ℓ/2) and t′ = MAC(r ‖ [0]2ℓ/2+L)

Success if

▶ The starting point is in the main component

p = 0.76

▶ The cycle is reached with less than 2ℓ/2 iterations

p ≥ 0.5 Randomize starting point

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 26 / 59

slide-45
SLIDE 45

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Cycle structure

Expected properties of a random mapping over N points:

▶ # Components: 1 2 log N ▶ # Cyclic nodes: √𝜌N/2 ▶ Tail length: √𝜌N/8 ▶ Rho length: √𝜌N/2 ▶ Largest tree: 0.48N ▶ Largest component: 0.76N

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 26 / 59

slide-46
SLIDE 46

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Using the cycle length

1 Offmine: find the cycle length L of the main component of h0 2 Online: query t = MAC(r ‖ [0]2ℓ/2) and t′ = MAC(r ‖ [0]2ℓ/2+L)

Success if

▶ The starting point is in the main component

p = 0.76

▶ The cycle is reached with less than 2ℓ/2 iterations

p ≥ 0.5 Randomize starting point

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 26 / 59

slide-47
SLIDE 47

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Dealing with the message length

Problem: most MACs use the message length. h

x0 h

x1 h

x2 x3 MACk(M)

ℓ n

|M| Ik gk

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 27 / 59

slide-48
SLIDE 48

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Dealing with the message length

Solution: reach the cycle twice M = r ‖ [0]2ℓ/2 ‖ [1] ‖ [0]2ℓ/2

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 27 / 59

slide-49
SLIDE 49

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Dealing with the message length

Solution: reach the cycle twice M1 = r ‖ [0]2ℓ/2+L ‖ [1] ‖ [0]2ℓ/2 M2 = r ‖ [0]2ℓ/2 ‖ [1] ‖ [0]2ℓ/2+L

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 27 / 59

slide-50
SLIDE 50

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Distinguishing-H attack

1 Offmine: find the cycle length L of the main component of h0 2 Online: query

t = MAC(r ‖ [0]2ℓ/2 ‖ [1] ‖ [0]2ℓ/2+L) t′ = MAC(r ‖ [0]2ℓ/2+L ‖ [1] ‖ [0]2ℓ/2 )

3 If t = t′, then h is the compression function in the oracle

Analysis

▶ Complexity: 2ℓ/2 compression function calls ▶ Success probability: p ≃ 0.14

▶ Both starting point are in the main component

p = 0.762

▶ Both cycles are reached with less than 2ℓ/2 iterations

p ≥ 0.52

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 28 / 59

slide-51
SLIDE 51

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

State recovery attack

▶ Consider the first cyclic point ▶ With high pr., root of the giant tree 1 Offmine: find cycle length L,

and root of giant tree 𝛽

2 Online: Binary search

for smallest z with collisions: MAC(r ‖ [0]z ‖ [x] ‖ [0]2ℓ/2+L), MAC(r ‖ [0]z+L ‖ [x] ‖ [0]2ℓ/2 )

3 State after r ‖ [0]z is 𝛽 (with high pr.)

Analysis

▶ Complexity 2ℓ/2 × ℓ × log(ℓ)

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 29 / 59

slide-52
SLIDE 52

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Cycle structure

Expected properties of a random mapping over N points:

▶ # Components: 1 2 log N ▶ # Cyclic nodes: √𝜌N/2 ▶ Tail length: √𝜌N/8 ▶ Rho length: √𝜌N/2 ▶ Largest tree: 0.48N ▶ Largest component: 0.76N

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 29 / 59

slide-53
SLIDE 53

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

State recovery attack

▶ Consider the first cyclic point ▶ With high pr., root of the giant tree 1 Offmine: find cycle length L,

and root of giant tree 𝛽

2 Online: Binary search

for smallest z with collisions: MAC(r ‖ [0]z ‖ [x] ‖ [0]2ℓ/2+L), MAC(r ‖ [0]z+L ‖ [x] ‖ [0]2ℓ/2 )

3 State after r ‖ [0]z is 𝛽 (with high pr.)

Analysis

▶ Complexity 2ℓ/2 × ℓ × log(ℓ)

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 29 / 59

slide-54
SLIDE 54

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Short message attacks

Limitations of cycle-based attacks

▶ Messages of length 2ℓ/2 are not very practical...

▶ SHA-1 and HAVAL limit the message length to 264 bits

▶ Cycle detection impossible with messages shorter than L ≈ 2ℓ/2

▶ Shorter cycles have a small component

▶ Not applicable to HAIFA hash functions

Compare with collision fjnding algorithms

▶ Pollard’s rho algorithm use cycle detection ▶ Parallel collision search for van Oorschot and Wiener

uses shorter chains

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 30 / 59

slide-55
SLIDE 55

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Chain-based attack

h0

A x0 h1

B x1 h2

C x2 x3 MACK(M)

ℓ n

|M| IK gK

▶ Using a fixed message, we iterate a fixed sequence of function ▶ Starting point and ending point unknown because of the key

Can we detect properties of the iteration of fjxed functions?

▶ Study the entropy loss

skip details

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 31 / 59

slide-56
SLIDE 56

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Chain-based attack

h0

A x0 h1

B x1 h2

C x2 x3 MACK(M)

ℓ n

|M| IK gK

▶ Using a fixed message, we iterate a fixed sequence of function ▶ Starting point and ending point unknown because of the key

Can we detect properties of the iteration of fjxed functions?

▶ Study the entropy loss

skip details

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 31 / 59

slide-57
SLIDE 57

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Collision fjnding with short chains

x0 y0 x1 y1 x2 y2 x3 y3 x4

1 Compute chains x y

Stop when y distinguished

2 If y ∈ {yi}, collision found

Theorem (Entropy loss) Let f1, f2, … , f2s be a fixed sequence of random functions; the image of g2s ≜ f2s ∘ … ∘ f2 ∘ f1 contains about 2ℓ−s points.

▶ Use these state as special states (instead of cycle entry point)

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 32 / 59

slide-58
SLIDE 58

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

State-recovery attacks

▶ Send messages to the oracle

Ik MAC(M0)

h0 h1 h2 gk

Ik MAC(M1)

h0 h1 h2 gk

Ik MAC(M2)

h0 h1 h2 gk

Ik MAC(M3)

h0 h1 h2 gk

Ik MAC(M4)

h0 h1 h2 gk

Mi Online Structure

▶ Do some computations offmine

with the compression function $

h0 h1 h2

$

h0 h1 h2

$

h0 h1 h2

$

h0 h1 h2

$

h0 h1 h2

Mi Offmine Structure

▶ Match the sets of points?

▶ How to test equality? Online chaining values unknown ▶ How many equality test do we need?

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 33 / 59

slide-59
SLIDE 59

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

First attempt

▶ Chains of length 2s, with a fixed message C

Ik

h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk

[i] C

S=2s 2u

Online Structure $

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

C

S=2s 2t

Offmine Structure

1 Evaluate 2t chains offmine

s + t + u = ℓ Build filters for endpoints

2 Query 2u message Mi = [i] ‖ C

Test endpoints with filters Cplx: 2s+t+u

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 34 / 59

slide-60
SLIDE 60

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Building fjlters

Filters to compare online and online states Test whether the state reached after processing M is equal to x

▶ Collisions are preserved by the finalization

(for same-length messages)

2 MAC(M||p) ?

= MAC(M||p′) Ik x?

h0

M

h1 h1

p p′

gk

Online Structure

1 Find a collision:

h(x, p) = h(x, p′) x

h1 h1

p p′ Offmine Structure

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 35 / 59

slide-61
SLIDE 61

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Building fjlters

Filters to compare online and online states Test whether the state reached after processing M is equal to x

▶ Collisions are preserved by the finalization

(for same-length messages)

2 MAC(M||p) ?

= MAC(M||p′) Ik x?

h0

M

h1 h1

p p′

gk

Online Structure

1 Find a collision:

h(x, p) = h(x, p′) x

h1 h1

p p′ Offmine Structure

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 35 / 59

slide-62
SLIDE 62

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Building fjlters

Filters to compare online and online states Test whether the state reached after processing M is equal to x

▶ Collisions are preserved by the finalization

(for same-length messages)

2 MAC(M||p) ?

= MAC(M||p′) Ik x?

h0

M

h1 h1

p p′

gk

Online Structure

1 Find a collision:

h(x, p) = h(x, p′) x

h1 h1

p p′ Offmine Structure

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 35 / 59

slide-63
SLIDE 63

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

First attempt

▶ Chains of length 2s, with a fixed message C

Ik

h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk

[i] C

S=2s 2u

Online Structure $

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

C

S=2s 2t

Offmine Structure

1 Evaluate 2t chains offmine

s + t + u = ℓ Build filters for endpoints

2 Query 2u message Mi = [i] ‖ C

Test endpoints with filters Cplx: 2s+t+u

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 36 / 59

slide-64
SLIDE 64

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Online fjlters

▶ Using the filters is too expensive. ▶ If we build filters online, using them is cheap. 1 Find p, p′ s.t.

MAC(M||p) = MAC(M||p′) Ik x?

h0

M

h1 h1

p p′

gk

Online Structure

2 h(x, m) ?

= h(x, m′) x

h1 h1

p p′ Offmine Structure Cost Build Test Offmine filter 2ℓ/2 2s Online filter 2ℓ/2+s 1

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 37 / 59

slide-65
SLIDE 65

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

First attack on HMAC-HAIFA

▶ Chains of length 2s, with a fixed message C

Ik

h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk

[i] C

S=2s 2u

Online Structure $

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

C

S=2s 2t

Offmine Structure

1 Query 2u message Mi = [i] ‖ C

s + t + u = ℓ Build filters for Mi Cplx: 2s+u+ℓ/2

2 Evaluate 2t chains offmine

Cplx: 2t+s Test endpoints with filters Cplx: 2t+u

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 38 / 59

slide-66
SLIDE 66

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

First attack on HMAC-HAIFA

▶ Chains of length 2s, with a fixed message C

Ik

h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk h0 h1 h2 hS gk

[i] C

S=2s 2u

Online Structure $

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

C

S=2s 2t

Offmine Structure

1 Query 2u message Mi = [i] ‖ C

s + t + u = ℓ Build filters for Mi Cplx: 2s+u+ℓ/2

2 Evaluate 2t chains offmine

Cplx: 2t+s Test endpoints with filters Cplx: 2t+u Optimal complexity 2ℓ−s, for s ≤ ℓ/6

(using u = s)

Minimum: 25ℓ/6

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 38 / 59

slide-67
SLIDE 67

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Diamond fjlters

▶ Building filers is a bottleneck. ▶ Can we amortize the cost of building many filters?

Diamond structure [Kelsey & Kohno, EC’06] Herd N initial states to a common state

▶ Try ≈ 2ℓ/2/√N msg from each state. ▶ Whp, the initial states can be paired ▶ Repeat...

Total ≈ √N ⋅ 2ℓ/2

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 39 / 59

slide-68
SLIDE 68

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Diamond fjlters

▶ Building filers is a bottleneck. ▶ Can we amortize the cost of building many filters?

Diamond structure [Kelsey & Kohno, EC’06] Herd N initial states to a common state

▶ Try ≈ 2ℓ/2/√N msg from each state. ▶ Whp, the initial states can be paired ▶ Repeat...

Total ≈ √N ⋅ 2ℓ/2

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 39 / 59

slide-69
SLIDE 69

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Diamond fjlters

▶ Building filers is a bottleneck. ▶ Can we amortize the cost of building many filters?

Diamond fjlter

1 Build a diamond structure 2 Build a collision filter for the final state ▶ Can also be built online ▶ Building N offmine filters: √N ⋅ 2ℓ/2

rather than N ⋅ 2ℓ/2

▶ Building N online filters: √N ⋅ 2ℓ/2+s rather than N ⋅ 2ℓ/2+s

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 39 / 59

slide-70
SLIDE 70

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Improved attack on HMAC-HAIFA

▶ Chains of length 2s, with a fixed message C

Ik

h0 h1 h2 hS h0 h1 h2 hS h0 h1 h2 hS h0 h1 h2 hS h0 h1 h2 hS gk

[i] C

S=2s 2u

Online Structure $

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

C

S=2s 2t

Offmine Structure

1 Query 2u message Mi = [i] ‖ C

s + t + u = ℓ Build diamond filter for Mi Cplx: 2s+u/2+ℓ/2

2 Evaluate 2t chains offmine

Cplx: 2t+s Test endpoints with filters Cplx: 2t+u

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 40 / 59

slide-71
SLIDE 71

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Improved attack on HMAC-HAIFA

▶ Chains of length 2s, with a fixed message C

Ik

h0 h1 h2 hS h0 h1 h2 hS h0 h1 h2 hS h0 h1 h2 hS h0 h1 h2 hS gk

[i] C

S=2s 2u

Online Structure $

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

$

h1 h2 hS

C

S=2s 2t

Offmine Structure

1 Query 2u message Mi = [i] ‖ C

s + t + u = ℓ Build diamond filter for Mi Cplx: 2s+u/2+ℓ/2

2 Evaluate 2t chains offmine

Cplx: 2t+s Test endpoints with filters Cplx: 2t+u Optimal complexity 2ℓ−s, for s ≤ ℓ/5

(using u = s)

Minimum: 24ℓ/5

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 40 / 59

slide-72
SLIDE 72

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Improvement using collisions (fjxed function)

x0 y0 x1 y1 x2 y2 x3 y3 x4

1 Compute chains x y

Stop when y distinguished

2 If y ∈ {yi}, collision found

Theorem (Entropy loss for collisions) Let ̂ x and ̂ y be two collisions found using chains of length 2s, with a fixed ℓ-bit random function f. Then Pr 􏿯 ̂ x = ̂ y􏿲 = 𝛪(22s−ℓ).

▶ Use the collisions as special states (instead of cycle entry point)

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 41 / 59

slide-73
SLIDE 73

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Trade-ofgs for state-recovery attacks

1 2ℓ/4 2ℓ/2 2ℓ/2 23ℓ/4 2ℓ Length of the messages Complexity HAIFA mode 1 2ℓ/4 2ℓ/2 2ℓ/2 23ℓ/4 2ℓ Length of the messages Merkle-Damgård mode

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 42 / 59

slide-74
SLIDE 74

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Outline

Introduction MACs Security Proofs Hash-based MACs Hash-based MACs State recovery attacks Using multi-collisions Using the cycle structure Short messages attacks using chains Universal forgery attacks Using cycles Using chains Key-recovery attacks HMAC-GOST

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 43 / 59

slide-75
SLIDE 75

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Bibliography

  • T. Peyrin, L. Wang

Generic Universal Forgery Attack on Iterative Hash-Based MACs EUROCRYPT 2014

  • J. Guo, T. Peyrin, Y. Sasaki, L. Wang

Updates on Generic Attacks against HMAC and NMAC CRYPTO 2014

  • I. Dinur, G. Leurent

Improved Generic Attacks against Hash-Based MACs and HAIFA CRYPTO 2014

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 44 / 59

slide-76
SLIDE 76

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Universal forgery attack

▶ Given a challenge message C, compute MAC(C)

▶ len(C) = 2s ▶ Oracle access to the MAC, can’t ask MAC(C)

▶ Study internal states for the computation of MAC(C)

▶ Unknown because of initial key and final key

1 Build a difgerent message reaching same states 2 Query MAC(M′), use as forgery

Ik M′ Ik MAC(C)

h h h h h h h h h h h h h h h gk

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 45 / 59

slide-77
SLIDE 77

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Universal forgery attack

▶ Given a challenge message C, compute MAC(C)

▶ len(C) = 2s ▶ Oracle access to the MAC, can’t ask MAC(C)

▶ Study internal states for the computation of MAC(C)

▶ Unknown because of initial key and final key

1 Build a difgerent message reaching same states 2 Query MAC(M′), use as forgery

Ik M′ Ik MAC(C)

h h h h h h h h h h h h h h h gk

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 45 / 59

slide-78
SLIDE 78

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

UF against secret-suffjx MAC

▶ Secret-suffjx has no key at the beginning

▶ All internal states for challenge message are known!

▶ Long-message second-preimage attack

[Kelsey & Schneier ’05]

▶ H(M) = H(C) ⟹ MAC(M) = H(M ‖ k) = H(C ‖ k) = MAC(C)

1 Build a expandable message

Cplx: 2ℓ/2

2 Find a connexion from the IV to the target states

Cplx: 2ℓ−s

3 Select expandable message

IV M′ IV MAC(C)

h h h h h h h h h h h h h h h gk

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 46 / 59

slide-79
SLIDE 79

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

UF against secret-suffjx MAC

▶ Secret-suffjx has no key at the beginning

▶ All internal states for challenge message are known!

▶ Long-message second-preimage attack

[Kelsey & Schneier ’05]

▶ H(M) = H(C) ⟹ MAC(M) = H(M ‖ k) = H(C ‖ k) = MAC(C)

1 Build a expandable message

Cplx: 2ℓ/2

IV 1 bl. 27 + 1 bl. m7/m′

7

1 bl. 26 + 1 bl. m6/m′

6

1 bl. 25 + 1 bl. m5/m′

5

1 bl. 24 + 1 bl. m4/m′

4

1 bl. 23 + 1 bl. m3/m′

3

1 bl. 22 + 1 bl. m2/m′

2

h∗

IV MAC(C)

h h h h h h h h h h h h h h h gk

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 46 / 59

slide-80
SLIDE 80

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

UF against secret-suffjx MAC

▶ Secret-suffjx has no key at the beginning

▶ All internal states for challenge message are known!

▶ Long-message second-preimage attack

[Kelsey & Schneier ’05]

▶ H(M) = H(C) ⟹ MAC(M) = H(M ‖ k) = H(C ‖ k) = MAC(C)

1 Build a expandable message

Cplx: 2ℓ/2

2 Find a connexion from x⋆ to the target states

Cplx: 2ℓ−s

3 Select expandable message

IV h⋆ h′

m⋆ IV MAC(C)

h h h h h h h h h h h h h h h gk

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 46 / 59

slide-81
SLIDE 81

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

UF against secret-suffjx MAC

▶ Secret-suffjx has no key at the beginning

▶ All internal states for challenge message are known!

▶ Long-message second-preimage attack

[Kelsey & Schneier ’05]

▶ H(M) = H(C) ⟹ MAC(M) = H(M ‖ k) = H(C ‖ k) = MAC(C)

1 Build a expandable message

Cplx: 2ℓ/2

2 Find a connexion from x⋆ to the target states

Cplx: 2ℓ−s

3 Select expandable message

IV h⋆ h′

m⋆ IV MAC(C)

h h h h h h h h h h h h h h h gk

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 46 / 59

slide-82
SLIDE 82

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

UF against secret-suffjx MAC

▶ Secret-suffjx has no key at the beginning

▶ All internal states for challenge message are known!

▶ Long-message second-preimage attack

[Kelsey & Schneier ’05]

▶ H(M) = H(C) ⟹ MAC(M) = H(M ‖ k) = H(C ‖ k) = MAC(C)

1 Build a expandable message

Cplx: 2ℓ/2

2 Find a connexion from x⋆ to the target states

Cplx: 2ℓ−s

3 Select expandable message

IV h⋆ h′

m⋆ IV MAC(C)

h h h h h h h h h h h h h h h gk

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 46 / 59

slide-83
SLIDE 83

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

UF against secret-prefjx MAC

▶ Secret-suffjx has no key at the end

▶ Finalization function is known!

1 Query the MAC of C|i (truncated to i blocks)

Cplx: 22⋅s

2 Evaluate the finalization function on 2ℓ−s states

Cplx: 2ℓ−s

3 Find a match, compute MAC

Ik MAC(C)

h h h h h h h h h h h h h h h g

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 47 / 59

slide-84
SLIDE 84

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

UF against secret-prefjx MAC

▶ Secret-suffjx has no key at the end

▶ Finalization function is known!

1 Query the MAC of C|i (truncated to i blocks)

Cplx: 22⋅s

2 Evaluate the finalization function on 2ℓ−s states

Cplx: 2ℓ−s

3 Find a match, compute MAC

Ik MAC(C)

h g h g h g h g h g h g h g h g h g h g g

Online Structure $

g

$

g

$

g

$

g

$

g

$

g 2ℓ−s

Offmine Structure

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 47 / 59

slide-85
SLIDE 85

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

UF attack against hash-based MAC

▶ Combine both techniques 1 Recover an internal state of the challenge 2 Use second-preimage attack with known state ▶ Hard part is to recover an internal state ▶ Extract information about the challenge state through gk

▶ Compute distance to cycle ▶ Use entropy loss of iterations

Ik MAC(C)

h h h h h h h h h h h h h h h gk

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 48 / 59

slide-86
SLIDE 86

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Using cycles

Main idea

▶ Measure the distance from challenge point to cycle in h[0]

▶ Add zero blocks after the challenge

▶ Match with offmine points with known distance

Ik

2s 2ℓ/2 2s C

Online Structure

􏿻2ℓ−spoints􏿾

Offmine Structure

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 49 / 59

slide-87
SLIDE 87

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Using cycles

1 (online) For each challenge state, use binary search to find distance

MAC(C|i ‖ 0d+L ‖ 1 ‖ 02ℓ/2)

?

= MAC(C|i ‖ 0d ‖ 1 ‖ 02ℓ/2+L)

2 (offmine) Build a structure with 2ℓ−s points with known distance. 3 (offmine) Match the challenge states and the offmine structure 4 (online) Test candidates at the right distance.

Ik

2s 2ℓ/2 2s C

Online Structure

􏿻2ℓ−spoints􏿾

Offmine Structure

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 49 / 59

slide-88
SLIDE 88

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Using chains

Main idea

▶ Add a sequence of fixed message blocks to reduce image space ▶ Match in the reduced space

Ik

2s 22s−2s 2s C

Online Structure

22s 22s 􏿻2ℓ−s points􏿾 􏿻2ℓ−2simages ( )􏿾

Offmine Structure

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 50 / 59

slide-89
SLIDE 89

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Using chains

1 (online) Query messages Mi = C|i ‖ [0]22s−i.

Build diamond filter for endpoints Y

2 (offmine) Build a structure with 2ℓ−s points.

Consider 22s-images X. |X| ≤ 2ℓ−2s

3 (offmine) Match X and Y. 4 (offmine) For each match, find preimages as candidates.

Ik

2s 22s−2s 2s C

Online Structure

22s 22s 􏿻2ℓ−s points􏿾 􏿻2ℓ−2simages ( )􏿾

Offmine Structure

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 50 / 59

slide-90
SLIDE 90

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Universal forgery attacks: summary

Universal forgery attacks

▶ It is possible to perform a generic universal forgery attack ▶ Best attack so far: 2ℓ−s, with s ≤ ℓ/4 (23ℓ/4 with s = ℓ/4) ▶ Using distance to the cycle: query length 2ℓ/2

▶ Complexity 2ℓ−s, s ≤ ℓ/6

[Peyrin & Wang, EC ’14] Optimal: 25ℓ/6, with s = 2ℓ/6

▶ Complexity 2ℓ−s, s ≤ ℓ/4

[Guo, Peyrin, Sasaki & Wang, CR ’14] Optimal: 23ℓ/4, with s = 2ℓ/4

▶ Later attack using chains: shorter query length 2t

▶ Complexity 2ℓ−s , s ≤

ℓ/7, t = 2s [Dinur & L, CR ’14] Optimal: 26ℓ/7, with s = 2ℓ/7, t = 2ℓ/7

▶ Complexity 2ℓ−s/2, s ≤ 2ℓ/5, t =

s [Dinur & L, CR ’14] Optimal: 24ℓ/5, with s = 22ℓ/5, t = 2ℓ/5

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 51 / 59

slide-91
SLIDE 91

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Outline

Introduction MACs Security Proofs Hash-based MACs Hash-based MACs State recovery attacks Using multi-collisions Using the cycle structure Short messages attacks using chains Universal forgery attacks Using cycles Using chains Key-recovery attacks HMAC-GOST

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 52 / 59

slide-92
SLIDE 92

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

GOST hash functions

IV M0 h

M1 x0 h

M2 x1 h

M3 x2 x3

ℓ n

|M| h g

▶ Family of Russian standards

▶ GOST-1994: n = ℓ = 256 ▶ GOST-2012: n ≤ ℓ = 512, HAIFA mode

(aka Streebog)

▶ GOST and HMAC-GOST standardized by IETF ▶ Checksum (dashed lines)

▶ Larger state should increase the security

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 53 / 59

slide-93
SLIDE 93

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

HMAC-GOST

IV k ⊕ 𝚓𝚚𝚋𝚎 h

M0 x0 h

M1 x1 h

M2 x2 x∗

|M| h g IV k ⊕ 𝚙𝚚𝚋𝚎 h h g

n

t

▶ In HMAC, key-dependant value used after the message

▶ Related-key attacks on the last block

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 54 / 59

slide-94
SLIDE 94

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Key recovery attack on HMAC-GOST

IV k ⊕ 𝚓𝚚𝚋𝚎 h

M0 x0 h

M1 x1 h

M2 x2 x∗

|M| h g

1 Recover the state of a short message 2 Build a multicollision: 23l/4 messages with the same x∗ 3 Query messages, detect collisions g( ̄

x, k ⊕ M) = g( ̄ x, k ⊕ M′) Store (M ⊕ M′, M) for 2ℓ/2 collisions

4 Find collisions g( ̄

x, y) = g( ̄ x, y′) offmine Store (x ⊕ y′, y) for 2ℓ/2 collisions

5 Detect match M ⊕ M′ = y ⊕ y′. With high probability M ⊕ k = y

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 55 / 59

slide-95
SLIDE 95

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Key recovery attack on HMAC-GOST

IV k ⊕ 𝚓𝚚𝚋𝚎 h

M0 x0 h

M1 x1 h

M2 x2 x∗

|M| h g

1 Recover the state of a short message 2 Build a multicollision: 23l/4 messages with the same x∗ 3 Query messages, detect collisions g( ̄

x, k ⊕ M) = g( ̄ x, k ⊕ M′) Store (M ⊕ M′, M) for 2ℓ/2 collisions

4 Find collisions g( ̄

x, y) = g( ̄ x, y′) offmine Store (x ⊕ y′, y) for 2ℓ/2 collisions

5 Detect match M ⊕ M′ = y ⊕ y′. With high probability M ⊕ k = y

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 55 / 59

slide-96
SLIDE 96

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Key recovery attack on HMAC-GOST

IV k ⊕ 𝚓𝚚𝚋𝚎 h

M0 x0 h

M1 x1 h

M2 x2 ̄ x

|M| h k ⊕ M g

1 Recover the state of a short message 2 Build a multicollision: 23l/4 messages with the same x∗ 3 Query messages, detect collisions g( ̄

x, k ⊕ M) = g( ̄ x, k ⊕ M′) Store (M ⊕ M′, M) for 2ℓ/2 collisions

4 Find collisions g( ̄

x, y) = g( ̄ x, y′) offmine Store (x ⊕ y′, y) for 2ℓ/2 collisions

5 Detect match M ⊕ M′ = y ⊕ y′. With high probability M ⊕ k = y

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 55 / 59

slide-97
SLIDE 97

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Key recovery attack on HMAC-GOST

IV k ⊕ 𝚓𝚚𝚋𝚎 h

M0 x0 h

M1 x1 h

M2 x2 ̄ x

|M| h k ⊕ M g

1 Recover the state of a short message 2 Build a multicollision: 23l/4 messages with the same x∗ 3 Query messages, detect collisions g( ̄

x, k ⊕ M) = g( ̄ x, k ⊕ M′) Store (M ⊕ M′, M) for 2ℓ/2 collisions

4 Find collisions g( ̄

x, y) = g( ̄ x, y′) offmine Store (x ⊕ y′, y) for 2ℓ/2 collisions

5 Detect match M ⊕ M′ = y ⊕ y′. With high probability M ⊕ k = y

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 55 / 59

slide-98
SLIDE 98

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Key recovery attack on HMAC-GOST

IV k ⊕ 𝚓𝚚𝚋𝚎 h

M0 x0 h

M1 x1 h

M2 x2 ̄ x

|M| h k ⊕ M g

1 Recover the state of a short message 2 Build a multicollision: 23l/4 messages with the same x∗ 3 Query messages, detect collisions g( ̄

x, k ⊕ M) = g( ̄ x, k ⊕ M′) Store (M ⊕ M′, M) for 2ℓ/2 collisions

4 Find collisions g( ̄

x, y) = g( ̄ x, y′) offmine Store (x ⊕ y′, y) for 2ℓ/2 collisions

5 Detect match M ⊕ M′ = y ⊕ y′. With high probability M ⊕ k = y

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 55 / 59

slide-99
SLIDE 99

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Complexity

Surprising result The checksum actually make the hash function weaker!

▶ HMAC-GOST-1994 is weaker than HMAC-SHA256 ▶ HMAC-GOST-2012 is weaker than HMAC-SHA512

It is important to recover the state of a short message

▶ For GOST-1994, we can recover the state of a short message

from a longer one using padding tricks Total complexity 23ℓ/4

▶ For GOST-2012, we use an advanced attack

with message length 2ℓ/10 Total complexity 24ℓ/5

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 56 / 59

slide-100
SLIDE 100

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Attack complexity

Function Mode ℓ s

  • St. rec.
  • Univ. F
  • K. rec.

SHA-1 MD 160 255 2107 2132 SHA-224 MD 256 255 2192 SHA-256 MD 256 255 2192 2228 SHA-512 MD 512 2118 2384 2453 HAVAL MD 256 254 2192 2229 WHIRLPOOL MD 512 2247 2283 2446 BLAKE-256 HAIFA 256 255 2213 BLAKE-512 HAIFA 512 2118 2419 Skein-512 HAIFA 512 290 2419 GOST-94 MD+𝜏 256 ∞ 2128 2192 2192 Streebog HAIFA+𝜏 512 ∞ 2419 2419 2419

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 57 / 59

slide-101
SLIDE 101

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Conclusion

Be carefull with security proof

▶ “CBC-MAC is proven secure” does not mean

“CBC-MAC-AES is a secure as AES”

▶ Most security proofs are up to the birthday bound ▶ Is 64-bit security enough?

▶ Don’t assume too much after the security bound of the proof

▶ Generic key-recovery for envelope-MAC, AEZ, HMAC-GOST

Gaps between proofs and attacks!

▶ Better generic attacks? ▶ Better proofs?

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 58 / 59

slide-102
SLIDE 102

Introduction Hash-based MACs State recovery Universal forgery Key-recovery Conclusion

Thanks

Questions?

  • G. Leurent (Inria)

Generic Attacks against MAC algorithms ASK 2015 59 / 59