Overview
RSA cracking involves attacking weaknesses in RSA encryption implementations to recover plaintext or private keys. Common targets include small key sizes, weak prime generation, shared factors between keys, and low public exponents.
When To Use
- Target is using RSA encryption with potentially weak parameters
- CTF challenge involves encrypted data with an RSA public key provided
- Public key has unusual or small values for n, e, or d
Requirements
- RSA public key or ciphertext
- Knowledge of RSA parameters (n, e, c)
- Python or RSACTFTool installed
Attack Steps
- Extract RSA parameters from the public key (
n,e, ciphertextc) - Identify weakness — small
e, smalln, shared prime factors, or known attacks (Wiener, Hastad, etc.) - Use RSACTFTool to automatically attempt common attacks against the key
- If RSACTFTool fails, manually factor
nusing factordb.com or msieve - Reconstruct private key and decrypt ciphertext
Detection
- Monitoring for unusual key sizes or parameters during TLS inspection
- Use of deprecated or weak RSA key sizes (< 2048-bit)
Mitigation
- Use RSA key sizes of 2048-bit minimum; 4096-bit recommended
- Use modern alternatives like ECC (Ed25519) where possible
- Ensure strong prime generation during key creation
Related Knowledge
Related Playbook
Related Tools
- RSACTFTool
- RSATool