Protected Archives
Besides standalone files, there is also another format of files that can contain not only data, such as an Office document or a PDF, but also other files within them. This format is called an archive
or compressed file
that can be protected with a password if necessary.
Let us assume an employee's role in an administrative company and imagine that our customer wants to summarize analysis in different formats, such as Excel, PDF, Word, and a corresponding presentation. One solution would be to send these files individually, but if we extend this example to a large company dealing with several projects running simultaneously, this type of file transfer can become cumbersome and lead to individual files being lost. In these cases, employees often rely on archives, which allow them to split all the necessary files in a structured way according to the projects (often in subfolders), summarize them, and pack them into a single file.
There are many types of archive files. Some common file extensions include, but are not limited to:
tar
gz
rar
zip
vmdb/vmx
cpt
truecrypt
bitlocker
kdbx
luks
deb
7z
pkg
rpm
war
gzip
An extensive list of archive types can be found on FileInfo.com. However, instead of manually typing them out, we can also query them using a one-liner, filter them out, and save them to a file if needed. At the time of writing, there are 337
archive file types listed on fileinfo.com.
Download All File Extensions
It is important to note that not all of the above archives support password protection. Other tools are often used to protect the corresponding archives with a password. For example, with tar
, the tool openssl
or gpg
is used to encrypt the archives.
Cracking Archives
Given the number of different archives and the combination of tools, we will show only some of the possible ways to crack specific archives in this section. When it comes to password-protected archives, we typically need certain scripts that allow us to extract the hashes from the protected files and use them to crack the password of those.
The .zip format is often heavily used in Windows environments to compress many files into one file. The procedure we have already seen remains the same except for using a different script to extract the hashes.
Cracking ZIP
Using zip2john
By extracting the hashes, we will also see which files are in the ZIP archive.
Viewing the Contents of zip.hash
Once we have extracted the hash, we can now use john
again to crack it with the desired password list. Because if john
cracks it successfully, it will show us the corresponding password that we can use to open the ZIP archive.
Cracking the Hash with John
Viewing the Cracked Hash
Cracking OpenSSL Encrypted Archives
Furthermore, it is not always directly apparent whether the archive found is password-protected, especially if a file extension is used that does not support password protection. As we have already discussed, openssl
can be used to encrypt the gzip
format as an example. Using the tool file
, we can obtain information about the specified file's format. This could look like this, for example:
Listing the Files
Using file
When cracking OpenSSL encrypted files and archives, we can encounter many different difficulties that will bring many false positives or even fail to guess the correct password. Therefore, the safest choice for success is to use the openssl
tool in a for-loop
that tries to extract the files from the archive directly if the password is guessed correctly.
The following one-liner will show many errors related to the GZIP format, which we can ignore. If we have used the correct password list, as in this example, we will see that we have successfully extracted another file from the archive.
Using a for-loop to Display Extracted Contents
Once the for-loop has finished, we can look in the current folder again to check if the cracking of the archive was successful.
Listing the Contents of the Cracked Archive
Cracking BitLocker Encrypted Drives
BitLocker is an encryption program for entire partitions and external drives. Microsoft developed it for the Windows operating system. It has been available since Windows Vista and uses the AES
encryption algorithm with 128-bit or 256-bit length. If the password or PIN for BitLocker is forgotten, we can use the recovery key to decrypt the partition or drive. The recovery key is a 48-digit string of numbers generated during BitLocker setup that also can be brute-forced.
Virtual drives are often created in which personal information, notes, and documents are stored on the computer or laptop provided by the company to prevent access to this information by third parties. Again, we can use a script called bitlocker2john
to extract the hash we need to crack. Four different hashes will be extracted, which can be used with different Hashcat hash modes. For our example, we will work with the first one, which refers to the BitLocker password.
Using bitlocker2john
Both John
and Hashcat
can be used for this purpose. This example will look at the procedure with Hashcat
. The Hashcat mode for cracking BitLocker hashes is -m 22100
. So we provide Hashcat with the file with the one hash, specify our password list, and specify the hash mode. Since this is robust encryption (AES
), cracking can take some time, depending on the hardware used. Additionally, we can specify the filename in which the result should be stored.
Using hashcat to Crack backup.hash
Viewing the Cracked Hash
Once we have cracked the password, we will be able to open the encrypted drives. The easiest way to mount a BitLocker encrypted virtual drive is to transfer it to a Windows system and mount it. To do this, we only have to double-click on the virtual drive. Since it is password protected, Windows will show us an error. After mounting, we can again double-click BitLocker to prompt us for the password.
Windows - Mounting BitLocker VHD
Last updated