RSA is an asymmetric cryptosystem that used public and private key pairs.

  • Key Terms
  • Encrypt / Decrypt
  • Popular Tools
  • Known Vulnerabilities
    • Common Modulus

Key terms for crypto:

  • Ciphertext – the encrypted data.
  • Cipher – method of encrypting or decrypting data.
  • Plaintext – the data before encryption.
  • Encoding – a form of data representation, not encryption.
  • Key – a piece of information needed to decrypt.
  • Passphrase/password – used to protect a key.
  • Cryptanalysis – attacking cryptography with math.
  • Elliptic Curve Cryptography (ECC) – a more efficient encryption method than RSA.



  • n is the modulus, and it is common on public and private keys.
  • The public key is e and n.
    • e is the public exponent or encryption exponent.
  • The private key is d and n.
    • d is the private exponent or decryption exponent.


  • n = p * q
    • p and q are large prime numbers.
    • n is a number.
  • m is the message.
    • Not encrypted data.
  • c is the cyphertext.
    • Encrypted data.

The inverse is also true: the public key can decrypt if the data was encrypted with the private key.

Additionally: in a mod b = c, the value c is the reminder of the division of a by b.

Popular tools for solving RSA crypto challenges in CTFs.

  • RsaCtfTools [Link].
  • RSATools [Link].
  • Pem2John [Link] from JohnTheRipper [Link].
  • Ssh2John [Link] from JohnTheRipper.

Cracking the password/passphrase of an SSH private key with RSA encryption:

python3 id_rsa > id_rsa.hash
john --wordlist=/usr/share/wordlists/rockyou.txt id_rsa.hash


  • Common Modulus – It is a rare case in the real-world but popular in CTF and great for understanding the concepts of RSA [Link].

It requires knowing:

  • n
  • c1 and e1
  • c2 and e2
git clone
python3 RsaCtfTool/ --createpub -n MODULUS -e E1 >
python3 RsaCtfTool/ --createpub -n MODULUS -e E2 >
sed -i '1d'
sed -i '1d'

# From Hex to Base64
echo C1 | xxd -r -p | base64 > ct1.b64
echo C2 | xxd -r -p | base64 > ct2.b64

wget ""
python3 -h
python3 -c1 ct1.b64 -c2 ct2.b64 -k1 -k2