Attack on Broadcast RC4
Revisited
- S. Maitra1
- G. Paul2
- S. Sen Gupta1
1Indian Statistical Institute, Kolkata 2Jadavpur University, Kolkata
FSE 2011, Lyngby, Denmark 15 February 2011
Attack on Broadcast RC4 Revisited S. Maitra 1 G. Paul 2 S. Sen Gupta - - PowerPoint PPT Presentation
Attack on Broadcast RC4 Revisited S. Maitra 1 G. Paul 2 S. Sen Gupta 1 1 Indian Statistical Institute, Kolkata 2 Jadavpur University, Kolkata FSE 2011, Lyngby, Denmark 15 February 2011 Outline of the Talk Introduction Basics of RC4 Stream
1Indian Statistical Institute, Kolkata 2Jadavpur University, Kolkata
FSE 2011, Lyngby, Denmark 15 February 2011
Introduction Basics of RC4 Stream Cipher Motivation and Contribution Our Result: Bias of Output Bytes Computing the Bias Exploiting the Bias Attack on RC4 Broadcast Scheme Study: Non-Randomness of j Non-randomness in Different Rounds Conclusion Summary of the Paper
2 of 26
Introduction
Designed by Ron Rivest in 1987
Data Structure
S-array of size N = 256 bytes Key k of size 5 to 16 bytes Final key K of N = 256 bytes Two indices i and j Output: Stream of bytes
Photo: http://people.csail.mit.edu/rivest/
3 of 26
Introduction
Key Scheduling Algo (KSA) j = j + S[i] + K[i] 1 2 i j 254 255 · · · · · ·
4 of 26
Introduction
Key Scheduling Algo (KSA) j = j + S[i] + K[i] 1 2 i j 254 255 · · · · · · Pseudo-Random Gen. Algo (PRGA) j = j + S[i] 1 2 S[i] + S[j] i j 254 255 · · · Z · · · · · ·
4 of 26
Introduction
More than 20 years of cryptanalytic results
Finney Cycle [1994] Key-Output Correlation [Roos, 1995] [Paul & Maitra, 2007, 2008] Key-Permutation Correlation [Roos, 1995] [Paul & Maitra, 2007] Non-Randomness of Permutation [Mantin, 2001] Fault Attacks [Hoch & Shamir, 2004] [Mantin, 2005] [Biham et al, 2005] State Recovery [Knudsen et al, 1998] [Tomasevic et al, 2004] [Maximov, 2008] Non-random event: Glimpse Bias [Jenkins, 1996] 5 of 26
Introduction
More than 20 years of cryptanalytic results
Finney Cycle [1994] Key-Output Correlation [Roos, 1995] [Paul & Maitra, 2007, 2008] Key-Permutation Correlation [Roos, 1995] [Paul & Maitra, 2007] Non-Randomness of Permutation [Mantin, 2001] Fault Attacks [Hoch & Shamir, 2004] [Mantin, 2005] [Biham et al, 2005] State Recovery [Knudsen et al, 1998] [Tomasevic et al, 2004] [Maximov, 2008] Non-random event: Glimpse Bias [Jenkins, 1996] Distinguishing Attacks 5 of 26
Introduction
Goal: Find an event which occurs with different probability in RC4 than in case of a perfectly random source. Existing Distinguishers
Digraph Repetition Bias (Occurrence of ABTAB) [Mantin, 2001] Biased Second Output Byte (z2 = 0) [Mantin & Shamir, 2001] A set of new linear biases of RC4 [Sepehrdad et al, 2010] . . . a few more in this work 6 of 26
Introduction
FSE 2001. A Practical Attack on Broadcast RC4.
Main Claim: Pr(z2 = 0) ≈ 2
N (bias of second byte)
7 of 26
Introduction
FSE 2001. A Practical Attack on Broadcast RC4.
Main Claim: Pr(z2 = 0) ≈ 2
N (bias of second byte)
Two related claims
N at PRGA rounds 3 ≤ r ≤ 255.
N and Pr(zr = 0 | jr = 0) < 1 N for
3 ≤ r ≤ 255. These two biases, when combined, cancel each other to give no bias at zr = 0 for rounds 3 to 255.
7 of 26
Introduction
FSE 2011. Attack on Broadcast RC4 Revisited.
N at PRGA rounds 3 ≤ r ≤ 255.
Pr(zr = 0) ≈ 1
N for 3 ≤ r ≤ 255
Additional results exploiting the above bias
8 of 26
Introduction
FSE 2011. Attack on Broadcast RC4 Revisited.
N at PRGA rounds 3 ≤ r ≤ 255.
Pr(zr = 0) ≈ 1
N for 3 ≤ r ≤ 255
Additional results exploiting the above bias
N and Pr(zr = 0 | jr = 0) < 1 N for
3 ≤ r ≤ 255. These two biases, when combined, cancel each other to give no bias at zr = 0 for rounds 3 to 255. Further investigation of the events Careful analysis of non-randomness of j
8 of 26
Our Result: Bias of Output Bytes
9 of 26
Our Result: Bias of Output Bytes
Output bytes 3 to 255 are also biased to Zero
Theorem
For 3 ≤ r ≤ 255, the probability that the r-th RC4 keystream byte is equal to 0 is Pr(zr = 0) ≈ 1 N + cr N2 . where cr is given by N−1
N
r + N−1
N
N−r−1 − N−1
N
N−1 · N−1
N
r−2 −
1 N−1
10 of 26
Our Result: Bias of Output Bytes
Proposition (Jenkins’ Correlation)
After the r-th (r ≥ 1) round of the PRGA, Pr(Sr[jr] = ir − zr) = Pr(Sr[ir] = jr − zr) ≈ 2 N .
Corollary
After the r-th (r ≥ 1) round of the PRGA, Pr(zr = r − Sr−1[r]) ≈ 2
N .
11 of 26
Our Result: Bias of Output Bytes
Proposition (Jenkins’ Correlation)
After the r-th (r ≥ 1) round of the PRGA, Pr(Sr[jr] = ir − zr) = Pr(Sr[ir] = jr − zr) ≈ 2 N .
Corollary
After the r-th (r ≥ 1) round of the PRGA, Pr(zr = r − Sr−1[r]) ≈ 2
N .
How about Pr(Sr−1[r] = r)?
11 of 26
Our Result: Bias of Output Bytes
At the end of KSA, for 0 ≤ u ≤ N − 1, 0 ≤ v ≤ N − 1, Pr(S0[u] = v) = 1
N
N−1
N
v +
N−1
N
v N−1
N
N−u−1 v ≤ u Pr(S0[u] = v) = 1
N
N−1
N
N−u−1 + N−1
N
v v > u
12 of 26
Our Result: Bias of Output Bytes
At the end of KSA, for 0 ≤ u ≤ N − 1, 0 ≤ v ≤ N − 1, Pr(S0[u] = v) = 1
N
N−1
N
v +
N−1
N
v N−1
N
N−u−1 v ≤ u Pr(S0[u] = v) = 1
N
N−1
N
N−u−1 + N−1
N
v v > u Does this propagate to PRGA?
12 of 26
Our Result: Bias of Output Bytes
Mantin’s Observation: Bias for S0[r] = r Sr−1[r] = r may happen in two ways:
13 of 26
Our Result: Bias of Output Bytes
Mantin’s Observation: Bias for S0[r] = r Sr−1[r] = r may happen in two ways:
Lemma
For r ≥ 3, the probability that Sr−1[r] = r is Pr(Sr−1[r] = r) ≈ Pr(S0[r] = r) · N − 1 N r−1 − 1 N
N .
13 of 26
Our Result: Bias of Output Bytes
zr = 0 can be branched as follows:
Sr−1[r] = r (lemma) and zr = r − Sr−1[r] (Jenkin) Sr−1[r] = r (lemma) and zr = 0 (random) 14 of 26
Our Result: Bias of Output Bytes
zr = 0 can be branched as follows:
Sr−1[r] = r (lemma) and zr = r − Sr−1[r] (Jenkin) Sr−1[r] = r (lemma) and zr = 0 (random)
Hence the result: Pr(zr = 0) ≈ 1 N + cr N2 with cr = N−1
N
r + N−1
N
N−r−1 − N−1
N
N−1 N−1
N
r−2 −
1 N−1
14 of 26
Our Result: Bias of Output Bytes
max
3≤r≤255 cr = c3 = 0.98490994 and
min
3≤r≤255 cr = c255 = 0.36757467
1 N + 0.98490994 N2 ≥ Pr(zr = 0) ≥ 1 N + 0.36757467 N2
15 of 26
Our Result: Bias of Output Bytes
Number of trials = 1 Billion Key size = 16 Bytes
[Note: Sepehrdad et al (2010) do not cover these biases]
16 of 26
Our Result: Bias of Output Bytes
17 of 26
Our Result: Bias of Output Bytes
E occurs in X with probability p and in Y with probability p(1 + ǫ) implies a possible distinguisher with O(p−1ǫ−2) required samples. In case of our E : zr = 0 for 3 ≤ r ≤ 255,
Random source: p = 1
N
RC4 Keystream: p(1 + ǫ) = 1
N
N
Our Result: Bias of Output Bytes
E occurs in X with probability p and in Y with probability p(1 + ǫ) implies a possible distinguisher with O(p−1ǫ−2) required samples. In case of our E : zr = 0 for 3 ≤ r ≤ 255,
Random source: p = 1
N
RC4 Keystream: p(1 + ǫ) = 1
N
N
[Note: Mantin & Shamir (2001) distinguisher is much stronger]
18 of 26
Our Result: Bias of Output Bytes
Idea: Guess Sr−1[r] = r using output information zr = 0 Pr(Sr−1[r] = r | zr = 0) = Pr(Sr−1[r]=r)
Pr(zr=0)
· Pr(zr = 0 | Sr−1[r] = r) ≈ 2 · 1
N + cr N − cr N2
N
−1 ≥
2 N
19 of 26
Our Result: Bias of Output Bytes
Situation: Message M is broadcast to k parties (random keys) Attack: Reliably extract byte(s) of M from the k ciphertexts
20 of 26
Our Result: Bias of Output Bytes
Situation: Message M is broadcast to k parties (random keys) Attack: Reliably extract byte(s) of M from the k ciphertexts Mantin & Shamir (FSE 2001): Extract 2nd byte of M given k = Ω(N) We can extract bytes 3 to 255 of M given k = Ω(N3) Idea: r-th byte of M gets XOR-ed with zr, which is 0 most often.
20 of 26
Study: Non-Randomness of j
21 of 26
Study: Non-Randomness of j
Note that j1 = j0 + S0[i1] = 0 + S0[1] = S0[1], where S0 is the state array right after KSA is over. Pr(j1 = v) = Pr(S0[1] = v) =
1 N ,
v = 0
1 N
N
+ 1
N
N−1
N
N−2 , v = 1
1 N
N−1
N
N−2 + N−1
N
v , v > 1
22 of 26
Study: Non-Randomness of j
Note that j1 = j0 + S0[i1] = 0 + S0[1] = S0[1], where S0 is the state array right after KSA is over. Pr(j1 = v) = Pr(S0[1] = v) =
1 N ,
v = 0
1 N
N
+ 1
N
N−1
N
N−2 , v = 1
1 N
N−1
N
N−2 + N−1
N
v , v > 1 Clearly not random!
22 of 26
Study: Non-Randomness of j
Note that j2 = j1 + S1[i2] = S0[1] + S1[2] Pr(j2 = v) =
N−1
Pr(S0[1] = w) · Pr((S1[2] = v − w) | (S0[1] = w)) Case I. S0[1] = 2 ⇒ S1[2] = 2. Pr((S1[2] = v − 2) | (S0[1] = 2)) = 1 if v = 4,
Case II. S0[1] = 2 ⇒ S1[2] = S0[2]. Pr((S1[2] = v − w) | (S0[1] = 2)) = Pr(S0[2] = v − w).
23 of 26
Study: Non-Randomness of j
24 of 26
Study: Non-Randomness of j
Appl: Combine Jenkin’s bias Pr(Sr[ir] = jr − zr) = 2
N to get
Pr(S2[i2] = 4 − z2) ≈ 1 N + 4/3 N2
[Note: Sepehrdad et al (2010) do not cover this bias] [Note: j behaves almost random round 3 onwards]
24 of 26
Conclusion
This paper: Revisiting Mantin–Shamir paper from FSE 2001
NEW
A new class of distinguishers for RC4 Attack on RC4 broadcast scheme along this line Guessing related state information from keystream
NEW
Guessing related state information from keystream 25 of 26
Conclusion
26 of 26