Coppersmith's attack

Coppersmith's attack describes a class of cryptographic attacks on the public-key cryptosystem RSA based on the Coppersmith method. Particular applications of the Coppersmith method for attacking RSA include cases when the public exponent e is small, when the private key d is small, or when partial knowledge of a prime factor of the secret key is available.

Overview

The public key in the RSA cryptosystem is a pair of integers (N,e), where N=pq is a product of two primes with Euler totient φ(N)=(p−1)(q−1), and e<φ(N) is chosen to be coprime with φ(N).

The secret key is given by an integer d satisfying ed≡1 (mod φ(N)). A message is an integer M<N (for example the binary representation of a string), and encryption produces a ciphertext C≡Me (mod N), which can be decrypted using d by computing M≡Cd(mod N). Such exponentiation may be performed by exponentiation by squaring and requires a number of arithmetic operations linear in the number of bits of e and d.

In order to improve encryption and decryption speeds, smaller values of e and d are desirable. A safe reduction which gives a mathematically equivalent and faster decryption algorithm is known as CRT-RSA. In this scheme, the secret is given by two smaller integers, dp≡d (mod p−1) and dq≡d (mod q−1). Encryption is performed as before, but decryption is formed by computing Mp=Cdp (mod p) and Mq=Cdq (mod q) and applying the Chinese remainder theorem to combine Mp,Mq into the message M.

Coppersmith's attack primarily concerns the case when the exponents e or d are chosen to be too small. For example, e is often chosen to be one of the Fermat primes 3,17 or 65537. Prime values for e are desirable because they can be quickly checked if they are coprime with φ(N), leading to faster key generation.

Employing small values of d leads to complete attacks such as Wiener's attack, a sort of instance of the Coppersmith method , while small values of e (such as e=3) still leads to attacks in certain situations. For example, the simplest possible instance of the attack would be when both e and the message M are too small, such as e=3 and M<N1/3. In this case, the ciphertext satisfies C=M3 as integers (not merely as a congruence), and the message M may be recovered as the integer cube root of C. The Coppersmith method generalizes this case by considering polynomials other than Me, such as those resulting from padding or polynomials on the public key itself.

Coppersmith's theorem

A simplified version of Coppersmith's theorem is stated as follows. All polynomials will be assumed to have integer coefficients, and we say a polynomial is monic modulo N if its leading coefficient is 1 mod N.

Let N be an integer. If f(x) is a polynomial of degree d which is monic modulo N, then the modular equation f(x)≡0 (mod N) may be efficiently solved for all "small" solutions x0, more precisely those satisfying |x0|<Nδ for a fixed δ<1/d.

Informally, in computational terms, if N is n bits long, then it is possible to efficiently recover the roots of a degree d polynomial modulo N whose bit length is less than n/d bits.

Note that we require the bound on logNx0 to be bounded away from 1/d. The closer this bound is to 1/d, the less efficient the method becomes.

All instances of Coppersmith's attack involve expressing the message, or an essential piece of information about the cryptosystem, as a small root for some modular polynomial equation. The Chinese remainder theorem may be employed to obtain equations with larger moduli, thus increasing the threshold on the small root condition in Coppersmith's theorem.

Håstad's broadcast attack

The simplest form of Håstad's attack is presented to ease understanding. The general case uses the Coppersmith method.

Suppose one sender sends the same message M to multiple people P1,P2,…,Pk, using distinct moduli N1,N2,…,Nk but the same small public exponent, say e=3. If Eve intercepts three of the ciphertexts (for e=3), then she may recover M efficiently.

Indeed, suppose Eve intercepts three of the ciphertexts, C1,C2,C3 satisfying Ci≡M3 (mod Ni). By the Chinese remainder theorem, she may combine these into an integer 0≤C<N1N2N3 satisfying C≡M3 (mod N1N2N3). Here we assume gcd⁡(Ni,Nj)=1, or else we may factor some Ni and compute M directly.

However, since M<Ni for each i, we have M3<N1N2N3. Therefore, the congruence implies an actual equality C=M3 over the integers, and Eve may efficiently compute the integer cube root of C to obtain the message M.

For larger values of e, the same method allows Eve to compute M with e ciphertexts by use of an integer root algorithm.

Generalization to linear pads

We still suppose the sender is sending M to multiple people, but now they pad the message by some different (but publicly known) amount for each recipient. Håstad also showed that such a scheme (or any scheme involving a fixed linear padding) does not protect against the above attack. Indeed, the polynomial Mie is now replaced by Ci=fi(M)e for some fixed linear functions fi based on the pads. For example, if M if m bits long, the padding may be fi(M)=i2m+M.

Given monic polynomials gi(x) satisfying gi(M)≡0 (mod Ni), we may construct a polynomial g(x) with degree equal to the maximum degree of the gi(x), such that g(M)≡0 (mod N‾) where N‾=N1⋯Nk, and is monic modulo N‾. Note that we may suppose the gi(x) are monic modulo Ni or else we may factorize Ni just like before. In our case, the polynomials have degree e, and if Eve obtains k>e such ciphertexts Ci, if M<Ni for all i then M<N‾1/k, so that Coppersmith's theorem applies with δ=1/k<1/deg(g) in order to recover M.

