Practical key recovery attack against APOP , an MD5 based - - PowerPoint PPT Presentation

practical key recovery attack against apop an md5 based
SMART_READER_LITE
LIVE PREVIEW

Practical key recovery attack against APOP , an MD5 based - - PowerPoint PPT Presentation

Practical key recovery attack against APOP , an MD5 based challenge response authentication. By Gaetan Leurent Presented by:- Guided By:- Raagi Sukhlecha Prof. Anish Mathuria Lalit Agarwal Outline Introduction APOP What is


slide-1
SLIDE 1

Practical key recovery attack against APOP , an MD5 based challenge response authentication. By Gaetan Leurent

Presented by:- Guided By:- Raagi Sukhlecha

  • Prof. Anish Mathuria

Lalit Agarwal

slide-2
SLIDE 2

Outline

  • Introduction
  • APOP – What is APOP and how does it work ?
  • MD-5 hashing algorithm
  • APOP Attack
  • Abstract
  • Wang’s attack on MD-5
  • Algorithm by Gaëtan Leurent
  • APOP Attack complexity
  • APOP in practice
slide-3
SLIDE 3

What is APOP ?

  • Improvement to POP 3 which supported plain – text password
  • APOP Provides simple challenges response authentication and

avoids passive eavesdropping attack .

  • It only does client authentication. No server authentication.

msg-id msg-id id , MD-5(msg-id || passwd)

slide-4
SLIDE 4

Example

According to RFC 1939 ,

  • 1. The challenge should be enclosed with in <> with exactly one@ in

between.

  • 2. The remaining characters should be ASCII.
  • 3. Inside the message-id, all characters are accepted, except:-

1. 0x00 Null 2. Ox3e Greater than Sign (‘>’) 3. Ox0a Line-Feed 4. Ox0d Carriage Return

Server 1 <11776027@pop.mail.com> 2 Alice ,MD5(‘<171.11776027@pop.mail.com>penguin’) 3 Mail box has 1 message

slide-5
SLIDE 5
  • Hashing algorithm; uses Merkle damgard construction
  • Message blocks of 512 bits and initialization vector IV of 128

bits.

  • Uses bitwise functions
  • additions mod 232 : +
  • Boolean functions: fi
  • Rotations : << si

MD-5 – Working

Consider a message M M padding b0| b1| b2….|bn where |bi | = 512 bits g - compression function

slide-6
SLIDE 6

MD-5 – Working (cont.)

g g g g …. IV b0 v0 b1 b2 bn v1 v2 v3 vn h(m) bi = m0| m1| m2….|m15 where |mi | = 32 bits 4 rounds of 16 steps = 64 steps

slide-7
SLIDE 7

Step Step 15 IV = Q-4 Q-1 Q-2 Q-3 π(0) Q0 Q15 Step 16 Q16 π) π(15) Round 0 Round 1 Step 48 Step 63 Q48 v1 π(63) π(48) Round 3 Where IV is broken into 4 32 bit words Q-4 Q-1 Q-2 Q-3 Qi is the output of each step i (0<= i <=63 )

slide-8
SLIDE 8

MD-5 – Working (cont.) - A MD-5 step

Ki ᴨ(i)

where

  • si and Ki as predefined

constant

  • π(i) is permutation applied to

input blocks

  • fi as functions defined as
slide-9
SLIDE 9

If Qi, Qi+1, Qi+2, Qi+3 are known, then we can compute Qi+4. Here we compute Q10 from Q6, Q7, Q8, Q9 and m10.

Basic Equation

slide-10
SLIDE 10

If Qi+1, Qi+2, Qi+3, Qi+4 are known, then we can compute Qi. Here we compute Q6 from Q7, Q8, Q9, Q10 and m10.

Basic Equation

slide-11
SLIDE 11

If Qi - Qi-4 are known then we can compute mi. Here we compute m10 from Q6 and Q10.

Basic Equation

slide-12
SLIDE 12

APOP Attack

  • Abstract
  • Wang’s Attack
  • Wang’s attack on MD-4 and MD-5
  • Problem with Wang’s attack
  • Algorithm by Gaëtan Leurent
  • Message freedom
  • APOP Attack Complexity
slide-13
SLIDE 13

Abstract of the attack

  • Goal:- To recover some characters of the client’s password
  • Attacker impersonates server and sends crafted challenge

Server Attacker

slide-14
SLIDE 14

Abstract of the attack (cont.)

  • Attacker sends challenges in such a way that hashed responses

will collide if the part of the password was rightly guessed

Attacker c c’ id , MD-5(c || passwd) id , MD-5(c’|| passwd)

slide-15
SLIDE 15

Attack

