New Generic Attacks on Hash-based MACs G. Leurent (Inria) New - - PowerPoint PPT Presentation

new generic attacks on hash based macs
SMART_READER_LITE
LIVE PREVIEW

New Generic Attacks on Hash-based MACs G. Leurent (Inria) New - - PowerPoint PPT Presentation

Introduction New generic attacks HMAC-GOST key-recovery Conclusion New Generic Attacks on Hash-based MACs G. Leurent (Inria) New Generic Attacks on Hash-based MACs Asiacrypt 2013 1 / 22 . . . . . . . . . . . . . . . . . Gatan Leurent,


slide-1
SLIDE 1

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

New Generic Attacks on Hash-based MACs

Gaëtan Leurent, Thomas Peyrin, Lei Wang

Inria, France  UCL, Belgium Nanyang Technological University, Singapore

Asiacrypt 2013

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 1 / 22

slide-2
SLIDE 2

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Message Authentication Codes

. . Alice . . Bob . M, t . .

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

t = MACk(M)

▶ Bob verifies the tag with the same key k:

t

?

= MACk(M)

▶ Symmetric equivalent to digital signatures

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 2 / 22

slide-3
SLIDE 3

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

MAC Constructions

▶ Dedicated designs

▶ PelicanMAC, SQUASH, SipHash

▶ From universal hash functions

▶ UMAC, VMAC, Poly1305

▶ From block ciphers

▶ CBCMAC, OMAC, PMAC

▶ From hash functions

▶ HMAC, SandwichMAC, EnvelopeMAC

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 3 / 22

slide-4
SLIDE 4

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

MAC Constructions

▶ Dedicated designs

▶ PelicanMAC, SQUASH, SipHash

▶ From universal hash functions

▶ UMAC, VMAC, Poly1305

▶ From block ciphers

▶ CBCMAC, OMAC, PMAC

▶ From hash functions

▶ HMAC, SandwichMAC, EnvelopeMAC

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 3 / 22

slide-5
SLIDE 5

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST 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)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 4 / 22

slide-6
SLIDE 6

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Hash-based MACs

. . h .

l

. m0 . x0 . h .

l

. m1 . x1 . h .

l

. m2 . x2 . x3 . MACk(M) .

l

.

n

. |M| . Ik . gk

▶ lbit chaining value ▶ nbit output ▶ kbit key ▶ Keydependant initial value Ik ▶ Unkeyed compression function h ▶ Keydependant finalization, with message length gk

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 5 / 22

slide-7
SLIDE 7

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Security of HMAC

Security proof / Attack

▶ Existential forgery:

2l/2 2l/2

▶ Forge a valid pair

▶ Universal forgery:

2l/2 2n

▶ Predict the MAC of a challenge

▶ DistinguishingR:

2l/2 2l/2

▶ Distinguish HMAC from a PRF

▶ DistinguishingH:

2l/2 2l

▶ Distinguish HMACSHA1 from HMACPRF

▶ Staterecovery:

2l/2 2l

▶ Find the internal state after some message

▶ Keyrecovery:

2l/2 2k

▶ Extract the key from a MAC oracle

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 6 / 22

slide-8
SLIDE 8

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Distinguishing-H attack

. . Adversary .

OXYGEN

. Oracle . HMACH

k or HMACPRF k

.

H

. k ← $ . M . MACk(M)

▶ Security notion from PRF ▶ Distinguish HMAC using H from HMAC with a PRF

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 7 / 22

slide-9
SLIDE 9

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Distinguishing-H attack

▶ Collisionbased attack does not work:

▶ Any compression function has collisions ▶ Secret key prevents precomputed collisions

▶ Folklore assumption: distinguishingH attack should require 2l

“If we can recognize the hash function inside HMAC, it must be a bad hash function”

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 8 / 22

slide-10
SLIDE 10

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Outline

Introduction MACs HMAC New generic attacks Cycle detection DistinguishingH attack State recovery attack Key-recovery Attack on HMAC-GOST HMACGOST Key recovery

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 9 / 22

slide-11
SLIDE 11

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Main Idea

. . h .

l

. . x0 . h .

l

. . x1 . h .

l

. . x2 . x3 . MACK(M) .

l

.

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)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 10 / 22

slide-12
SLIDE 12

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Main Idea

. . h .

l

. . x0 . h .

l

. . x1 . h .

l

. . x2 . x3 . MACK(M) .

l

.

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)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 10 / 22

slide-13
SLIDE 13

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST 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 ≈ 2l/2 iterations

▶ Cycles

▶ Trees rooted in the cycle ▶ Several components

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 11 / 22

slide-14
SLIDE 14

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Random Mappings

. .

▶ Functional graph of a random mapping

x → f(x)

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

▶ Cycles

