RSA Oracle: Chosen Ciphertext Attack
Exploiting an RSA decryption oracle by sending multiplied ciphertexts to circumvent equality checks and recover intercepted secrets.
Phase 1: Intercepted Ciphertexts & Oracle Behavior
An attacker intercepts two encrypted artifacts: `password.enc` and `secret.enc`. The server provides a decryption oracle that will decrypt any ciphertext provided by the user, except the exact intercepted password ciphertext `C_target`.
Phase 2: Homomorphic Malleability Exploitation
Because unpadded textbook RSA is multiplicatively homomorphic: - `E(m1) * E(m2) = (m1^e) * (m2^e) = (m1 * m2)^e = E(m1 * m2) (mod N)` We choose a multiplier `m_mult = 2`, encrypt it `c_mult = 2^e (mod N)`, and send `C' = C_target * c_mult (mod N)` to the oracle. The oracle decrypts `C'` to `2 * password (mod N)`. Dividing by `2` gives the original plaintext password!
Phase 3: Decrypting the Secret Flag
Using the decrypted password, we decrypt `secret.enc` with standard AES or OpenSSL to retrieve the final flag.