On recent attacks against Cryptographic Hash Functions
Martin Ekerå & Henrik Ygge
1
On recent attacks against Cryptographic Hash Functions Martin Eker - - PowerPoint PPT Presentation
On recent attacks against Cryptographic Hash Functions Martin Eker & Henrik Ygge 1 Outline First part Preliminaries Which cryptographic hash functions exist? What degree of security do they offer? An
Martin Ekerå & Henrik Ygge
1
2
3
Symbol Meaning x ⊞ y Addition modulo 2n x ⊟ y Subtraction modulo 2n x ⊕ y Exclusive OR x ⋀ y Bitwise AND x ⋁ y Bitwise OR ¬ x The negation of x. x ≪ s Shifting of x by s bits to the left. x ⋘ s Rotation of x by s bits to the left.
4
Function IF (x, y, z) (x ⋀ y) ⋁ ((¬ x) ⋀ z) XOR (x, y, z) x ⊕ y ⊕ z MAJ (x, y, z) (x ⋀ y) ⋁ (y ⋀ z) ⋁ (z ⋀ x) XNO (x, y, z) y ⊕ ((¬ z) ⋁ x)
5
into elements of a fixed size domain.
6
Find m and m’ ≠ m such that H(m) = H(m’).
Given h find m such that h = H(m).
Given m find m’ ≠ m such that H(m) = H(m’).
7
Naïve complexity O(2n/2) due to the birthday paradox.
Naïve complexity O(2n)
Naïve complexity O(2n)
8
resistant, first pre-image resistant and second pre-image resistant.
9
encryption function E. s m E C
11
from a collision resistant compression function C. C m1 C m0 s0 s1 C mn-1 sn
12
H
1990
MD4 MD2
1989 collision found theoretical attack
RIPEMD
MD5
HAVAL-128 1992
SHA-1
1995
SHA-2
2002 RIPEMD-160 1996
SHA-3
2012 1993
SHA-0
time 13
14
15
E C
sj Yi
mσ(i)
Y47
mσ(47)
Y1
mσ(1)
Y0
mσ(0)
σ Mj
16
(512 bits) (128 bits)
m0 m1
m15
(32 bits)
sj+1
(128 bits)
a b c d Fi ki mσ(i) a b c d ri ⋘ Yi s
17
Round Step Fi ki 1 1 to 16 IF (a, b, c) 0x00000000 2 17 to 32 MAJ (a, b, c) 0x5A827999 3 33 to 48 XOR (a, b, c) 0x6ED9EBA1
18
19
20
a b c d a b c d Yi s
21
Fi ki mσ(i) ri ⋘
Round Step Fi 1 1 to 16 IF (a, b, c) 2 17 to 32 IF (c, a, b) 3 33 to 48 XOR (a, b, c) 4 49 to 64 XNO (a, b, c)
22
23
was becoming too short.
a brute force attack.
24
25
wi = mi
i < 16
wi-3 ⊕ wi-8 ⊕ wi-14 ⊕ wi-16
a b c d a b c d Yi s Fi ki mσ(i) ri ⋘
26
b c d e b c d e Yi s Fi ki wi ri ⋘ a a
27
b c d e b c d e Yi s Fi ki wi a a
28
b c d e b c d e Yi s Fi ki wi a a
29
⋘5 ⋘30
Round Step Fi ki 1 1 to 20 IF (b, c, d) 0x5A827999 2 21 to 40 XOR (b, c, d) 0x6ED9EBA1 3 41 to 60 MAJ (b, c, d) 0x8F1BBCDC 4 61 to 80 XOR (b, c, d) 0xCA62C1D6
30
with complexity O(261).
complexity to O(251).
hours on a 256 itanium processor cluster.
31
concerns voiced by NSA over a weakness in the message schedule.
the hash function.
32
33
wi = mi
i < 16
( wi-3 ⊕ wi-8 ⊕ wi-14 ⊕ wi-16 ) ⋘ 1
O(263) was presented by Wang et al. in 2005.
that the use of SHA-1 be discontinued by 2010 in favor of SHA-2.
34
35
Function Digest Length Message Block Length Steps Word Length Max Input Length SHA-224 224 bits 512 bits 64 32 bit 264 – 1 bits SHA-256 256 bits 512 bits 64 32 bit 264 – 1 bits SHA-384 384 bits 1024 bits 80 64 bit 2128 – 1 bits SHA-512 512 bits 1024 bits 80 64 bit 2128 – 1 bits 36
e f g h e f g h Yi s ki IF d d b c a b c a wi ∑1 ∑0
MAJ 37
38
software until the release of SHA-3, which is planned in 2012.
39
40
41 time
2008
2009
2010
algorithms for the standardization of SHA-3.
2007
2012
42
RIPEMD and HAVAL-128, as well as a new collision on MD4.
state differences propagate through the step functions.
SHA-1 reduced to 58 steps.
43
through the step function.
44
∂sj,1
sj,n + ∂sj,n + sj + ∂sj = sj+1 + ∂sj+1 sj,n + sj = sj+1
∂sj + ∂sj,n
σ Mj + ∂Mj σ Mj Y0 sj sj,1 Y0 sj + ∂sj sj,1 + ∂sj,1 Y1 Y1 sj,2 sj,2 + ∂sj,2
∂sj,2
Yi Yi Yn-1 Yn-1 sj,n sj,n + ∂sj,n
∂sj,n 45
in the intermediary states, for the differential path to hold.
for a message M that fulfills the conditions for the unperturbed left branch.
give the desired output difference.
46
47
a b c d a b c d Yi s
48
Fi ki mσ(i) ri ⋘
49
qi-1 qi-2 qi-3 qi-4 qi qi-1 qi-2 qi-3 Yi s Fi ki mσ(i) ri ⋘
qi = qi-1 ⊞ ( qi-4 ⊞ Fi (qi-1, qi-2, qi-3) ⊞ mσ(i) ⊞ ki ) ⋘ ri Ti
50
Round Step Fi 1 1 to 16 IF (qi-1, qi-2, qi-3) 2 17 to 32 IF (qi-3, qi-1, qi-2) 3 33 to 48 XOR (qi-1, qi-2, qi-3) 4 49 to 64 XNO (qi-1, qi-2, qi-3)
51
word is used exactly once in each round. Round Step i σ(i) 1 1 to 16 i-1 2 17 to 32 (5(i-1) + 1) mod 16 3 33 to 48 (3(i-1) + 5) mod 16 4 49 to 64 7(i-1) mod 16
52
Round Step i ri 1 1 to 16 7, 12, 17, 22, 7, 12, ... 2 17 to 32 5, 9, 14, 20, 5, 9, ... 3 33 to 48 4, 11, 16, 23, 4, 11, ... 4 49 to 64 6, 10, 15, 21, 6, 10, ...
53
54
∂s1
M0 C s0 s1 C s0 ⊞ ∂s0 s1 ⊞ ∂s1 C C s2 s2 ⊞ ∂s2
∂s2
C C C C sn sn ⊞ ∂sn
∂sn
M1 Mi Mn-1 M0 ⊞ ∂M0 M1 ⊞ ∂M1 Mi ⊞ ∂Mi Mn-1 ⊞ ∂Mn-1
55
∂s1
M0 C s0 s1 C s'0 s'1 C C s2 s'2
∂s2
C C C C sn s'n
∂sn
M1 Mi Mn-1 M'0 M'1 M'i M'n-1
representations ∆qi, which specify the bitwise difference.
∆qi [ j ] qi [ j ] q'i [ j ] . . 1 1 + 1
57
58
Function Absorbs Flip 1 Flip 2 Flip 3 IF Yes Maybe Maybe Maybe XOR No Yes No Yes XNO Yes Maybe Maybe Maybe
59
to absorb any single input bit differences.
60
61
62
qi = qi-1 ⊞ ( qi-4 ⊞ Fi (qi-1, qi-2, qi-3) ⊞ mσ(i) ⊞ ki ) ⋘ ri q'i = q'i-1 ⊞ ( q'i-4 ⊞ Fi (q'i-1, q'i-2, q'i-3) ⊞ m'σ(i) ⊞ ki ) ⋘ ri q'i = q'i-1 ⊞ ( q'i-4 ⊞ XOR (qi-1 ⊞ 231, qi-2 ⊞ 231, qi-3 ⊞ 231) ⊞ mσ(i) ⊞ ki ) ⋘ ri q'i = q'i-1 ⊞ ( q'i-4 ⊞ (qi-1 ⊕ 231) ⊕ (qi-2 ⊕ 231) ⊕ (qi-3 ⊕ 231) ⊞ mσ(i) ⊞ ki ) ⋘ ri q'i = q'i-1 ⊞ ( qi-4 ⊞ 231 ⊞ (qi-1 ⊕ qi-2 ⊕ qi-3) ⊞ 231 ⊞ mσ(i) ⊞ ki ) ⋘ ri q'i = qi-1 ⊞ 231 ⊞ ( qi-4 ⊞ (qi-1 ⊕ qi-2 ⊕ qi-3) ⊞ mσ(i) ⊞ ki ) ⋘ ri q'i = qi ⊞ 231
∂mσ(i) = 0 and ∂q'i-1 = ∂q'i-2 = ∂q'i-3 = ∂q'i-4 = 231 and Fi = XOR
63
∂q29 = ∂q30 = ∂q31 = ∂q32 = 0
∂qi = ... = ∂qi+3 = 231 at some point in the third round.
64
∂qi = ∂mσ(i) ⋘ ri = 231
∂qi = ∂qi-1 ⊞ ( ∂qi-4 ⊞ ∂Fi (qi-1, qi-2, qi-3) ⊞ ∂mσ(i) ) ⋘ ri ∂qi-1 = ∂qi-2 = ∂qi-3 = ∂qi-4 = 0 ∂qi+1 = ∂qi ⊞ ( ∂qi-3 ⊞ ∂Fi (qi, qi-1, qi-2) ⊞ ∂mσ(i+1) ) ⋘ ri+1 ∂qi+1 = 231 ⊞ ( 231 ⊞ ∂mσ(i+1) ) ⋘ ri+1 = 231 ∂qi+2 = ∂qi+1 ⊞ ( ∂qi-2 ⊞ ∂Fi (qi+1, qi, qi-1) ⊞ ∂mσ(i+2) ) ⋘ ri+2 ∂qi+2 = 231 ⊞ ( ∂mσ(i+2) ) ⋘ ri+2 = 231 ∂qi+3 = ∂qi+2 ⊞ ( ∂qi-1 ⊞ ∂Fi (qi+2, qi+1, qi) ⊞ ∂mσ(i+3) ) ⋘ ri+3 ∂qi+3 = 231 ⊞ ( 231 ⊞ ∂mσ(i+3) ) ⋘ ri+3 = 231 ⇒ ∂mσ(i+3) = 231 ⇒ ∂mσ(i) = 231 – ri ⇒ ∂mσ(i+1) = 231 ⇒ ∂mσ(i+2) = 0 65
IV unknown assume ∂q = 0 ∂q = 0 ∂q = 231 unknown Round 1 Round 2 Round 3 Round 4 66
the 31st bit but difficult to handle differences in other bits.
enter late into the fourth round.
67
Step i σ(i) ∂mσ(i) 33 5 34 8 35 11 215 36 14 231 37 1 38 4 231 39 7 40 10 41 13 42 43 3 44 6 45 9 46 12 47 15 48 2 Step i σ(i) ∂mσ(i) 49 50 7 51 14 231 52 5 53 12 54 3 55 10 56 1 57 8 58 15 59 6 60 13 61 4 231 62 11 215 63 2 64 9
Round 3 Round 4
(231, 231 ⊞ 225, 231 ⊞ 225, 231 ⊞ 225)
69
70
IV unknown assume ∂q = 0 ∂q = 0 ∂q = 231 slightly perturbed ∂q Round 1 Round 2 Round 3 Round 4 forward compute backward compute 71
∆qi–3, then we know the possible values of ∆Fi. 72
........ ......+. ......+. ........
∆qi-3 =
........ ......-. ......+. ........
∆qi-2 =
......+. ........ ........ ........
∆qi-1 =
........ ......±. ......+. ........
∆Fi =
fixed difference variable difference
±
73
........ ......+. ......+. ........
∆qi-3 =
........ ......-. ......+. ........
∆qi-2 =
......+. ........ ........ ........
∆qi-1 =
........ ......+. ......+. ........
∆Fi =
fixed difference variable difference 74
........ ......+. ......+. ........
∆qi-3 =
......^. ......-. ......+. ........
∆qi-2 =
......+. ......0. ........ ........
∆qi-1 =
........ ......+. ......+. ........
∆Fi =
fixed difference variable difference
75
Symbol Step i . qi = q'i 1 qi = q'i = 1 qi = q'i = 0 + qi = 0 and q'i = 1
^ qi = qi-1 and q'i = q'i-1 ! qi ≠ qi-1 and q'i ≠ q'i-1
76
∂Ti = ∂qi-4 ⊞ ∆Fi ⊞ ∂mσ(i)
∂qi = ∂qi–1 ⊞ (∂Ti ⋘ ri)
77
78
IV forward compute unknown backward compute assume ∂q = 0 ∂q = 0 ∂q = 231 slightly perturbed ∂q Round 1 Round 2 Round 3 Round 4 79
80
81
82
83
the negation of the encryption of the first block.
84
85
86
provided that qi-4 to qi-1 have been fixed. qi = qi-1 ⊞ ( qi-4 ⊞ Fi (qi-1, qi-2, qi-3) ⊞ mσ(i) ⊞ ki ) ⋘ ri mσ(i) = ((qi ⊟ qi-1) ⋙ ri) ⊟ qi-4 ⊟ Fi (qi-1, qi-2, qi-3) ⊟ ki
87
the sought BSDRs are indeed obtained in each step.
88
the differential path for the second block is constructed.
will increase with a factor 2m since we need to find ≈ 2m messages that pass the first path before we can start with the second block.
89
90
without recomputing all steps in rounds 2.
91
q9 = q8 ⊞ ( q5 ⊞ IF(q8, q7, q6) ⊞ m8 ⊞ k9 ) ⋘ r9 q10 = q9 ⊞ ( q6 ⊞ IF(q9, q8, q7) ⊞ m9 ⊞ k10 ) ⋘ r10 q11 = q10 ⊞ ( q7 ⊞ IF(q10, q9, q8) ⊞ m10 ⊞ k11 ) ⋘ r11 q12 = q11 ⊞ ( q8 ⊞ IF(q11, q10, q9) ⊞ m11 ⊞ k12 ) ⋘ r12 q13 = q12 ⊞ ( q9 ⊞ IF(q12, q11, q10) ⊞ m12 ⊞ k13 ) ⋘ r13
92
q9 = q8 ⊞ ( q5 ⊞ IF(q8, q7, q6) ⊞ m8 ⊞ k9 ) ⋘ r9 q10 = q9 ⊞ ( q6 ⊞ IF(q9, q8, q7) ⊞ m9 ⊞ k10 ) ⋘ r10 q11 = q10 ⊞ ( q7 ⊞ IF(q10, q9, q8) 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