<?????????...........@ ………..????????????> …………..………../////////> <///////……………@ x x M = M’ = C = <?????...??> C’ = </////...//> Challenge ………..????????????> …………..………../////////> p0 p1 p2 p3……………….…pad <?????????...........@ <///////……………@ p0 p1 p2 p3……………….…pad H(M) = H(M’) R = MD-5 ( ) ) R’ = MD-5 ( R and R’ are equal if p0 = x To test the first password character, the attacker will construct pairs to test each of the 256 ASCII values . Note:- The collision is unlikely if p0 != x ? Block 1 Block 2

slide-16
SLIDE 16

Attack (cont.)

<?????????...........@ ………..???????????>p0 …………..………..//////>p0 <///////……………@ y y M = M’ = C = <???....?> C’ = <///...//> Challenge ………..????????????>p0 …………..………..//////>p0 p1 p2 p3……………….…pad <?????????...........@ <///////……………@ p1 p2 p3……………….…pad H(M) = H(M’) R = MD-5 ( ) ) R’ = MD-5 ( Both hashes collide if p1= y To test the second password character, pairs to test 256 ASCII values have to be constructed Block 1 Block 2

slide-17
SLIDE 17

Questions ?????

  • How can we fix the last message word ?
  • Does that mean that we can recover the entire message ? If

not how many characters can we recover .

  • What will be the time complexity of it ?
  • Can APOP be still used ?
  • APOP being an offline protocol , is this attack meaningful ?
slide-18
SLIDE 18

Wang’s Attack

  • In 2004, Xiaoyun Wang published a MD5 collision.

Did not reveal anything about the attack.

  • Determined two 1024-bit messages

M = (M0, M1) and M = (M0, M1) where M0’, M1’, M0, M1 are each 512-bit blocks. So that MD5 hashes of the two messages are the same

  • Reverse engineering – revealed many aspects of attack;

improvements in attack

slide-19
SLIDE 19

Wang’s Attack

Modular Difference, y Consider bytes y = 00010101 and y = 00000101 z = 00100101 and z = 00010101 Note that y  y = z  z = 00010000 = 24 Then wrt modular subtraction, these pairs are indistinguishable. Signed difference, y=y’-y Denote yi=1, yi=0 as “+” Denote yi=0, yi=1 as “” Denote yi=yi as “.” Consider bytes z = 10100101 and z = 10010101 Then z is “..+-....” It is more restrictive than modular subtraction.

slide-20
SLIDE 20

Wang’s Attack

  • Step 1: Specify Input Differential Pattern
  • Applies to input M and M’.
  • Uses Modular Difference.

M0 = M0  M0 = (0,0,0,0,231,0,0,0,0,0,0,215,0,0,231,0) M1 = M1  M1 = (0,0,0,0,231,0,0,0,0,0,0,215,0,0,231,0)

  • Note: M0 and M0 differ only in words 4, 11 and 14
  • Note: M1 and M1 differ only in words 4, 11 and 14
  • Now, we only need to find M. Then M can be determined by the

differential. M’0 = M0 + ΔM0 and M’1 = M1 + ΔM1

slide-21
SLIDE 21

Wang’s Attack

Identical MD5 value: 79054025255fb1a26e4bc422aef54eb4

slide-22
SLIDE 22

Wang’s Attack

  • Step 2: Specify Output Differential Pattern
  • Applies to intermediate values, Qi and Qi
  • Uses signed difference. Hence very restrictive.
  • Most mysterious part of the attack.
  • j determines the step number
  • Qi are outputs for M0
  • Wj are input (modular) differences
  • Output is output modular difference
  • Output is output signed (“precise”) difference
slide-23
SLIDE 23

Wang’s Attack

  • Step 3: Derive a set of sufficient conditions
slide-24
SLIDE 24

Wang’s Attack

  • Step 4: Find a set of messages which satisfy all the conditions in

step3.

  • Generate random 512-bit M0
  • Modify the message so that all the conditions hold.
  • Follow similar procedure to find M1
  • Compute M0 and M1 using

M’0 = M0 + ΔM0 and M’1 = M1 + ΔM1 Now H(M) = H(M’)

slide-25
SLIDE 25
  • Select a message mi
  • Compute the corresponding Qi
  • Modify Qi to satisfy the
  • conditions. Recompute mi

Message Modification Wang’s Approach to satisfy conditions in the first round

slide-26
SLIDE 26
  • Select a message mi
  • Compute the corresponding Qi
  • Modify Qi to satisfy the
  • conditions. Recompute mi

Message Modification Wang’s Approach to satisfy conditions in the first round

slide-27
SLIDE 27
  • Select a message mi
  • Compute the corresponding Qi
  • Modify Qi to satisfy the
  • conditions. Recompute mi

Message Modification Wang’s Approach to satisfy conditions in the first round

