54
. . UCL Crypto Group . Microelectronics Laboratory . G. Leurent . New Generic Attacks on Hash-based MACs . TCCM-CACR 2013 . 1/31 . . . . . . . . . Introduction . . . . . . . . . . . . . . New attacks . . . . . Key-recovery Attack on HMAC-GOST New Generic Attacks on Hash-based MACs Gaëtan Leurent, Thomas Peyrin, Lei Wang UCL Crypto Group, Belgium Nanyang Technological University, Singapore TCCM-CACR 2013 .

New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

New Generic Attacks on Hash-based MACs

Gaeumltan Leurent Thomas Peyrin Lei Wang

UCL Crypto Group BelgiumNanyang Technological University Singapore

TCCM-CACR 2013

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Example use challenge-response authentication

Alice

OXYGEN

Server

password pw

password pw

x larr $

x

y larr MACpw(x)

y

if y = MACpw(x) accept

else reject

CRAMMD5 authentication in SASL POP3 IMAP SMTP

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 2: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Example use challenge-response authentication

Alice

OXYGEN

Server

password pw

password pw

x larr $

x

y larr MACpw(x)

y

if y = MACpw(x) accept

else reject

CRAMMD5 authentication in SASL POP3 IMAP SMTP

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 3: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Example use challenge-response authentication

Alice

OXYGEN

Server

password pw

password pw

x larr $

x

y larr MACpw(x)

y

if y = MACpw(x) accept

else reject

CRAMMD5 authentication in SASL POP3 IMAP SMTP

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 4: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Example use challenge-response authentication

Alice

OXYGEN

Server

password pw

password pw

x larr $

x

y larr MACpw(x)

y

if y = MACpw(x) accept

else reject

CRAMMD5 authentication in SASL POP3 IMAP SMTP

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 5: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Example use challenge-response authentication

Alice

OXYGEN

Server

password pw

password pw

x larr $

x

y larr MACpw(x)

y

if y = MACpw(x) accept

else reject

CRAMMD5 authentication in SASL POP3 IMAP SMTP

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 6: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Example use challenge-response authentication

Alice

OXYGEN

Server

password pw

password pw

x larr $

x

y larr MACpw(x)

y

if y = MACpw(x) accept

else reject

CRAMMD5 authentication in SASL POP3 IMAP SMTP

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 7: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Example use challenge-response authentication

Alice

OXYGEN

Server

password pw

password pw

x larr $

x

y larr MACpw(x)

y

if y = MACpw(x) accept

else reject

CRAMMD5 authentication in SASL POP3 IMAP SMTP

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 8: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 9: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

MAC Constructions

Dedicated designs PelicanMAC SQUASH SipHash

From universal hash functions UMAC VMAC Poly1305

From block ciphers CBCMAC OMAC PMAC

From hash functions HMAC SandwichMAC EnvelopeMAC

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 10: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 11: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 12: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (I)

Secretprefix MAC MACk(M) = H(k M) Insecure with MDSHA lengthextension attack Compute MACk(M P) from MACk(M) without the key

Secretsuffix MAC MACk(M) = H(M k) Can be broken using offline collisions

Use the key at the beginning and at the end SandwichMAC H(k1 M k2) NMAC H(k2 H(k1 M)) HMAC H((k oplus opad) H((k oplus ipad) M)) Security proofs

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 13: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Hash-based MACs (II)

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

lbit chaining value nbit output kbit key

Keydependant initial value Ik Unkeyed compression function h Keydependant finalization with message length gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 14: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security notions

Keyrecovery 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 hashbased MACs Distinguish MACH

k from a PRF distinguishingReg distinguish HMAC from a PRF

Distinguish MACHk from MACPRF

k distinguishingHeg distinguish HMACSHA1 from HMACPRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 15: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 16: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 17: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m)

3 1114100y m t1114103 is a forgery

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 18: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic Attack on Hash-based MACs

Ik x

y

m MAC

1 Find internal collisions Query 2l2 1block messages 1 internal collision expected detected in the output

2 Query t = MAC(x m) and tprime = MAC(y m)

3 If t = tprime the oracle is a hashbased MACdistinguishingR

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 19: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Security of hash-based MACS

With n = l = k

0

l2

l

Security proof

Existential forgery

DistinguishingR

Key recovery

Universal forgery

DistinguishingH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 20: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 21: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 22: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Adversary

OXYGEN

Oracle

MACHk or MACPRF

k

H

k larr $

M

MACk(M)

Security notion from PRF Distinguish HMACSHA1 from HMAC with a PRF

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 23: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

Collisionbased attack does not work Any compression function has collisions Secret key prevents precomputed collision

Common assumption distinguishingH attack should require 2l

