Coppersmith's attack

From HandWiki

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 or when partial knowledge of a prime factor of the secret key is available.

RSA basics

The public key in the RSA system is a tuple of integers (N,e), where N is the product of two primes p and q. The secret key is given by an integer d satisfying ed1(mod(p1)(q1)); equivalently, the secret key may be given by dpd(modp1) and dqd(modq1) if the Chinese remainder theorem is used to improve the speed of decryption, see CRT-RSA. Encryption of a message M produces the ciphertext CMe(modN), which can be decrypted using d by computing CdM(modN).

Low public exponent attack

In order to reduce encryption or signature verification time, it is useful to use a small public exponent (e). In practice, common choices for e are 3, 17 and 65537 (216+1). These values for e are Fermat primes, sometimes referred to as F0,F2 and F4 respectively (Fx=22x+1). They are chosen because they make the modular exponentiation operation faster. Also, having chosen such e, it is simpler to test whether gcd(e,p1)=1 and gcd(e,q1)=1 while generating and testing the primes in step 1 of the key generation. Values of p or q that fail this test can be rejected there and then. (Even better: if e is prime and greater than 2, then the test pmode1 can replace the more expensive test gcd(p1,e)=1.)

If the public exponent is small and the plaintext m is very short, then the RSA function may be easy to invert, which makes certain attacks possible. Padding schemes ensure that messages have full lengths, but additionally choosing the public exponent e=216+1 is recommended. When this value is used, signature verification requires 17 multiplications, as opposed to about 25 when a random e of similar size is used. Unlike low private exponent (see Wiener's attack), attacks that apply when a small e is used are far from a total break, which would recover the secret key d. The most powerful attacks on low public exponent RSA are based on the following theorem, which is due to Don Coppersmith.

Coppersmith method

Main page: Coppersmith method
Theorem 1 (Coppersmith)[1]
Let N be an integer and f[x] be a monic polynomial of degree d over the integers. Set X=N1dϵ for 1d>ϵ>0. Then, given N,f, attacker (Eve) can efficiently find all integers x0<X satisfying f(x0)0(modN). The running time is dominated by the time it takes to run the LLL algorithm on a lattice of dimension O(w) with w=min{1ϵ,log2N}.

This theorem states the existence of an algorithm that can efficiently find all roots of f modulo N that are smaller than X=N1d. As X gets smaller, the algorithm's runtime decreases. This theorem's strength is the ability to find all small roots of polynomials modulo a composite N.

Håstad's broadcast attack

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

Suppose one sender sends the same message M in encrypted form to a number of people P1;P2;;Pk, each using the same small public exponent e, say e=3, and different moduli Ni,e. A simple argument shows that as soon as k3 ciphertexts are known, the message M is no longer secure: Suppose Eve intercepts C1,C2, and C3, where CiM3(modNi). We may assume gcd(Ni,Nj)=1 for all i,j (otherwise, it is possible to compute a factor of one of the numbers Ni by computing gcd(Ni,Nj).) By the Chinese remainder theorem, she may compute CN1N2N3* such that CCi(modNi). Then CM3(modN1N2N3); however, since M<Ni for all i, we have M3<N1N2N3. Thus C=M3 holds over the integers, and Eve can compute the cube root of C to obtain M.

For larger values of e, more ciphertexts are needed, particularly, e ciphertexts are sufficient.

Generalizations

Håstad also showed that applying a linear padding to M prior to encryption does not protect against this attack. Assume the attacker learns that Ci=fi(M)e for 1ik and some linear function fi, i.e., Bob applies a pad to the message M prior to encrypting it so that the recipients receive slightly different messages. For instance, if M is m bits long, Bob might encrypt Mi=i2m+M and send this to the i-th recipient.

If a large enough group of people is involved, the attacker can recover the plaintext Mi from all the ciphertext with similar methods. In more generality, Håstad proved that a system of univariate equations modulo relatively prime composites, such as applying any fixed polynomial gi(M)0(modNi), could be solved if sufficiently many equations are provided. This attack suggests that randomized padding should be used in RSA encryption.

Theorem 2 (Håstad)
Suppose N1,,Nk are relatively prime integers and set Nmin=mini{Ni}. Let gi(x)/Ni[x] be k polynomials of maximum degree q. Suppose there exists a unique M<Nmin satisfying gi(M)0(modNi) for all i{1,,k}. Furthermore, suppose k>q. There is an efficient algorithm that, given Ni,gi(x) for all i, computes M.
Proof

Since the Ni are relatively prime the Chinese remainder theorem might be used to compute coefficients Ti satisfying Ti1(modNi) and Ti0(modNj) for all ij. Setting g(x)=Tigi(x), we know that g(M)0(modNi). Since the Ti are nonzero, we have that g(x) is also nonzero. The degree of g(x) is at most q. By Coppersmith’s theorem, we may compute all integer roots x0 satisfying g(x0)0(modNi) and |x0|<(Ni)1q. However, we know that M<Nmin<(Ni)1k<(Ni)1q, so M is among the roots found by Coppersmith's theorem.

This theorem can be applied to the problem of broadcast RSA in the following manner: Suppose the i-th plaintext is padded with a polynomial fi(x), so that gi=(fi(x))eiCimodNi. Then gi(M)0modNi is true, and Coppersmith’s method can be used. The attack succeeds once k>maxi(eidegfi), where k is the number of messages. The original result used Håstad’s variant instead of the full Coppersmith method. As a result, it required k=O(q2) messages, where q=maxi(eidegfi).[2]

Franklin and Reiter identified an attack against RSA when multiple related messages are encrypted: If two messages differ only by a known fixed difference between the two messages and are RSA-encrypted under the same RSA modulus N, then it is possible to recover both of them. The attack was originally described with public exponent e=3, but it works more generally (with increasing cost as e grows).

Let N;ei be Alice's public key. Suppose M1;M2N are two distinct messages satisfying M1f(M2)(modN) for some publicly known polynomial fN[x]. To send M1 and M2 to Alice, Bob may naively encrypt the messages and transmit the resulting ciphertexts C1;C2. Eve can easily recover M1;M2, given C1;C2, by using the following theorem:

Theorem 3 (Franklin–Reiter)[1]
Let N,e be an RSA public key. Let M1M2N* satisfy M1f(M2)(modN) for some linear polynomial f=ax+bN[x] with b0. Then, given N,e,C1,C2,f, attacker (Eve) can recover M1,M2 in time quadratic in elogN.
Proof

Since C1M1e(modN), we know that M2 is a root of the polynomial g1(x)=f(x)eC1N[x]. Similarly, M2 is a root of g2(x)=xeC2N[x]. Hence, the linear factor xM2 divides both polynomials. Therefore, Eve may calculate the greatest common divisor gcd(g1,g2) of g1 and g2, and if the gcd turns out to be linear, M2 is found. The gcd can be computed in quadratic time in e and logN using the Euclidean algorithm.

Coppersmith’s short-pad attack

Like Håstad’s and Franklin–Reiter’s attacks, 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 encryption 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.

Even though Eve does not know the random pad being used, she still can recover the message M by using the following theorem, if the random padding is too short.

Theorem 4 (Coppersmith)
Let N,e be a public RSA key, where N is n bits long. Set m=ne2. Let MN* be a message of length at most nm bits. Define M1=2mM+r1 and M2=2mM+r2, where r1 and r2 are distinct integers with 0r1,r2<2m. If Eve is given N,e and the encryptions C1,C2 of M1,M2 (but is not given r1 or r2), she can efficiently recover M.
Proof[1]

Define g1(x,y)=xeC1 and g2(x,y)=(x+y)eC2. We know that when y=r2r1, these polynomials have x=M1 as a common root. In other words, Δ=r2r1 is a root of the resultant h(y)=resx(g1,g2)N[y]. Furthermore, |Δ|<2m<N1e2. Hence, Δ is a small root of h modulo N, and Eve can efficiently find it using the Coppersmith method. Once Δ is known, the Franklin–Reiter attack can be used to recover M2 and consequently M.

See also

  • ROCA attack

References