▶ Trees rooted in the cycle ▶ Several components

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 11 / 22

slide-15
SLIDE 15

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Random Mappings

. .

▶ Functional graph of a random mapping

x → f(x)

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

▶ Cycles

▶ Trees rooted in the cycle ▶ Several components

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 11 / 22

slide-16
SLIDE 16

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST 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)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 12 / 22

slide-17
SLIDE 17

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Using the cycle length

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

. . . Success if

▶ The starting point is in the main component

p = 0.76

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

p ≥ 0.5 Randomize starting point

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 13 / 22

slide-18
SLIDE 18

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST 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)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 13 / 22

slide-19
SLIDE 19

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Using the cycle length

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

. . . Success if

▶ The starting point is in the main component

p = 0.76

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

p ≥ 0.5 Randomize starting point

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 13 / 22

slide-20
SLIDE 20

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Dealing with the message length

Problem: most MACs use the message length. . . h .

l

. . x0 . h .

l

. . x1 . h .

l

. . x2 . x3 . MACk(M) .

l

.

n

. |M| . Ik . gk

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 14 / 22

slide-21
SLIDE 21

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Dealing with the message length

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

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 14 / 22

slide-22
SLIDE 22

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Dealing with the message length

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

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 14 / 22

slide-23
SLIDE 23

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Distinguishing-H attack

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

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

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

Analysis

▶ Complexity: 2l/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 2l/2 iterations

p ≥ 0.52

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 15 / 22

slide-24
SLIDE 24

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

State recovery attack

. .

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

and root of giant tree 𝛽

2 Online: Binary search

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

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

Analysis

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

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 16 / 22

slide-25
SLIDE 25

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST 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)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 16 / 22

slide-26
SLIDE 26

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

State recovery attack

. .

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

and root of giant tree 𝛽

2 Online: Binary search

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

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

Analysis

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

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 16 / 22

slide-27
SLIDE 27

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Outline

Introduction MACs HMAC New generic attacks Cycle detection DistinguishingH attack State recovery attack Key-recovery Attack on HMAC-GOST HMACGOST Key recovery

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 17 / 22

slide-28
SLIDE 28

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

GOST

. IV . M0 . h .

n

. M1 . x0 . h .

n

. M2 . x1 . h .

n

. M3 . x2 . x3 .

n

.

n

. |M| . h . g

▶ Russian standard from 1994 ▶ GOST and HMACGOST standardized by IETF ▶ n = l = m = 256 ▶ Checksum (dashed lines)

▶ Larger state should increase the security

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 18 / 22

slide-29
SLIDE 29

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

HMAC-GOST

. . IV . k ⊕ 𝚓𝚚𝚋𝚎 . h .

l

. M0 . x0 . h .

l

. M1 . x1 . h .

l

. M2 . x2 . x∗ .

l

. |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)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 19 / 22

slide-30
SLIDE 30

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Key recovery attack on HMAC-GOST

. IV . k ⊕ 𝚓𝚚𝚋𝚎 . h .

l

. M0 . x0 . h .

l

. M1 . x1 . h .

l

. M2 . x2 . x∗ .

l

. |M| . h . g

1 Recover the state 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 2l/2 collisions

4 Find collisions g( ̄

x, y) = g( ̄ x, y′) offline Store (x ⊕ y′, y) for 2l/2 collisions

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

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 20 / 22

slide-31
SLIDE 31

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Key recovery attack on HMAC-GOST

. IV . k ⊕ 𝚓𝚚𝚋𝚎 . h .

l

. M0 . x0 . h .

l

. M1 . x1 . h .

l

. M2 . x2 . x∗ .

l

. |M| . h . g

1 Recover the state 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 2l/2 collisions

4 Find collisions g( ̄

x, y) = g( ̄ x, y′) offline Store (x ⊕ y′, y) for 2l/2 collisions

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

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 20 / 22

slide-32
SLIDE 32

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Key recovery attack on HMAC-GOST

. IV . k ⊕ 𝚓𝚚𝚋𝚎 . h .

l

. M0 . x0 . h .

l

. M1 . x1 . h .

l

. M2 . x2 . ̄ x .

l

. |M| . h . k ⊕ M . g

1 Recover the state 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 2l/2 collisions

4 Find collisions g( ̄

x, y) = g( ̄ x, y′) offline Store (x ⊕ y′, y) for 2l/2 collisions

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

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 20 / 22

slide-33
SLIDE 33

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Key recovery attack on HMAC-GOST

. IV . k ⊕ 𝚓𝚚𝚋𝚎 . h .

l

. M0 . x0 . h .

l

. M1 . x1 . h .

l

. M2 . x2 . ̄ x .

l

. |M| . h . k ⊕ M . g

1 Recover the state 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 2l/2 collisions

