RSA is the most common public-key cryptosystem in CTFs. Understanding how it works and its common weaknesses is essential for crypto challenges. You don't need to be a mathematician - just know the attacks!
RSA security relies on the difficulty of factoring large numbers. When implemented correctly, it's secure. CTF RSA challenges always have implementation flaws to exploit!
How RSA Works
Key Insight
If you can factor n into p and q, you can compute d and decrypt anything! All RSA attacks ultimately try to factor n or exploit implementation mistakes.
Attack 1: Known Factorization
Attack 2: Small n
Attack 3: Small e (e=3)
Håstad's broadcast attack: If the same message is encrypted to multiple recipients with e=3 and different n values, use Chinese Remainder Theorem to recover m.
Attack 4: Common Factors
Attack 5: Wiener's Attack (Small d)
RsaCtfTool
RsaCtfTool is your first stop for RSA challenges. It automatically tries dozens of attacks. Only go manual if it fails!
Standard Decryption Script
Knowledge Check
Key Takeaways
- Always check factordb.com first - it's instant if n is factored
- Small e (especially e=3) enables cube root attack
- RsaCtfTool automates dozens of RSA attacks
- Common factors between two public keys = easy win
- Know the standard decrypt script by heart
- RSA math is simple: c=m^e mod n, m=c^d mod n