challenge | Point | Type |
---|---|---|
mess_me | 200 | Digital Forensic |
First, This was cool and New challenge on my Eyes because whenever i get the zip file with password all i am thinking is to find the password but this one was NO THAT WAY!
at recon i had to give a try with john as alway
then
ITS WEIRD and Nothing interest!!!
after a while i got idea why not trying to google the other way to crack Encrypted zip
file
i found something about Known Plaintext attack
well then i got lead on the tool called PKCRACK but i could not get to understand well how to use so i moved on and found new tool called BKCRACK with help of friend @ByamB4 after cloned and compiled it then was seems to work properly so lets the CRACK BEGIN
USING BKCRACK TOOL
Let us see what is inside.
Open a terminal in the our folder and ask unzip
to give us information about it.
We get the following output.
The zip file contains two files: flag.jpg
and oracle.vdi
.
The capital letter in the fifth field shows the files are encrypted.
We also see that flag.jpg
is deflated whereas oracle.vdi
is stored uncompressed.
To run the attack, we must guess at least 12 bytes of plaintext.
On average, the more plaintext we guess, the faster the attack will be.
We can guess from its extension that oracle.vdi
probably starts with the string <<< Oracle VM VirtualBox Disk Image >>>
.
We are so lucky that this file is stored uncompressed in the zip file.
So we have 40 bytes of plaintext, which is more than enough.
Let us assume the zip file did not contain the uncompressed oracle.vdi
.
Then, to guess some plaintext, we can guess the first bytes of the original flag.jpg
file from its extension.
The problem is that this file is compressed.
To run the attack, one would have to guess how those first bytes are compressed, which is difficult without knowing the entire file.
In this example, this approach is not practical.
It can be practical if the original file can easily be found online, like a .dll file for example.
Then, one would compress it using various compression software and compression levels to try and generate the correct plaintext.
In this example, we guessed the first 40 bytes of oracle.vdi
. and i hope the attack will be more faster
In addition, as explained in the ZIP file format specification, a 12-byte encryption header in prepended to the data in the archive.
The last byte of the encryption header is the most significant byte of the file's CRC.
We can get the CRC with unzip
.
So we know the byte just before the plaintext (i.e. at offset -1) is 0xF6.
Let us write the plaintext we guessed in a file.
We are now ready to run the attack.
After a little while, the keys will appear
Once we have the keys, we can decipher the files.
We assume that the same keys were used for all the files in the zip file.
The file oracle.vdi
was stored uncompressed so we are done.
The file flag.jpg
was compressed with the deflate algorithm in the zip file, so we now have to uncompressed it.
A python script is provided for this purpose in the tools
folder.
but i opened it but file corrupted ehh so i had to check it with file
command to see if its real aJPG
file or
BOOOM ITS NOT
so i had to change just a file extension from .jpg
to .png
it worked I GOT FLAG
in summary : The attack is a known plaintext attack, which means you have to know part of the encrypted data in order to break the cipher. thats all i could have cracked it in two hours but guess what i spent a day to figuring out where i was missing and reliaze that i was using small letter v
in <<< Oracle VM virtualBox Disk Image >>>
instead of capital letter V
damn this means this plaintext things is Case-Sensitive
HAPPY NEW YEAR CTFiers