ldquoIf we can recognize the hash function inside HMACitrsquos a bad hash functionrdquo

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 24: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Main Idea

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACK(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 still detect properties of the function h0 ∶ x ↦ h(x 0) Study the cycle structure of random mappings Used to attack HMAC in relatedkey setting

[Peyrin Sasaki Wang Asiacrypt 12]

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 25: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

x0

x1

x2

x3

x4

x5

x6

x7

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 26: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 27: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Random Mappings

Functional graph of a random mappingx rarr f(x)

Iterate f xi = f(ximinus1)

Collision after asymp 2n2 iterations Cycles

Trees rooted in the cycle

Several components

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 28: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 29: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 30: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 31: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Using the cycle length

1 Offline find the cycle length L of the main component of h02 Online query t = MAC(r [0]2l2) and tprime = MAC(r [0]2l2+L)

Success if

The starting point is in the main component p = 076 The cycle is reached with less than 2l2 iterations p ge 05

Randomize starting point

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 32: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Problem most MACs use the message length

h

l

0

x0 h

l

0

x1h

l

0

x2 x3MACk(M)

l

n

|M|

Ik

gk

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 33: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M = r [0]2l2 [1] [0]2l2

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 34: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Dealing with the message length

Solution reach the cycle twice

M1 = r [0]2l2+L [1] [0]2l2

M2 = r [0]2l2 [1] [0]2l2+L

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 35: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 1931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Distinguishing-H attack

1 Offline find the cycle length L of the main component of h0

2 Online query t = MAC(r [0]2l2 [1] [0]2l2+L)tprime = MAC(r [0]2l2+L [1] [0]2l2 )

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

Analysis

Complexity 2l2+3 compression function calls Success probability p ≃ 014

Both starting point are in the main component p = 0762 Both cycles are reached with less than 2l2 iterations p ge 052

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 36: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 37: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Cycle structure

Expected properties of a randommapping over N points

Components 12 logN

Cyclic nodes radic120587N2 Tail length radic120587N8 Rho length radic120587N2 Largest tree 048N Largest component 076N

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 38: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 39: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [1] [0]2l2+L)tprime = MAC(r [0]120572+L [1] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 40: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2231

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

State recovery attack

[x]

With high pr first cyclic pointis the root of the giant tree

Binary search for first cyclic point

1 Query with several xt = MAC(r [0]120572 [x] [0]2l2+L)tprime = MAC(r [0]120572+L [x] [0]2l2 )

2 If t = tprime the cycle is reachedwith less than 120572 steps

Collision detection probabilisticrepeat with 120573 log(l)messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 41: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2331

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Variant with small messages

Messages of length 2l2 are not very practical SHA1 and HAVAL limit the message length to 264 bits

Cycle detection impossible with messages shorter than L asymp 2l2

Compare with collision finding algorithms

Pollardrsquos rho algorithm use cycle detection Parallel collision search for van Oorschot and Wieneruses shorter chains

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 42: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2431

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Collision finding with small chains

x0 y0x1

y1

x2

y2

x3

y3

x4

1 Compute chains x y

Stop when y distinguished2 If y isin 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

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 43: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2531

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Generic attacks on hash-based MACs

DistinguishingH and state recovery attacks Complexity 2lminuss with messages of length 2s

1

2l4

2l2

23l4

2l1

2l4

2l2

23l4

2l

Length of the messages

Com

plexity

Long messages

Short messages

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 44: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2631

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Outline

IntroductionMACsGeneric Attacks

New attacksCycle detectionDistinguishingH attackState recovery attack

Key-recovery Attack on HMAC-GOSTGOSTHMACGOST

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 45: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2731

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

GOST

IV

M0

h

n

M1

x0 h

n

M2

x1h

n

M3

x2 x3n

n

|M|

h

g

Russian standard from 1994 GOST and HMACGOST standardized by IETF n = l = m = 256

Checksum (dashed lines) Larger state should increase the security

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 46: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2831

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

HMAC-GOST

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

IV

k oplus 120472120473120458120461

h

h

g

n

t

In HMAC keydependant value used after the message Relatedkey attacks on the last block

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 47: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 48: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 49: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 50: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 51: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 2931

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Key recovery attack

IV

k oplus 120466120473120458120461

h

l

M0

x0 h

l

M1

x1h

l

M2

x2 x3l

|M|

h

g

1 Recover the state2 Build a multicollision 23l4 messages with the same x33 Query messages detect collisions g(x3 k oplusM) = g(x3 k oplusMprime)

Store (M oplusMprimeM) for 2l2 collisions4 Find collisions g(x3 x) = g(x3 xprime) offline

Store (x oplus xprime x) for 2l2 collisions5 Detect matchM oplusMprime = x oplus xprime With high probabilityM oplus k = x

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 52: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3031

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Conclusion

h

l

m0

x0 h

l

m1

x1h

l

m2

x2 x3MACk(M)

l

n

|M|

Ik

gk

New generic attacks against hash-based MACs (single-key)1 DistinguishingH attack in 2l2

Staterecovery attack in 2l2 times l Not harder than distinguishingR

2 Keyrecovery attack on HMACGOST in 23l4 Generic attack against hash functions with a checksum The checksum weakens the design

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 53: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3131

Introduction

New attacks

Key-recovery Attack on HMAC-GOST

Thanks

Questions

With the support of ERC project CRASH

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix
Page 54: New Generic Attacks on Hash-based MACs · UCL Crypto Group.. Microelectronics Laboratory G. Leurent. New Generic Attacks on Hash-based MACs. TCCM-CACR 2013. 2/31. Introduction

UCL Crypto GroupMicroelectronics Laboratory G Leurent

New Generic Attacks on Hash-based MACs TCCM-CACR 2013 3231

Comparison

Function Attack Complexity M len Notes

HMACMD5 distH st rec 297 2HMACSHA-0 distH 2100 2HMACHAVAL (3pass) distH 2228 2HMACSHA-1 62 mid steps distH 2157 2

Generic distH st rec O(2l2) 2l2

distH st rec O(2lminuss) 2s s le l4Generic checksum key recovery O(23l4) 2l4

HMACMD5 distH st rec 266 278 264

O(296) 232

HMACHAVAL (any) distH st rec O(2202) 254

HMACSHA-1 distH st rec O(2120) 240

HMACGOST keyrecovery 2200 264

MD5 GOST arbitrarylength SHA-1 HAVAL limited message length

  • Introduction
  • New attacks
  • Key-recovery Attack on HMAC-GOST
  • Appendix