new attacks on the concatenation
play

New Attacks on the Concatenation and XOR Hash Combiners Itai Dinur - PowerPoint PPT Presentation

New Attacks on the Concatenation and XOR Hash Combiners Itai Dinur Ben-Gurion University, Israel Cryptographic Hash Functions A cryptographic hash function is hash function H:{0,1}*-> {0,1} n with strong requirements : Collision


  1. New Attacks on the Concatenation and XOR Hash Combiners Itai Dinur Ben-Gurion University, Israel

  2. Cryptographic Hash Functions • A cryptographic hash function is hash function H:{0,1}*-> {0,1} n with strong requirements : • Collision resistance : It is hard to find M and M ’ such that M ≠ M ’ and H(M)=H(M’) • Preimage resistance : Given an arbitrary n-bit string Y, it is hard to find any M such that H(M)=Y • Second preimage resistance : Given an arbitrary input M, it is hard to find M ≠ M ’ such that H(M)=H(M’)

  3. Hash Functions Collision Preimage Second Preimage Resistance Resistance Resistance 2 n/2 2 n 2 n Ideal H

  4. Concatenating Hash Functions • Assume we have 2 hash function H 1 and H 2 of n bits • We want a stronger construction • Define a new hash function H 1 ǁH 2 (H 1 ǁH 2 )(M)= H 2 (M) H 1 (M) n n

  5. Hash Functions Collision Preimage Second Preimage Resistance Resistance Resistance 2 n/2 2 n 2 n Ideal H 2 n 2 2n 2 2n Ideal H 1 ǁH 2

  6. Hash Functions in Practice Apply a compression function h: {0,1} n x {0,1} b -> {0,1} n • in an iterated way • A standard way of building a hash function is the Merkle- Damg̊ ard construction • Used in SHA-1, SHA-2 ,… m b x h h(x,m) n n

  7. Iterated Hash Functions • The Merkle- Damg̊ ard Construction: • 1) Pad the message M to a multiple of b (with 1, and as many 0 ’s as needed and the length of the message ) • 2) Divide the padded message into blocks m 1 m 2 ...m L pad |M| M m L m 1 m 2 … b b b

  8. Iterated Hash Functions • The Merkle- Damg̊ ard Construction: • 1) Pad the message M to a multiple of b (with 1, and as many 0 ’s as needed and the length of the message ) • 2) Divide the padded message into blocks m 1 m 2 ...m L • 3) Set x 0 = IV. For i=1 to L, compute x i =h(x i − 1 ,m i ) • 4) Output x L m 1 m 2 m L-1 m L h IV h … h h x 0 x L-2 x 1 x 2 x L-1 x L

  9. In This Work • Analyze the security of Merkle-Damg ̊ ard • We assume that the compression function is ideal (acts as a random oracle ) • Focus on the concatenation of two Merkle- Damg̊ ard hash functions MD H 1 ǁH 2 m 1 m 2 m L-1 m L h IV h … h h x 0 x L-2 x 1 x 2 x L-1 x L

  10. Hash Functions (2003) Collision Preimage Second Preimage Resistance Resistance Resistance 2 n/2 2 n 2 n Ideal H 2 n/2 2 n 2 n MD H 2 n 2 2n 2 2n Ideal H 1 ǁH 2 2 n 2 2n 2 2n MD H 1 ǁH 2

  11. Hash Functions (Joux, 2004) Collision Preimage Second Preimage Resistance Resistance Resistance 2 n/2 2 n 2 n Ideal H 2 n/2 2 n 2 n MD H 2 n 2 2n 2 2n Ideal H 1 ǁH 2 2 n 2 2n 2 2n MD H 1 ǁH 2 ≈2 n/2 ≈2 n ≈2 n

  12. Hash Functions (Kelsey and Schneier, 2005) Collision Preimage Second Preimage Resistance Resistance Resistance 2 n/2 2 n 2 n Ideal H 2 n/2 2 n 2 n MD H 2 n 2 2n 2 2n Ideal H 1 ǁH 2 2 n 2 2n 2 2n MD H 1 ǁH 2 ≈2 n/2 ≈2 n ≈2 n

  13. Second Preimage Attack on MD • Given a (padded) message M=m 1 ǁm 2 ǁ…ǁm L • We want to find M’ such that H(M’)=H(M) • Start from IV and try different m’ until h(IV,m ’)=x i • Every trial succeeds with probability L/2 n • Succeeds after 2 n /L trials • Output m’ǁm i+1 ǁ…ǁm L • Problem: foiled by MD message length padding m 1 m 2 m L m i+1 h … IV h … h h x 0 x 1 x 2 x i x i+1 x L-1 x L m’ h IV x 0

  14. Second Preimage Attack on MD • Solution of Kelsey and Schneier (2005): • Build an expandable message • Start from IV and try different m’ until h(x,m ’)=x i m 1 m 2 m L m i+1 h IV h … … h h x 0 x 1 x 2 x L-1 x L x i x i+1 m’ IV h x

  15. Second Preimage Attack on MD • Solution of Kelsey and Schneier (2005): • Build an expandable message • Start from IV and try different m’ until h(x,m ’)=x i • Select message of appropriate length • Total complexity: 2 n /L m 1 m 2 m L m i+1 h IV h … … h h x 0 x 1 x 2 x L-1 x L x i x i+1 m’ h IV x

  16. Hash Functions (2005) Collision Preimage Second Preimage Resistance Resistance Resistance 2 n/2 2 n 2 n Ideal H 2 n/2 2 n 2 n MD H 2 n /L 2 n 2 2n 2 2n Ideal H 1 ǁH 2 2 n 2 2n 2 2n MD H 1 ǁH 2 ≈2 n/2 ≈2 n ≈2 n

  17. Hash Functions (2015) Collision Preimage Second Preimage Resistance Resistance Resistance 2 n/2 2 n 2 n Ideal H 2 n/2 2 n 2 n MD H 2 n /L 2 n 2 2n 2 2n Ideal H 1 ǁH 2 2 n 2 2n 2 2n MD H 1 ǁH 2 ≈2 n/2 ≈2 n ≈2 n <<2 n (for long messages) • MD H 1 ǁH 2 is weaker than ideal H !

  18. Second Preimage Attack on Concatenated MD • A second preimage for H 1 ǁH 2 : • Given M, find M’ such that H 1 (M’)=H 1 (M) and H 2 (M ’)= H 2 (M) • We want an algorithm more efficient than 2 n

  19. Second Preimage Attack on Concatenated MD • Given a (padded) message M=m 1 ǁm 2 ǁ…ǁm L • Require: h 1 (x,m ’ )=x i and h 2 (y,m ’ )=y i • Every trial succeeds with probability L/2 2n Attack succeeds after 2 2n /L > 2 n trials (L<2 n ) • • Standard approach is inefficient m 1 m 2 m L m i+1 h 1 h 1 IV 1 … h 1 h 1 … x 0 x 1 x 2 x i x i+1 x L-1 x L m 1 m 2 m L m i+1 h 2 h 2 IV 2 … h 2 … h 2 y 0 y 1 y 2 y i y i+1 y L-1 y L m’ h 1 IV 1 x m’ h 2 IV 2 y

  20. A Different Approach • We will select a single target (x i ,y i ) that is much easier to hit with a specially crafted message w 1 ǁ…ǁw j • Define: h*(x,w 1 ǁ…ǁw j )= h(… h(h(x,w 1 ),w 2 )…) • * (y,w 1 ǁ…ǁw j )=y i Require: h 1 *(x,w 1 ǁ…ǁw j )=x i and h 2 m 1 m 2 m L m i+1 IV 1 h 1 h 1 … h 1 … h 1 x 0 x 1 x 2 x i x i+1 x L-1 x L m 1 m 2 m L m i+1 IV 2 h 2 h 2 … h 2 h 2 … y 0 y 1 y 2 y i y i+1 y L-1 y L w 1 ǁ…ǁ w j IV 1 h 1 * x w 1 ǁ…ǁ w j h 2 * IV 2 y

  21. A Different Approach • Fix to 0 the message block input to h • Define f(x)=h(x,0) • f(x) is a mapping from n bits to n bits • Such mappings are often used in cryptanalysis (e.g., Hellman’s time -memory tradeoff ) 0 x h h(x,0) x f(x) f

  22. A Different Approach • Define a graph : • Nodes are the states • There is an edge from x to y if f(x)=y y x f • f can be iterated f(…f(f(x))…) • Interested in states obtained after applying f many times x f f f f …

  23. Deep Iterates Let D≤ 2 n/2 be a parameter • • Definition: A deep iterate is a node of depth (at least) D in the graph x f f f f … D

  24. Second Preimage Attack on Concatenated MD • Define f 1 (x)=h 1 (x,0) and f 2 (y)=h 2 (y,0) • Target: x i deep iterate in f 1 and y i deep iterate in f 2 • Require: h 1 *(x,w 1 ǁ…ǁw j )=x i and h 2 *(y,w 1 ǁ…ǁw j )=y i m 1 m 2 m L m i+1 IV 1 h 1 h 1 … h 1 … h 1 x 0 x 1 x 2 x i x i+1 x L-1 x L m 1 m 2 m L m i+1 IV 2 h 2 h 2 … h 2 h 2 … y 0 y 1 y 2 y i y i+1 y L-1 y L w 1 ǁ…ǁ w j IV 1 h 1 * x w 1 ǁ…ǁ w j h 2 * IV 2 y

  25. Deep Iterates • Develop an algorithm that given arbitrary states x, y and a deep iterates x’ , y’ , finds w 1 ,…, w j such that h 1 *(x, w 1 ǁ…ǁw j )=x’ and h*(y, w 1 ǁ…ǁw j )=y’ with less than 2 n work For arbitrary nodes x ’ , y’ this requires 2 2n work ! • w 1 ǁ…ǁ w j h 1 * x’ x w 1 ǁ…ǁ w j h 2 * y ’ y

  26. The Algorithm • Algorithm: for different w 1 values, evaluate messages of the form w 1 ǁ 0 …ǁ 0 from x and y • Store all encountered states • Stop on a collision with a previous evaluated state (look ahead) • Repeat until success: • h 1 *(x, w 1 ǁ 0 …ǁ 0 )= x’ and h*(y, w 1 ǁ 0 …ǁ 0 )= y’ with same message length x’ f 1 f 1 f 1 f 1 b 1 x 1 f 1 x 2 x 6 f 1 f 1 x 3 f 1 x 4 x 5 f 1 h 1 x f 1 y ’ f 2 f 2 f 2 f 2 b 1 y 2 y 1 y 3 f 2 f 2 h 2 y f 2

  27. The Algorithm x’ b 1 x y ’ b 1 y

  28. The Algorithm x’ b 2 x y ’ b 2 y

  29. The Algorithm x’ 1 3 2 4 b 3 x y ’ 2 1 3 6 5 4 b 3 y

  30. The Algorithm x’ 1 5 4 2 4 3 b 4 x y ’ 2 1 3 4 5 6 5 4 b 4 y

  31. The Algorithm • Algorithm: Evaluate messages of the form w 1 ǁ 0 …ǁ 0 from x and y until a collision with a previous evaluated state • Reason for efficiency : “ look ahead ” • Related to recent attacks on HMAC w 1 ǁ0…ǁ 0 h 1 * x’ x w 1 ǁ 0 …ǁ 0 h 2 * y ’ y

  32. Conclusions • We showed that concatenation of two Merkle- Damg̊ ard hash functions is weaker than a single ideal hash function • Tradeoff between message length and complexity : • Faster than 2 n for messages of length ≥ 2 2n/7 • Optimal complexity is 2 3n/4 • Attacks are not practical (for hash functions used in practice n≥ 160) • Give new insight into the security of hash functions • New application of random mappings to cryptanalysis of concatenated hash functions • Also give improved preimage attack for the XOR combiner of MD H 1 ⊕ H 2

  33. Thanks for your attention!

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend