Open andresriancho opened 8 years ago
The main equation that drives this attack is as follows: c := is the character set of the target string n := is the total length of the target string
Brute Force:
c^n
trials
(usually infeasible to perform. Sometimes you need the earth time to break the system)
Timing Attack in a perfect environment:
c * n
(usually infeasible also due to noise)
Realistic Timing attack:
c^t * n/t * l
where t << n
and c^t
can be generated in reasonable time
l
is the number of trials needed to reduce the error of noise and distinguish between valid and invalid trial
By carefully selecting the t, a timing attack can be performed. t should be big enough to make statistical difference over the variance in network delay and small enough to execute the attack in reasonable time. Statistical approaches such as the null and alternative hypotheses are some of the means to analyze the timing attack results.
In this video they do talk about similar things: first attack with a known API key, analyze which statistical analysis model fits best, then try to guess new ones.
If in doubt just take more samples
The number of samples should also be part of the exploitation algorithm. More samples are going to increase precision.
What I would do is to start with a sample count of 1000 and see if I can discover the known differences in that scenario. If I'm unable to do so, then try with 5k, 10k, 25k.
Make the max number of samples 150k (by default) and let the user change it.
The timing attack algorithm should be able to discover a valid, hard-coded, API key with zero knowledge.
Some ideas:
0<padding>
...<padding>
f<padding>
<padding>
is not valid for any.00<padding>
...<padding>
ff<padding>
0123<bad-padding>
(0123 is known good chars)01234567<bad-padding>
(01234567 is known good chars)012<bad-padding>
, vs012345<bad-padding>
), if successful move to 2 known good, etc.