Hack The Box - Infinite Descent - Crypto Challenge - Write-up

Okay we have a message that is encrypted using some sort of RSA encryption. I think. The public key is given with the message. A hint in https://forum.hackthebox.eu/discussion/689/crypto-infinite-descent says that we should use the files given. Hmmmm. I think we should try to re-create the  private key from the public key. Let's try dumping the key parameters using https://github.com/Ganapati/RsaCtfTool


Now, we have the n parameter. Factor the n parameter using http://www.mickybullock.com/blog/wp-content/RSA_Cryptography/ffactory.php to get the pq values.

Okay...let's modify the fasterprimes.py script with the new values for p and q and then decrypt the encrypted message using the key created with the pq values. (https://stackoverflow.com/questions/30056762/rsa-encryption-and-decryption-in-python)



What is this number. After some time, I noticed something in AESbootstrap.py (the example at the bottom of that script), it says that it takes a triplet to convert into something.


Hmmm. Let's try separating the decrypted number into 3 digits and feed into the seedval variable.


So that script outputs a binary for each number. Interesting. Let's convert that into ASCII and see whether it's something meaningful.



Oh guess what, the converted ASCII is another code in base64. Ugh. Just give me the flag already. Let's see what this is...



IT'S THE FLAG!!!  FINALLYY!!!

Took me a while to solve this. Don't know if this is the easiest way. If you guys have any other methods, please let me know in the comments. Thanks.

Comments

Post a Comment