Weak RSA challenge is part of the Beginners track onĀ hackthebox
Download the file and unzip it. We see 2 files. flag.enc and key.pub
Let’s see what is inside both of them. by using the cat command
The key is an RSA key. That’s why the name of the challenge is Weak RSA. We need to use that to decrypt the message. I found one way on this site but this is a rabbit hole SSH encrypt and decrypt – ATI public wiki (ttu.ee)
After some more googling I came along this site GitHub – Ganapati/RsaCtfTool: RSA attack tool (mainly for ctf) – retreive private key from weak public key and/or uncipher data
Installed the tool in the opt directory of my kali linux
cd /opt git clone https://github.com/Ganapati/RsaCtfTool.git sudo apt-get install libgmp3-dev libmpc-dev cd RsaCtfTool pip3 install -r "requirements.txt"
Now that all is installed. I typed in the following command
python3 /opt/RsaCtfTool/RsaCtfTool.py --publickey key.pub --uncipherfile flag.enc
It took a while but the flag is there