Description
This vault should unlock in a week - can you crack it faster, in time to submit the flag?
Attachments
https://imaginaryctf.org/f/XUw2X#vault.txt
https://imaginaryctf.org/f/N8V83#gen.py
Writeup
from Crypto.Util.number import *
exec('\n'.join(list(open('vault.txt'))[2:]))
fac = {
2:14,
3:12,
5:6,
7:1,
17:1,
19:2,
31:1,
41:1,
227:1,
433:1,
467:1,
2309:1,
5527:1,
13591:1,
36985379:1,
259726127:1,
481626029:1,
701899711:1,
927093907:1,
1392514213:1,
3492606209:1,
127172501513:1,
34926936182669:1,
36411945668431:1,
62634262995527:1,
}
diff = 95026205724
phi = 1
for key in fac:
phi *= key**(2*fac[key]) * (key-1)
e = pow(71, diff, phi)
print(long_to_bytes(pow(c, e, n)))
You can get the factors of p-1 and q-1 with a site like Alpertron, as all of them are relatively small. You can then use that to calculate phi and figure out the effective exponent after raising the ciphertext to 71 that many times.
Flag
ictf{just_another_rsa_problem_in_disguise_:<}