Weak RSA
This crypto challenge is also relatively straightforward, it's a copy of another crypto challenge.
We are given a Public Key and an enciphered message, we can use the RsaCtfTool.py and it somehow manages to derive the private key from the public key, and then decipher the encrypted message using this private key.
ubuntu@ip-10-0-0-35:~/htb/RsaCtfTool$ python3 RsaCtfTool.py --publickey ../pubkey.pem --uncipherfile ../flag.enc
private argument is not set, the private key will not be displayed, even if recovered.
[*] Testing key ../pubkey.pem.
Can't load binary_polinomial_factoring because sage is not installed
Can't load ecm2 because sage is not installed
Can't load smallfraction because sage is not installed
Can't load boneh_durfee because sage is not installed
Can't load qicheng because sage is not installed
Can't load roca because sage is not installed
Can't load ecm because sage is not installed
[*] Performing fermat attack on ../pubkey.pem.
[*] Performing pollard_p_1 attack on ../pubkey.pem.
[*] Performing smallq attack on ../pubkey.pem.
[*] Performing pastctfprimes attack on ../pubkey.pem.
[*] Performing factordb attack on ../pubkey.pem.
[*] Performing mersenne_primes attack on ../pubkey.pem.
[*] Performing partial_q attack on ../pubkey.pem.
[*] Performing wiener attack on ../pubkey.pem.
Results for ../pubkey.pem:
Unciphered data :
HEX : 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004854427b6231365f655f356d346c6c5f645f337175346c355f7733316e33725f34373734636b7d
INT (big endian) : 2357392946640097540211419645858895520810208771688666037754674144921765688545923475455795751805
INT (little endian) : 22546574263662123411523113128044215139929103295256955398886722465953163007000026640058669241937130344552566514396588140080195580660405015242202668398374037246444419998235653404182362721762856885981820839225967889839162532460437518669392406390949281459764025707163465962902177848023467525069105766717294567751680
STR : b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00HTB{b16_e_5m4ll_d_3qu4l5_w31n3r_4774ck}'
The flag is HTB{b16_e_5m4ll_d_3qu4l5_w31n3r_4774ck}
.
⚡ Magic ⚡