4 Find collisions g( ̄

x, y) = g( ̄ x, y′) offline Store (x ⊕ y′, y) for 2l/2 collisions

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

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 20 / 22

slide-34
SLIDE 34

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Key recovery attack on HMAC-GOST

. IV . k ⊕ 𝚓𝚚𝚋𝚎 . h .

l

. M0 . x0 . h .

l

. M1 . x1 . h .

l

. M2 . x2 . ̄ x .

l

. |M| . h . k ⊕ M . g

1 Recover the state 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 2l/2 collisions

4 Find collisions g( ̄

x, y) = g( ̄ x, y′) offline Store (x ⊕ y′, y) for 2l/2 collisions

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

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 20 / 22

slide-35
SLIDE 35

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Conclusion

New generic attacks against hash-based MACs (single-key):

1 DistinguishingH attack in 2l/2

Staterecovery attack in 2l/2 × l

▶ Not harder than distinguishingR. ▶ Security proof is tight for these notions. ▶ Complexity 2l−s with short messages (length 2s, s < l/4)

2 Keyrecovery attack on HMACGOST in 2192 (23l/4)

▶ Generic attack against hash functions with a checksum. ▶ The checksum weakens the design!

Open questions:

▶ What is the generic security of HMAC above the birthday bound? ▶ Other applications of staterecovery attack?

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 21 / 22

slide-36
SLIDE 36

. . . . . . . Introduction . . . . . . . New generic attacks . . . HMAC-GOST key-recovery Conclusion

Thanks

Questions?

With the support of ERC project CRASH

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 22 / 22

slide-37
SLIDE 37

Security of HMAC . . . . . . Extra slides

Additional slides

Security of HMAC Extra slides Construction of hashbased MACs Challengeresponse Authentication Security Notions Generic Attacks Attacks with short messages

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 23 / 22

slide-38
SLIDE 38

Security of HMAC . . . . . . Extra slides

Security of HMAC

Security proof / Attack

▶ Existential forgery:

2l/2 2l/2

▶ Forge a valid pair

▶ Universal forgery:

2l/2 2n

▶ Predict the MAC of a challenge

▶ DistinguishingR:

2l/2 2l/2

▶ Distinguish HMAC from a PRF

▶ DistinguishingH:

2l/2 2l

▶ Distinguish HMACSHA1 from HMACPRF

▶ Staterecovery:

2l/2 2l

▶ Find the internal state after some message

▶ Keyrecovery:

2l/2 2k

▶ Extract the key from a MAC oracle

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 24 / 22

slide-39
SLIDE 39

Security of HMAC . . . . . . Extra slides

Security of HMAC : new results

Security proof / Attack

▶ Existential forgery:

2l/2 2l/2

▶ Forge a valid pair

▶ Universal forgery:

2l/2 2n

▶ Predict the MAC of a challenge

▶ DistinguishingR:

2l/2 2l/2

▶ Distinguish HMAC from a PRF

▶ DistinguishingH:

2l/2 2l/2

▶ Distinguish HMACSHA1 from HMACPRF

▶ Staterecovery:

2l/2 2l/2

▶ Find the internal state after some message

▶ Keyrecovery:

2l/2 2k

▶ Extract the key from a MAC oracle

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 24 / 22

slide-40
SLIDE 40

Security of HMAC . . . . . . Extra slides

Security of HMAC : new results on GOST

Security proof / Attack

▶ Existential forgery:

2l/2 2l/2

▶ Forge a valid pair

▶ Universal forgery:

2l/2 23l/4

▶ Predict the MAC of a challenge

▶ DistinguishingR:

2l/2 2l/2

▶ Distinguish HMAC from a PRF

▶ DistinguishingH:

2l/2 2l/2

▶ Distinguish HMACSHA1 from HMACPRF

▶ Staterecovery:

2l/2 2l/2

▶ Find the internal state after some message

▶ Keyrecovery:

2l/2 23l/4

▶ Extract the key from a MAC oracle

 checksum, and l = n

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 24 / 22

slide-41
SLIDE 41

Security of HMAC . . . . . . Extra slides

Comparison of attacks on HMAC

Function Attack Complexity

  • M. len

Notes HMACMD5 distH, st. rec. 297 2 HMACSHA-0 distH 2100 2 HMACHAVAL (3pass) distH 2228 2 HMACSHA-1 62 mid. steps distH 2157 2 Generic distH, st. rec. ̃ O(2l/2) 2l/2 distH, st. rec. O(2l−s) 2s s ≤ l/4 Generic: checksum key recovery O(23l/4) 2l/4 HMACMD5 distH, st. rec. 266, 278 264 O(296) 232 HMACHAVAL (any) distH, st. rec. O(2202) 254 HMACSHA-1 distH, st. rec. O(2120) 240 HMACGOST keyrecovery 2200 264

 MD5, GOST: arbitrarylength;  SHA-1, HAVAL: limited message length.

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 25 / 22