This attack suggests that randomized padding should be used in RSA encryption.

Coppersmith’s short-pad attack

Like Håstad’s attack, this attack exploits a weakness of RSA with public exponent e=3. Coppersmith showed that if randomized padding suggested by Håstad is used improperly, then RSA is not secure.

Suppose Bob sends a message M to Alice using a small random padding before encrypting it. An attacker, Eve, intercepts the ciphertext and prevents it from reaching its destination. Bob decides to resend M to Alice because Alice did not respond to his message. He randomly pads M again and transmits the resulting ciphertext. Eve now has two ciphertexts corresponding to two encryptions of the same message using two different random pads. Then Eve may recover the message if the padding is too small.

More precisely, suppose Eve intercepted two ciphertexts based on two random paddings: M1=2mM+r1 and M2=2mM+r2, with corresponding ciphertext Ci≡Mie (mod N). Then Eve can efficiently recover M if m<⌊log2(N)/e2⌋.

The key is to consider the two polynomials modulo N

g1(x)=xe−C1,g2(x,y)=(x+y)e−C2.

The point is that y will measure the difference in padding M2−M1=r2−r1. Supposing that y=Δ=M2−M1 was known, then M1 solves both xe−C1≡0 and (x+Δ)e−C2≡0 mod N, so that x−M1 divides both polynomials modulo N. One may then compute gcd⁡(xe−C1,(x+Δ)e−C2) using the Euclidean algorithm to recover M1 (this method is known as the Franklin-Reiter attack).

Therefore, we wish to find Δ=r2−r1. As g1(x) and g2(x,Δ) have the common root M1 (modulo N), the integer Δ is a root for the resultant f(y)=resx(g1(x),g2(x,y)) which has degree at most e2. Therefore, if m<⌊log2(N)/e2⌋ and ri<2m, we have |Δ|<2m<N1/e2, so that Coppersmith's theorem applies.

For example, if N is 1024 bits long and e=3, then the method applies for paddings less than 113 bits long. For this reason, it is recommended to use the value e=65537 which is completely resistant to this particular attack.

Multivariate case and small private key attacks

There are several different ways in which the Coppersmith method can be applied to polynomial equations in several variables, such as the common bivariate case f(x,y)=0.

  1. As in Coppersmith's short pad attack, Coppersmith's method may apply directly to a system of modular equations g1(x,y), g2(x,y)≡0 (mod N) with a common small root (x0,y0), by use of the resultant to reduce to the univariate case and then computing the gcd.
  2. In favorable circumstances, another approach by Coppersmith involves solving a single equation g(x,y)=0 for a small root (x0,y0) over the integers, by extending the equation to a system of equations and applying the LLL algorithm to get nontrivial equations with the same small root. Once another nontrivial equation is found, one can solve the system over the integers, using the resolvant and gcd as in the first approach. This method was employed by Coppersmith to factorize N when enough high-order bits of one of its primes are known.
  3. Finally, an approach heavily studied by May involves studying systems of modular polynomial equations gi(x,y)≡0 (mod N). In this case, just like in Coppersmith's method, one introduces extra polynomial equations with the same small root (x0,y0) and applies the LLL algorithm to produce equivalent polynomial equations g~i(x,y)≡0 (mod N) but with smaller coefficients. This allows one to remove the modulo condition if |g~i(x0,y0)|<N, and then solve the system with resultants as before. The method applies with more variables as well. It is possible for some resultant to be zero, for example if the polynomials are not algebraically independent, in which case the particular construction fails. However, it is often successful in practice.

The third approach is particularly useful and is currently the primary method of attack on small private keys. The "small roots" condition in this approach becomes more subtle to describe, since it depends on the lattice being reduced by the LLL algorithm. In general, larger collections of modular polynomial equations may produce higher dimensional lattices, allowing the LLL algorithm to produce smaller polynomials.

For example, it is possible to obtain Wiener's attack by applying the Coppersmith method to the system of linear polynomials

g1(x,y)=ex+y, g2(x,y)=Nx modulo N,

where if ed=kφ(N)+1 then (x0,y0)=(d,k(N−φ(N))−1) is a common root. More precisely, the two polynomials (with scaled coefficients) span a lattice, and the LLL algorithm is applied to obtain a linear polynomial g0(x,y) such that g0(x0,y0)=0 over the integers. This is used to prove that d may be recovered if d<13N1/4 as in Wiener's attack. Note that in this case, the LLL algorithm may be replaced by the very efficient Lagrange algorithm.

More sophisticated polynomial systems can be used to improve this bound to d<N0.292 (for suitably large N,e). In fact, even the CRT-RSA scheme can be broken in polynomial time with sophisticated lattices under the bounds dp,dq<N0.122. While these bounds are theoretical and are difficult to achieve in practice due to the practical limitations of lattice reduction algorithms, subsequent work has demonstrated attacks approaching or attaining such bounds. For full small private key attacks, a 2023 paper reported attacks reaching the theoretical bound d<N0.292 for 1024-bit moduli, and reaching d<N0.287 for 2048-bit moduli. For CRT-RSA, a 2025 practical benchmark demonstrated attacks reaching dp,dq<N0.067 and dp,dq<N0.0665 for 1000- and 2000-bit moduli respectively.

See also