slide-28
SLIDE 28
  • Select a message mi
  • Compute the corresponding Qi
  • Modify Qi to satisfy the
  • conditions. Recompute mi

Message Modification Wang’s Approach to satisfy conditions in the first round

slide-29
SLIDE 29
  • Select a message mi
  • Compute the corresponding Qi
  • Modify Qi to satisfy the
  • conditions. Recompute mi

Message Modification Wang’s Approach to satisfy conditions in the first round

slide-30
SLIDE 30
  • Select a message mi
  • Compute the corresponding Qi
  • Modify Qi to satisfy the
  • conditions. Recompute mi

Message Modification Wang’s Approach to satisfy conditions in the first round

slide-31
SLIDE 31
  • Compute Qi.
  • Modify Qi and recompute mi
  • Recompute Qi’s and mi’s in the

first round.

Multi Message Modification Wang’s Approach to satisfy conditions in the second round

slide-32
SLIDE 32
  • Compute Qi.
  • Modify Qi and recompute mi
  • Recompute Qi’s and mi’s in the

first round.

Multi Message Modification Wang’s Approach to satisfy conditions in the second round

slide-33
SLIDE 33
  • Compute Qi.
  • Modify Qi and recompute mi
  • Recompute Qi’s and mi’s in the

first round.

Multi Message Modification Wang’s Approach to satisfy conditions in the second round

slide-34
SLIDE 34
  • Compute Qi.
  • Modify Qi and recompute mi
  • Recompute Qi’s and mi’s in the

first round.

Multi Message Modification Wang’s Approach to satisfy conditions in the second round

slide-35
SLIDE 35
  • Compute Qi.
  • Modify Qi and recompute mi
  • Recompute Qi’s and mi’s in the

first round.

Multi Message Modification Wang’s Approach to satisfy conditions in the second round

slide-36
SLIDE 36

Problem with Wang’s Attack

  • Due to the message modification technique, the colliding

block cannot be chosen and look random.

  • Hence there is no message freedom.
  • Also since the exact approach of this attack is not yet known,

it is not possible to establish an attack with a given message difference.

slide-37
SLIDE 37

Algorithm By Gaetan Leurent –

A New Approach to Collision Finding

  • We will assume that we are given the set of conditions on the

internal state variables Qi that produces collision.

  • We will try to find a message M such that when one computes

a hash of this message, the conditions on Qi’s hold.

slide-38
SLIDE 38

Tunnels

  • Introduced by V. Klima in 2005.
  • It speeds up the collision search
  • Point of verification (pv) is the step where we will start using tunnels.
  • Point of choice (pc) is the first step whose conditions will not be

satisfied deterministically.

  • A tunnel is a message modification technique that does not affect the

conditions upto pv-1 (point of verification).

slide-39
SLIDE 39

The Method

  • We will start fixing Qi from the middle. (will allow us to deal

with the first round and the beginning of the second round simultaneously)

  • We will choose the Qi’s till the step pc.
  • We will compute the Qi’s from the previous Qi’s for the steps

pc to pv.

  • Using the tunnels, we will try all possible messages that

satisfies all the conditions from pv till the end of the round.

slide-40
SLIDE 40

pc and pv in MD4

slide-41
SLIDE 41

Approach to satisfy condition in the first round

  • Choose Qi
  • Choose mi

Approach

slide-42
SLIDE 42

Approach to satisfy condition in the first round

  • Choose Qi
  • Compute mi

Approach

slide-43
SLIDE 43

Approach to satisfy condition in the first round

  • Choose Qi
  • Compute mi

Approach

slide-44
SLIDE 44

Approach to satisfy condition in the first round

  • Choose Qi
  • Compute mi

Approach

slide-45
SLIDE 45

Approach to satisfy condition in the first round

  • Choose Qi
  • Compute mi

Approach

slide-46
SLIDE 46

Approach to satisfy condition in the first round

  • Choose Qi
  • Compute mi

Approach

slide-47
SLIDE 47

Approach to satisfy condition in the second round

  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

New Method

slide-48
SLIDE 48
  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

Approach to satisfy condition in the second round

slide-49
SLIDE 49
  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

Approach to satisfy condition in the second round

slide-50
SLIDE 50
  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

Approach to satisfy condition in the second round

slide-51
SLIDE 51
  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

Approach to satisfy condition in the second round

slide-52
SLIDE 52
  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

Approach to satisfy condition in the second round

slide-53
SLIDE 53
  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

Approach to satisfy condition in the second round

slide-54
SLIDE 54
  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

Approach to satisfy condition in the second round

slide-55
SLIDE 55
  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

Approach to satisfy condition in the second round

slide-56
SLIDE 56
  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

Approach to satisfy condition in the second round

slide-57
SLIDE 57
  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

Approach to satisfy condition in the second round

