The Cryptography Handbook: Exploring RSA PKCSv1.5, OAEP, and PSS
The RSA algorithm was introduced in 1978 in the seminal paper, βA Method for Obtaining Digital Signatures and Public-Key Cryptosystemsβ. Over the decades, as RSA became integral to secure communications, various vulnerabilities and attacks have emerg...
In 1985, Johan HΓ₯stadβs highlighted the broadcast attack that illustrates the danger of a low exponent, e, when the same message is sent to multiple parties as a broadcast.
Imagine Alice wants to send the same plaintext message M to three different recipients. Each recipient has their own RSA public key with modulus N1β, N2β, N3β, but for speed all use e=3 (a common practice historically). Alice encrypts M with each public key, yielding ciphertexts:
Eve, who intercepts all three C1β, C2β, C3β can recover M without breaking any single RSA key.
Since each Niβ is different (and we assume they are pairwise coprime, as RSA keys should be), the attacker can use the Chinese Remainder Theorem (CRT) to combine the three congruences xβ‘Ciβ(modNiβ). Note that at this point Eve only has C1β, C2β and C3β. They do not have the plaintext M or M3 and yet they can reconstruct M3 with the intercepted data. To understand the Chinese Remainder Theorem and this reconstruction, you may follow this: CRT, RSA, and Low Exponent Attacks.
There is a unique solution modulo N1βN2βN3β for x, and that solution turns out to be an integer, x=M3 (because the true integer M3 is smaller than the product N1βN2βN3β of each M<Niβ). In essence, CRT lets Eve reconstruct M3 exactly. Once they have M3 as an ordinary integer, they simply take the cube root to find M. Thereβs no need to factor any modulus or invert the RSA function β the math falls out due to the low exponent.
The sequence diagram below aims to provide a high-level understanding of the attack:
Sequence Diagram: HΓ₯stadβs Broadcast Attack
Now letβs see this attack in action with a sample:
Suppose three different RSA public keys all use exponent e=3, with moduli nbβ=187 (for Bob), ncβ=115 (for Carol), and ndβ=87 (for Dave).
These niβ are pairwise coprime (gcd of each pair is 1). Now assume the same plaintext message M is encrypted with each public key. Letβs take a concrete M. For example with M=42, we will have:
So the three ciphertexts observed are 36, 28, and 51, respectively. Eve who knows nbβ, ncβ, ndβ and these ciphertexts can now recover M as follows:
Eve will compute the total modulus N=nbββ ncββ ndβ=187Γ115Γ87=1,870,935. (This is the modulus for the combined system of congruences).
Now Eve will compute the partial products for each congruence:
At this point, Eve needs the inverses of each Niβ modulo its corresponding niβ:
First Eve computes Mbβ=(Nbβ)β1modnbβ, i.e. the number Mbβ such that Nbββ Mbββ‘1(mod187). In this case, Nbβ=10005. Using the extended Euclidean algorithm, Eve can find Mbβ=2 (since 10005Γ2=20010β‘1(mod187)).
Then Eve computes Mcβ=(Ncβ)β1modncβ. Here Ncβ=16269. The inverse mod 115 turns out to be Mcβ=49 (For verification: 16269Γ49β‘1(mod115)).
Next up, Eve computes Mdβ=(Ndβ)β1modndβ. For Ndβ=21505, the inverse mod 87 is Mdβ=49 as well (coincidentally the same value in this case, since 21505Γ49β‘1(mod87)).
Now Eve reconstructs the combined value using the Chinese Remainder Theorem for three congruencies. The construction of this formula is beyond the scope of this handbook, but to completely understand how this springs into action, you may go through this video: CRT, RSA and Low Exponent Attacks.
Summing these gives a raw total of 7,20,360+2,23,21,068+5,37,40,995=7,67,82,423. Now reduce this modulo N=1,870,935:
Cβ‘7,67,82,423β(mod1,870,935)C=74,088β
Now Eve will simply take the cube root of C:374088β=42, which is the original plaintext. Eve has successfully recovered M.
The key takeaway from these attacks is that without proper defenses. RSA alone does not satisfy modern definitions of security. It is not resistant to chosen-plaintext or chosen-cipher text attacks. This gap between the theoretical one-way function (RSAβs trapdoor permutation) and a secure encryption scheme became evident as implementers found that naive RSA could be βbrokenβ by various clever tricks.
To counter these weaknesses, standards bodies introduced padding schemes to strengthen RSA encryption. In the following sections, you will learn about each of these paddings schemes and how theyβve been exploited over the years.