slide-42
SLIDE 42

Security of HMAC . . . . . . Extra slides

Hash-based MACs

▶ Secretprefix MAC:

MACk(M) = H(k ‖ M)

▶ Insecure with MD/SHA: lengthextension attack ▶ Compute MACk(M ‖ P) from MACk(M) without the key

▶ Secretsuffix MAC:

MACk(M) = H(M ‖ k)

▶ Can be broken using offline collisions

▶ Use the key at the beginning and at the end

▶ SandwichMAC:

H(k1 ‖ M ‖ k2)

▶ NMAC:

H(k2 ‖ H(k1 ‖ M))

▶ HMAC:

H((k ⊕ opad) ‖ H((k ⊕ ipad) ‖ M))

▶ Security proofs

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 26 / 22

slide-43
SLIDE 43

Security of HMAC . . . . . . Extra slides

Hash-based MACs

▶ Secretprefix MAC:

MACk(M) = H(k ‖ M)

▶ Insecure with MD/SHA: lengthextension attack ▶ Compute MACk(M ‖ P) from MACk(M) without the key

▶ Secretsuffix MAC:

MACk(M) = H(M ‖ k)

▶ Can be broken using offline collisions

▶ Use the key at the beginning and at the end

▶ SandwichMAC:

H(k1 ‖ M ‖ k2)

▶ NMAC:

H(k2 ‖ H(k1 ‖ M))

▶ HMAC:

H((k ⊕ opad) ‖ H((k ⊕ ipad) ‖ M))

▶ Security proofs

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 26 / 22

slide-44
SLIDE 44

Security of HMAC . . . . . . Extra slides

Hash-based MACs

▶ Secretprefix MAC:

MACk(M) = H(k ‖ M)

▶ Insecure with MD/SHA: lengthextension attack ▶ Compute MACk(M ‖ P) from MACk(M) without the key

▶ Secretsuffix MAC:

MACk(M) = H(M ‖ k)

▶ Can be broken using offline collisions

▶ Use the key at the beginning and at the end

▶ SandwichMAC:

H(k1 ‖ M ‖ k2)

▶ NMAC:

H(k2 ‖ H(k1 ‖ M))

▶ HMAC:

H((k ⊕ opad) ‖ H((k ⊕ ipad) ‖ M))

▶ Security proofs

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 26 / 22

slide-45
SLIDE 45

Security of HMAC . . . . . . Extra slides

Example use: challenge-response authentication

. . . Alice .

OXYGEN

. Server . password pw . password pw . x ← $ . x . y ← MACpw(x) . y . if y = MACpw(x), accept . else, reject

▶ CRAMMD5 authentication in SASL, POP3, IMAP, SMTP, ...

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 27 / 22

slide-46
SLIDE 46

Security of HMAC . . . . . . Extra slides

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 for hashbased MACs:

▶ 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)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 28 / 22

slide-47
SLIDE 47

Security of HMAC . . . . . . Extra slides

Generic Attack on Hash-based MACs

. Ik . x . y . MAC

1 Find internal collisions

▶ Query 2l/2 1block 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)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 29 / 22

slide-48
SLIDE 48

Security of HMAC . . . . . . Extra slides

Generic Attack on Hash-based MACs

. Ik . x . y . m . MAC

1 Find internal collisions

▶ Query 2l/2 1block 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)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 29 / 22

slide-49
SLIDE 49

Security of HMAC . . . . . . Extra slides

Generic Attack on Hash-based MACs

. Ik . x . y . m . MAC

1 Find internal collisions

▶ Query 2l/2 1block 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)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 29 / 22

slide-50
SLIDE 50

Security of HMAC . . . . . . Extra slides

Generic Attack on Hash-based MACs

. Ik . x . y . m . MAC

1 Find internal collisions

▶ Query 2l/2 1block messages ▶ 1 internal collision expected, detected in the output

2 Query t = MAC(x ‖ m) and t′ = MAC(y ‖ m) 3 If t = t′ the oracle is a hashbased MAC:

distinguishingR

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 29 / 22

slide-51
SLIDE 51

Security of HMAC . . . . . . Extra slides

Variant with small messages

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

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

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

Compare with collision finding algorithms

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

uses shorter chains

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 30 / 22

slide-52
SLIDE 52

Security of HMAC . . . . . . Extra slides

Collision finding with small 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

Using collisions for state recovery

▶ Collision points are not random ▶ Longer chains give more biased distribution ▶ Precompute collisions offline, and test online

  • G. Leurent (Inria)

New Generic Attacks on Hash-based MACs Asiacrypt 2013 31 / 22