slide-58
SLIDE 58
  • Choose the end of the first round.
  • Choose mi to satisfy both the

conditions.

  • Fill the first round.

Approach to satisfy condition in the second round

slide-59
SLIDE 59

Choosing a part of the message

slide-60
SLIDE 60

Choosing a part of the message

1) Choose the end of the message to be fixed. Here t=2.

slide-61
SLIDE 61

Choosing a part of the message

2) Choose the values Q12-t, Q13-t, Q14-t , Q15-t such that it satisfies the conditions. Here we choose the values Q10, Q11, Q12, Q13.

slide-62
SLIDE 62

Choosing a part of the message

3) Compute Q16-t. Here we compute Q14.

slide-63
SLIDE 63

Choosing a part of the message

4) Re-compute Q12-t. Check if condition on Q12-t holds

  • r not. If it does not hold, choose

another set of values for Q12-t, Q13-t, Q14-t , Q15-t.

slide-64
SLIDE 64

Choosing a part of the message

5) Compute the values Q17-t to Q16 Check conditions on them. If it does not hold, go to step 2. Here we compute Q15.

slide-65
SLIDE 65

Choosing a part of the message

6) Compute Q16 from m0. Re-compute m0 from Q16. Compute Q0 from m0. Conditions on Q0 and Q16 should hold true

slide-66
SLIDE 66

Choosing a part of the message

7) Fill the first round.

slide-67
SLIDE 67

Choosing a part of the message

8) Fill the first round.

slide-68
SLIDE 68

Choosing a part of the message

9) Compute Q17 from m4. Re-compute m4 from Q17. Compute Q4 from m4.

slide-69
SLIDE 69

Choosing a part of the message

10) Fill the first round.

slide-70
SLIDE 70

Choosing a part of the message

11) Fill the first round.

slide-71
SLIDE 71

Choosing a part of the message

12) Compute Q18 from m8. Re-compute m8 from Q18. Compute Q8 from m8.

slide-72
SLIDE 72

Choosing a part of the message

13) Fill the first round.

slide-73
SLIDE 73

Choosing a part of the message

14) Fill the first round.

slide-74
SLIDE 74

Choosing a part of the message

15) Compute Qi from pc (19) and to pv (24) using the previous Qi’s. If the condition on Qi does not satisfy then go to step 13. 16) Using tunnels, find a message which satisfies all Qi’s upto the end of the round.

slide-75
SLIDE 75

Message Freedom

  • Using this approach, one can choose:-
  • last three message words in a one-block MD4 collision
  • three specific message words on a two block MD5 collision.
  • Collision Search
  • First block computed only once: include ‘<‘ and ‘@’ .
  • For the second block:-
  • Avoid 4 characters (>, p0, p1, p2)
  • We can recover 3 characters of the password.
slide-76
SLIDE 76

Why only 3 words can be recovered in MD5?

  • For MD5, the Wang’s path uses a message difference in m14.
  • In order to learn ith password character, we need to generate a

collision where we fix the last i+1 characters (three characters

  • f the password and ‘>’)
  • Due to the message difference we cannot modify the message

m14 and hence can only recover 3 characters of a password.

slide-77
SLIDE 77

Attack Complexity

  • Assume, password is 8 char. long and each char. has 6 bits of

entropy.

  • Generate 3*25 collisions and wait for about 3*26

identifications.

  • If each collision takes 5 sec. to generate, then attack will take

about 3 hours.

Note : This is not clearly understood .

slide-78
SLIDE 78

APOP Attack in practice

  • More than 10% use POP ,out of which about 4% use APOP (not a negligible

number)

  • Some mail user agents give the freedom to select the authentication

method to the server – Attacker can claim to support only APOP

  • Colliding messages cannot be found for ASCII – but most of the mail clients

are non RFC-compliant and only check for only condition 1 & 3 on slide 5

Clients

Status Netscape/ Thunder bird / Mozilla Attack works Qualcomm Eudora Attack works Mutt Attack works Novell Evolution Attack works Fetchmail Attack works Kmail Attack Fails Microsoft Exchange/Outlook / Outlook express No APOP support Apple Mail No APOP support

slide-79
SLIDE 79

References

  • Slides - Message Freedom in MD4 and MD5 Collisions.

Application to APOP, Gaëtan Leurent

  • Ch5, Applied Cryptanalysis – Breaking ciphers in real world ,

Mark Stamp and Richard M. Low

  • Hashing in Computer Science ,Alan G.Konheim
  • Finding MD5 Collisions on a Notebook PC Using Multi-

message Modifications , Klima

  • Tunnels in Hash Functions: MD5 Collisions Within a Minute ,

Klima

  • Characterizing Padding Rules of MD Hash Functions ,

Preserving Collision Security , Mridul Nandi

  • Lecture slides of IT 325 , Winter 2012