Home
Writeups Misc About
Bespoke Padding

Bespoke Padding

This is a example of Franklin-Reiter attack on RSA. We can obtain two ciphertexts that correspond to the same plaintext encrypted with the same modulus, but padded differently. Denote the plaintext as m, the modulus N, the public exponent e, the ciphertexts c1 and c2, and the padding variables be a1,a2,b1,b2. We thus have the two polynomials with the common root of m:

p1(x)=(a1x+b1)ec1modN
p2(x)=(a2x+b2)ec2modN

Hence, if both polynomials have the root m, then they are both divisible by (xm). This means we can compute the greatest common divisor of polynomials of p1 and p2. The resulting polynomial's constant term (polynomial should be of the form xc) is thus our message.

Similar challenges that uses this idea can be found at this link. Again, a repeat that this attack appears in the RSA attack survey, Twenty Years of Attacks on the RSA cryptosystem.

Takeaway from the challenge is if we can obtain a bunch of linearly related messages under the same modulo, then Franklin-Reiter attack can be carried out.