Zh3R0 CTF+Shell CTF
Note : A JOURNEY TO GAIN KNOWLEDGE
I can not do both of challenges without my master support. Thanks a bunch LTTN <3.
#alice_bob_dave
from Crypto.Util.number import *
from secret import msg_a,msg_b
e=65537
p,q,r=[getStrongPrime(1024,e) for _ in range(3)]
pt_a=bytes_to_long(msg_a)
pt_b=bytes_to_long(msg_b)
n_a=p*q
n_b=p*r
phin_a=(p-1)*(q-1)
phin_b=(p-1)*(r-1)
d_a=inverse(e,phin_a)
d_b=inverse(e,phin_b)
ct_a=pow(pt_a,e,n_a)
ct_b=pow(pt_b,e,n_b)
print(f"{ct_a=}\n{ct_b=}\n{d_a=}\n{d_b=}\n{e=}")Idea : we can easily look that GCD of both polynomials is (p-1) ,we have to find MAX GCD of phi1 and phi 2 then brute force p-1 with k1*phi1 = e*d1-1 and k2*phi2 = e*d2-1 brute force to find MAX GCD of k1*phi1, k2*phi2 ,from p we easily brute force r and q
#Vul-AES
Connect to sever and type any character which you want Output : "xX+NDjg0X9tmJLobdQv9k9ds/4i9bLo8u6OoRjBMuldg6rjc+L5XlwAejtua+qoK" (may be different depending characters) key = b'sixteen byte key'
b'sixteen byte AESashell{kinda_sus}000000000000000'
Thanks for reading. Have a good day <3
Last updated
Was this helpful?