Implementation of Boneh and Durfee attack on RSA's low private exponents
I’ve Implemented a Coppersmith-type attack (using LLL reductions of lattice basis). It was done by Boneh and Durfee and later simplified by Herrmann and May. The program can be found on my github.
The attack allows us to break RSA and the private exponent d
.
Here’s why RSA works (where e
is the public exponent, phi
is euler’s totient function, N
is the public modulus):
The last equation gives us a bivariate polynomial \( f(x,y) = 1 + x \cdot (A + y) \). Finding the roots of this polynomial will allow us to easily compute the private exponent d
.
The attack works if the private exponent d
is too small compared to the modulus: \( d < N^{0.292} \).
To use it:
- look at the tests in boneh_durfee.sage and make your own with your own values for the public exponent
e
and the public modulusN
. - guess how small the private exponent
d
is and modifydelta
so you haved < N^delta
- tweak
m
andt
until you find something. You can use Herrmann and May optimizedt = tau * m
withtau = 1-2*delta
. Keep in mind that the bigger they are, the better it is, but the longer it will take. Also we must have1 <= t <= m
. - you can also decrease
X
as it might be too high compared to the root ofx
you are trying to find. This is a last recourse tweak though.
Here is the tweakable part in the code:
# Tweak values here !
delta = 0.26 # so that d < N^delta
m = 3 # x-shifts
t = 1 # y-shifts # we must have 1 <= t <= m