Download presentation
Presentation is loading. Please wait.
Published byPiers Davidson Modified over 6 years ago
1
By Eliezer Yucht Prepared under the supervision of Prof. Dana Ron
Estimating Closeness to the Uniform Distribution on RC4 Keystream Bytes using Property Testing By Eliezer Yucht Prepared under the supervision of Prof. Dana Ron Project presentation 8 February, 2017 Tel Aviv University, Faculty of Engineering
2
Agenda Introduction + Background Estimating Closeness via Learning
RC4, WPA-TKIP and the πΏ 1 measure Estimating Closeness via Learning Uniformity testing Paninski test The collision tester Comparing the fingerprints Conclusion Tel Aviv University, Faculty of Engineering
3
The RC4 cipher RC4Β is a stream cipher that was designed by Ron Rivest in 1987. Very fast and simple in hardware and software. Used in many systems/protocols: WEP, WPA-TKIP (wireless networks), SSL and more. Tel Aviv University, Faculty of Engineering
4
The RC4 Algorithm The algorithm consists of 2 parts: The KSA
Key Scheduling Algorithm (KSA) Pseudo Random Generation Algorithm (PRGA) The KSA Tel Aviv University, Faculty of Engineering
5
The PRGA K is the next keying stream byte, and is XORed with the next plaintext byte to produce ciphertext byte. Tel Aviv University, Faculty of Engineering
6
Biases in the Keystream
Empirical distributions (obtained by , 16-byte keys) [AlFardan et al] 1 256 Tel Aviv University, Faculty of Engineering
7
Pr π 2 =0 β2β 2 β8 [Mantin & Shamir]
Pr π 1 = π 2 =0 β3β 2 β16 [Isobe et al] 1 256 Tel Aviv University, Faculty of Engineering
8
With further stream locations, the bias power is weakenedβ¦
1 256 Tel Aviv University, Faculty of Engineering
9
Transmitter MAC address
WPA-TKIP Interim solution to replace WEP TKIP per-packet key: Temp Shared Key (16 byte) Weakens Security: TSC-dependent (strong) biases in the keystream [Paterson et al] TSC (6 byte) Transmitter MAC address (6 byte) Key mix πΎ 0 = πππΆ 1 πΎ 1 = πππΆ 1 0π₯20)&0π₯7πΉ πΎ 2 = πππΆ 0 πΎ 2 πΎ 1 πΎ 0 16 bytes per-packet key Tel Aviv University, Faculty of Engineering
10
TKIP TSC-dependent biases
Keystream distribution at position 1 Tel Aviv University, Faculty of Engineering
11
Keystream distribution at positions 17 and 33
For πππΆ 0 , πππΆ 1 =(0π₯00,0π₯00) Tel Aviv University, Faculty of Engineering
12
Motivation Find which bytes locations in the stream are βgoodβ for encryption (i.e. relatively βcloseβ to the uniform distribution), versus βbadβ bytes (i.e. farther than some threshold from the uniform distribution). Using the πΏ 1 as a measure tool Working on pairs of consecutive keystream bytes How many samples do we need to distinguish between the above two cases? Tel Aviv University, Faculty of Engineering
13
The π³ π measure Let π,π be two (discrete) probability functions over the domain π·; then, the πΏ 1 distance between them is: π, π 1 = π₯ βπ· π π₯ βπ π₯ In our case: π π₯ ππ πππ ππ π‘βπ ππππππ€πππ 4 (πππππ‘) πππ π‘ππππ’π‘ππππ : π 1 , π 2 π 100 , π 101 ππΎ 1 , ππΎ π€βπππ (πππΆ 0 , πππΆ 1 =(0π₯00,0π₯πΉπΉ)) ππΎ 32 , ππΎ π€βπππ (πππΆ 0 , πππΆ 1 =(0π₯00,0π₯00)) Thus the domain size is π= 2 16 π π₯ ππ π‘βπ π’ππππππ πππ π‘ππππ’π‘πππ ππ£ππ π Therefore: π, π π 1 = π= β1 π π β 2 β16 π π π π+1 0x00-0xFF Range: [0, 2 16 β1=65,535] Tel Aviv University, Faculty of Engineering
14
Estimating Closeness via Learning
π, π π 1 = π= β1 π π β 2 β16 How to find π π , βπ β 0, 2 16 β1 β[ 2 16 ]? Need a Sample Accurately, needs samples infeasible Have to use approximate methods Draw π samples ( π₯ 1 , π₯ 2 ,β¦, π₯ π ) according to π For each domain elements π β[ 2 16 ], count how many times it appeared in the sample (denote this value by π¦ π ) π π β π¦ π π Tel Aviv University, Faculty of Engineering
15
Corollary (due the triangle inequality):
Theorem: For a sample size of π=π π π 2 , the following holds: π, π 1 β€π, with high probability Corollary (due the triangle inequality): If π=π π π 2 , then: max 0, π , π π 1 βπ β€ π, π π 1 β€ π , π π π In our case: π= 2 16 πβ€ 2 β9 (from our initial tests) Therefore, πβ₯ 2 37 Tel Aviv University, Faculty of Engineering
16
Simulation results For π= 2 37 Recall: Therefore: (π= 2 β9 )
max 0, π , π π 1 βπ β€ π, π π 1 β€ π , π π π Therefore: 0β€ π 100 , π 101 , π β€ β€ ππΎ 32 , ππΎ 33 , π β€ β€ π 1 , π 2 , π β€ β€ ππΎ 1 , ππΎ 2 , π β€ π , π π 1 Distribution learned ( π 1 , π 2 ) ( π 100 , π 101 ) ( ππΎ 1 , ππΎ 2 ) ( ππΎ 32 , ππΎ 33 ) Tel Aviv University, Faculty of Engineering
17
Execution time of about 10 days!
Simulation results For π= 2 38 (π= 2 β9.5 ) Recall: max 0, π , π π 1 βπ β€ π, π π 1 β€ π , π π π Therefore: 0β€ π 100 , π 101 , π β€ β€ ππΎ 32 , ππΎ 33 , π β€ β€ π 1 , π 2 , π β€ β€ ππΎ 1 , ππΎ 2 , π β€ π , π π 1 Distribution learned ( π 1 , π 2 ) ( π 100 , π 101 ) ( ππΎ 1 , ππΎ 2 ) ( ππΎ 32 , ππΎ 33 ) Execution time of about 10 days! (on a single CPU) Tel Aviv University, Faculty of Engineering
18
Addressing execution time
Distributed network For example 128 processors + threads Drawbacks: Requires a relatively large amount of resources Eventually the same (total) sample size Tolerant test βAcceptβ, if the πΏ 1 distance between the tested distribution and the uniform distribution is less than some predefined threshold π 1 . βRejectβ, if the πΏ 1 distance is greater than another predefined threshold π 2 , such that: 0 < π 1 < π 2 . In the general case, for a constant π, π=Ξ© π ππππ [Gregory and Paul Valiant] Uniformity testing βAcceptβ if the tested distribution is the uniform distribution. βRejectβ if its πΏ 1 distance is greater than π. It is known that π=π π π 2 is sufficient, but also required (π=Ξ© π π 2 ) [Paninski] Tel Aviv University, Faculty of Engineering
19
Paninski test The algorithm: Important observation:
The further a distribution is from the uniform distribution, the greater the number of collisions that will occur in its sample. The algorithm: Draw π=π π π 2 <π samples from the tested distribution π. Count how many bins have exactly one sample in them (denote this value by πΎ 1 ). If πΎ 1 < βsome_threshouldβ, βrejectβ (the hypothesis that π is the uniform distribution), otherwise, βacceptβ. Tel Aviv University, Faculty of Engineering
20
Paninski test results Using a sample size of 60,000 < 2 16
500 simulations πΈ π πΎ 1 =πβ πβ1 π πβ1 β
24,019 ππ‘π( πΎ 1 ) π΄π£π( πΎ 1 ) Distribution 126 23,846 ( ππΎ 1 , ππΎ 2 ) 128 23,989 ( π 1 , π 2 ) 116 24,017 ( ππΎ 32 , ππΎ 33 ) 129 24,019 ( π 100 , π 101 ) Tel Aviv University, Faculty of Engineering
21
The Collision Tester Counts the number of colliding pairs in the sample: πΆ π = π,π ; 1β€π<πβ€π; π₯ π = π₯ π Used for estimating the collision probability. Based on a similar observation as before; If πΆ π π 2 <"π πππ_π‘βπππ βπππβ, βacceptβ; otherwise βrejectβ. Works also in the general case. The sample size complexity: π=π π π [Goldreich and Ron] 2 Recently by [Diakonikolas et al] Tel Aviv University, Faculty of Engineering
22
The collision tester results
For π= 2 18 , 100 simulations After Zoom inβ¦ Tel Aviv University, Faculty of Engineering
23
For π= 2 20 Tel Aviv University, Faculty of Engineering
24
For π= 2 22 Less than 25 minutes
Tel Aviv University, Faculty of Engineering
25
The Fingerprint A fingerprint is a vector whose πth entry denotes
the number of domain elements that appear exactly π times in the sample. Can also be described as the histogram of the histogram For example Results of rolling a dice 10 times: (1,2,1,1,5,5,2,6,1,3) The histogram that depicts the results (over {1,2,β¦,6}): 4,2,1,0,2,1 The fingerprint obtained: 2,2,0,1 Tel Aviv University, Faculty of Engineering
26
The fingerprint (of a sample) contains all the information (collision statistics) that required for testing symmetric properties (such as the πΏ 1 distance from the uniform distribution). In particular, the number of colliding pairs can be retrieved from the fingerprint: πΆ π = π=2 π πΉ(π)β π 2 Tel Aviv University, Faculty of Engineering
27
Comparing the fingerprints
Using a sample size of π= 2 21 100 simulations Tel Aviv University, Faculty of Engineering
28
Tel Aviv University, Faculty of Engineering
29
Tel Aviv University, Faculty of Engineering
30
Tel Aviv University, Faculty of Engineering
31
Tel Aviv University, Faculty of Engineering
32
Tel Aviv University, Faculty of Engineering
33
Pr π 2 =0 β
2 256 Tel Aviv University, Faculty of Engineering
34
Pr ππΎ 1 =128 β
Tel Aviv University, Faculty of Engineering
35
Conclusion Learning the πΏ 1 distance between our 4 tested distributions and the uniform distribution requires about samples (about 10 days on a single CPU). Using the collision tester we managed to distinguish between all 4 distributions even with a sample size of samples (less than 25 minutes). The collision tester can be applied for testing other applications (not only in the RC4 context). Tel Aviv University, Faculty of Engineering
36
Questions? Tel Aviv University, Faculty of Engineering
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.