Message Freedom in MD4 and MD5 Collisions. Application to APOP
Total Page:16
File Type:pdf, Size:1020Kb
Message Freedom in MD4 and MD5 Collisions. Application to APOP. Gaëtan Leurent Message Freedom in MD4 and MD5 Collisions. APOP Application to APOP. Description Attack MD4/MD5 Collisions Gaëtan Leurent The MD4 family Collisions: Wang’s Laboratoire d’Informatique de l’École Normale Supérieure, technique Revisiting Département d’Informatique, Wang 45 rue d’Ulm, Paris 75230 Cedex 05, France Message freedom [email protected] The APOP attack in practice Fast Software Encryption 2007 1 / 27 Message Freedom in Outline MD4 and MD5 Collisions. Application to APOP. Gaëtan 1 APOP Leurent Description APOP Attack Description Attack MD4/MD5 Collisions 2 MD4/MD5 Collisions The MD4 family Collisions: The MD4 family Wang’s technique Collisions: Wang’s technique Revisiting Wang Revisiting Wang Message freedom Message freedom The APOP attack in practice 3 The APOP attack in practice 2 / 27 Message Freedom in The Post Office Protocol MD4 and MD5 Collisions. Application to APOP. POP3 Gaëtan Leurent Standard protocol for remote access to a mailbox APOP RFC 1460,1725,1939 (first version 1993) Description Attack Supported by virtually every mail provider and every mail MD4/MD5 user agent Collisions The MD4 family Widely used (tend to be replaced by IMAP) Collisions: Wang’s technique Revisiting Wang Supported authentication command Message freedom USER/PASS: plaintext password The APOP attack in APOP: “secure” authentication practice AUTH: any IMAP authentication mechanism: Kerberos, GSS-API, S/Key, CRAM-MD5 3 / 27 Message Freedom in APOP authentication MD4 and MD5 Collisions. What is APOP? Application to APOP. Unilateral challenge-response authentication protocol Gaëtan k Leurent based on a MAC: h (m)= MD5(m||k) APOP Server Client Description Attack MD4/MD5 Collisions id ⇒ p id, p The MD4 family Collisions: Wang’s Challenges form: <[email protected]> technique Revisiting Wang Origin authentication and replay protection Message freedom The APOP attack in First remarks practice hk (m)= MD5(m||k) is not a secure MAC: offline collisions and envelope attack. The protocol allows chosen-text attack. There should be some client-chosen randomness. 4 / 27 Message Freedom in APOP authentication MD4 and MD5 Collisions. What is APOP? Application to APOP. Unilateral challenge-response authentication protocol Gaëtan k Leurent based on a MAC: h (m)= MD5(m||k) c APOP Server Client Description Attack id, MD5(c||pwd) MD4/MD5 Collisions The MD4 family Collisions: Wang’s Challenges form: <[email protected]> technique Revisiting Wang Origin authentication and replay protection Message freedom The APOP attack in First remarks practice hk (m)= MD5(m||k) is not a secure MAC: offline collisions and envelope attack. The protocol allows chosen-text attack. There should be some client-chosen randomness. 4 / 27 Message Freedom in APOP authentication MD4 and MD5 Collisions. What is APOP? Application to APOP. Unilateral challenge-response authentication protocol Gaëtan k Leurent based on a MAC: h (m)= MD5(m||k) c APOP Server Client Description Attack id, MD5(c||pwd) MD4/MD5 Collisions The MD4 family Collisions: Wang’s Challenges form: <[email protected]> technique Revisiting Wang Origin authentication and replay protection Message freedom The APOP attack in First remarks practice hk (m)= MD5(m||k) is not a secure MAC: offline collisions and envelope attack. The protocol allows chosen-text attack. There should be some client-chosen randomness. 4 / 27 Message Freedom in The APOP Attack MD4 and MD5 Collisions. Application to APOP. Attack setting Gaëtan Leurent Active attack: impersonate the server APOP Description Server Client Attack c MD4/MD5 ) pwd Collisions Attacker (c|| The MD4 family id, MD5 Collisions: Wang’s technique Revisiting Wang Message freedom No server authentication in POP. The APOP attack in Typical scenario: open WiFi network. practice We can use the client to log on the server and access the mails, but the password should still be safe... 5 / 27 Message Freedom in The APOP Attack MD4 and Basic idea MD5 Collisions. Application to APOP. Basic idea: use collisions Gaëtan Leurent c1 APOP h = MD5(c ||pwd) Description Attacker 1 1 Client Attack MD4/MD5 ? c2 Collisions h h The MD4 1 = 2 family h2 = MD5(c2||pwd) Collisions: Wang’s technique Revisiting Wang Message freedom Chosen message attack: craft challenges. The APOP attack in practice Choose the challenge size to isolate some part of the key in a block. Same idea as the key-recovery against the envelope method by Preneel and van Oorschot. 6 / 27 Message Freedom in The APOP Attack MD4 and Basic idea MD5 Collisions. Application to APOP. Recover the first password character Gaëtan Leurent If we have an MD5 collision with a specific format: APOP Description M = <‽‽‽ ‽‽@ ‽‽‽> x c1 = <‽‽‽...‽‽‽> Attack 1 MD4/MD5 ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ Collisions ‽ The MD4 M2 = < @ > x c2 = < ... > family Collisions: Wang’s technique We send c1 and c2 as challenges, and we get: Revisiting Wang Message freedom MD5 <‽‽‽ ‽‽@ ‽‽‽> p0 p1p2... pad The APOP attack in ‽ ‽ ‽ ‽ ‽ ‽ ‽ practice MD5 < ‽ @ > p0 p1p2... pad Both hashes collide if p0 = ‘x’ (unlikely if p0 6= ‘x’). We will repeat this with all ‘x’ until we find p0. 7 / 27 Message Freedom in The APOP Attack MD4 and Basic idea MD5 Collisions. Application to APOP. Recover the next password character Gaëtan Leurent Then we use collisions of the form: APOP Description M1 = <‽‽‽ ‽‽@ ‽‽‽> p0 y c1 = <‽‽‽...‽‽‽> Attack MD4/MD5 ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ ‽ Collisions M ‽ p0 y c < ... > The MD4 2 = < @ > 2 = family Collisions: Wang’s When we send the challenges c and c , we receive: technique 1 2 Revisiting Wang Message freedom MD5 <‽‽‽ ‽‽@ ‽‽‽> p0 p1 p2... pad The APOP ‽ ‽ ‽ ‽ ‽ ‽ ‽ attack in ‽ practice MD5 < @ > p0 p1 p2... pad Both hashes collide if p1 = ‘y’. We can recover the full password in linear time. 8 / 27 Message Freedom in Using Wang’s collision to attack APOP MD4 and MD5 Collisions. Application to APOP. Gaëtan Leurent What we need to attack APOP APOP We need collisions with control over the end of the last Description block. Attack MD4/MD5 Birthday paradox too expensive. Collisions The MD4 family Collisions: Wang’s Using Wang’s collisions technique Revisiting Wang Wang’s collisions look random. Message freedom Due to the message modifications, we loose control over The APOP attack in the message value. practice Modify Wang’s collision finding technique. 9 / 27 Message Freedom in Outline MD4 and MD5 Collisions. Application to APOP. Gaëtan Leurent 1 APOP APOP Description 2 Attack MD4/MD5 Collisions MD4/MD5 The MD4 family Collisions The MD4 Collisions: Wang’s technique family Collisions: Revisiting Wang Wang’s technique Revisiting Message freedom Wang Message freedom The APOP 3 The APOP attack in practice attack in practice 10 / 27 Message Freedom in The MD4 family MD4 and Compression function MD5 Collisions. Application to APOP. Compression Function Design Gaëtan Leurent mi APOP Davies-Meyer with a Description Attack Feistel-like cipher. MD4/MD5 Hi−1 Hi Collisions C The MD4 family Collisions: Wang’s technique Revisiting Wang Designed to be fast: 32 bit words, and operations available Message freedom in hardware: 32 The APOP additions mod2 : ⊞ attack in practice boolean functions: Φi rotations ≪ si Message expansion M = hM0, ...M15i 7→ hm0, ...m47/63i 4 words of internal state Qi updated in rounds of 16 steps 11 / 27 Message Freedom in Compression Function MD4 and MD5 Collisions. Application to APOP. MD4 Step Update Gaëtan Leurent Qi−4 Qi−3 Qi−2 Qi−1 APOP Description Φi Attack MD4/MD5 Collisions mi The MD4 family Collisions: Wang’s ki technique Revisiting ≪ Wang si Message freedom The APOP attack in practice Qi−3 Qi−2 Qi−1 Qi Qi = (Qi−4 ⊞ Φi (Qi−1, Qi−2, Qi−3) ⊞ mi ⊞ ki ) ≪ si 12 / 27 Message Freedom in Compression Function MD4 and MD5 Collisions. Application MD5 Step Update to APOP. Gaëtan Leurent Qi−4 Qi−3 Qi−2 Qi−1 APOP Φi Description Attack MD4/MD5 Collisions mi The MD4 family Collisions: ki Wang’s technique ≪ Revisiting si Wang Message freedom The APOP attack in practice Qi−3 Qi−2 Qi−1 Qi Qi = Qi−1 ⊞ (Qi−4 ⊞ Φi (Qi−1, Qi−2, Qi−3) ⊞ mi ⊞ ki ) ≪ si 13 / 27 Message Freedom in Collisions in MD4 and MD5 MD4 and MD5 Collisions. Application Wang in a nutshell to APOP. Gaëtan 1 Precomputation: Leurent Choose a message difference. APOP Compute a differential path. Description Attack Derive a set of sufficient conditions. MD4/MD5 2 Collision search: Collisions The MD4 Find a message that satisfies the set of conditions. family Collisions: Wang’s technique Revisiting Main result Wang Message freedom We know a difference ∆ and a set of conditions on the internal The APOP state variables Qi ’s, such that: attack in practice If all the conditions are satisfied by the internal state variable in the computation of H(M), then H(M)= H(M + ∆). 14 / 27 Message Freedom in Collision search MD4 and MD5 Q− Q Collisions. 4 12 Application Q−3 Q13 to APOP. Q−2 Q14 Gaëtan Q− Leurent 1 Q15 m0 1c Q0 m0 3c Q16 APOP m1 3c Q m4 3c Q Description 1 17 Attack m2 3c Q2 m8 3c Q18 MD4/MD5 m3 5c Q3 m12 2c Q19 Collisions m4 m1 The MD4 5c Q4 2c Q20 family m5 m5 Collisions: 5c Q5 1c Q21 Wang’s m m technique 6 6c Q6 9 2c Q22 Revisiting m m Wang 7 4c Q7 13 Q23 Message m8 4c Q8 m2 Q24 freedom m m The APOP 9 4c Q9 6 Q25 attack in m10 4c Q10 m10 Q26 practice m11 5c Q11 m14 Q27 m12 6c Q12 Goalm3 Q28 m m 13 6c Q13 Given the7 set of conditions,Q29 m14 6c Q m11 Q 14 find a message (here on30 MD4). m15 6c Q15 m15 Q31 15 / 27 Message Freedom in Collision search MD4 and MD5 Q− Collisions.