TL;DR
Classic Common Modulus attack. Two RSA ciphertexts c1, c2 were produced
with the same modulus n but coprime public exponents e1=65537,
e2=65539, over the same plaintext. Their exponents satisfy
a*e1 + b*e2 = 1, so the plaintext is recovered directly:
m = c1^a · c2^b mod n.
Given data (params.txt)
n = 16380649768533394557837493376413306403300053927332145442950164332328030751564185489519565597585555867737606727528343
e1 = 65537
e2 = 65539
c1 = 13717084049277399427945358975177210874446528287993178469838547381506741616766449871863462627142297960244208456711847
c2 = 4601321998457411971134687661444766716276847022305030736758227088246554672740623255330037934526510403437754437399162
Approach
- Confirm
gcd(e1, e2) = 1(both are primes, so yes). - Run the extended Euclidean algorithm to get
a, bwitha·e1 + b·e2 = 1. Result:a = 32769,b = -32768. - Compute
m = c1^a · c2^b (mod n), takingc2^basinverse(c2)^|b| mod nsinceb < 0. - Decode
mas big-endian bytes → flag.
Solve
1python3 solve.py
2# OWASP{v0rm1r_tw1st3d_rsa_l34ks_th3_s0ul}
Why it works
RSA encrypts c = m^e mod n. With two exponents on the same n and same m:
c1^a · c2^b = m^(a·e1 + b·e2) = m^1 = m (mod n).
No factoring required - the weakness is reusing one modulus with multiple
exponents over the same message.
Files
params.txt- challenge inputsolve.py- common-modulus recovery script