Cryptography
Crypto challenges require you to break ciphers, identify weaknesses in custom implementations, and exploit mathematical flaws in everything from Caesar shifts to RSA, elliptic curves, and stream ciphers.
Cryptography is the science of securing information through mathematical transformations. It underpins everything from HTTPS and password storage to digital signatures and end-to-end messaging.
In security, the goal is often the opposite — breaking cryptographic schemes that are poorly designed or incorrectly implemented. Even mathematically sound algorithms can be vulnerable when developers misuse them.
In a CTF, you receive ciphertext, a public key, an encryption oracle, or a custom encryption script and must recover the plaintext flag. Challenges test your ability to spot mathematical weaknesses, abuse implementation mistakes, or apply known academic attacks.
Common workflow: identify the algorithm → check for known vulnerabilities (e.g. small RSA exponent, reused IV) → apply the appropriate mathematical attack using Python/SageMath → decrypt the flag.
Sample Challenge
e = 3.
You have the three ciphertexts c1, c2, c3 and their corresponding moduli n1, n2, n3.
The plaintext is short enough that m³ < n1·n2·n3.- Recognise the setup: same message, same
e=3, three different moduli — this is Håstad's broadcast attack. - Compute
C = CRT([c1,c2,c3], [n1,n2,n3])using the Chinese Remainder Theorem in Python (sympy.crtor manual implementation). - Take the integer cube root of
C:m = iroot(C, 3). - Convert the integer
mto bytes:long_to_bytes(m)from theCrypto.Util.numbermodule.