Weak RSA

Zip Password:
SHA256 HASH for File-->
Download and extract files from zip.
Use the password given to unzip.

We get two files.
A ENC and a PUB file.
Let's check out the PUB file.

Looks like a simple public RSA key.
Now let's check out the ENC file.

Looks like we get a bunch of gibberish which makes sense seeing as a
.encfile means it was encrypted with some form of software.We'll have to try to figure out how to decrypt the file to see it.
I'm going to use the
openssl tool on kali to try to decrypt it.

It asks me for a password so try giving it "
password".It gives me back, bad magic number which is interesting. From what I know about magic numbers, they are the Hex Signature at the beginning of the binary file.
Let's open it up the file in hexeditor which should be installed on Kali. If not, you can also use an online resource to inspect the hex.
Hededitor


As you can see the first four sets of hexadecimal are:
Unfortunately, doing a quick Google search shows that these are not associated with any well-known set of magic numbers which would make sense if the whole file is encrypted.
Based on the fact that we were given a public key tells me that this is an asymmetric algorithm. This means that the using
opensslabove was most likely not going to work since it was usingAES256which is a symmetric algorithm.Need to use RsaCtfTool to create a private key from a public RSA key.
Use command below to create RSA private key:

Create
key.privand copy over created private key.Then we need to run
opensslto decrypt the file with the new private key.
We can then
catthemyfile_decrypted.txtfor the flag.
The final decrypted key is:

Last updated