Cracking password protected MS Office files using Hashcat
Part of the series (2 of 2) cracking password protected MS Office files.
Whether it is a forensic investigation or even in private life, we might need to open a password protected file which might contain a personal information or information that can change the direction of investigation. For those files, unlike common belief, depending on the length of password, it is actually possible to crack the file reach the data inside. But in order to that, we must have the correct tools and right approach.
In this article, I am going to show how to crack a password protected MS office file using Hashcat on Linux Ubuntu OS step by step.
Extracting password hash from the file
In our case, we are going to have example.xlsx file which is protected with password. The first thing to do here is to extract the hash of the password which can be done using John The Ripper. This step is explained in my previous article, which can be found here. Note that we are going to need the text file that is containing password hash that we have extracted previously.
If you successfully extracted the hash and written it inside a text file then we can move on the next step, cracking it using highly skilled Hashcat.
Setting up Hashcat on Linux
Hashcat is a highly skilled password cracking tool that is pretty much best in its class. Hashcat can be installed using the following command:
OR
sudo-apt get install hashcat
if it asks you about sudo password just enter and it will start downloading package.
Downloading dictionaries for dictionary attack
Before starting brute force attack, I always prefer a quick dictionary attack. Cupp is very skilled for that job. As it can generate a smart dictionary with creating a combination using given input, it also has pre-defined word lists that can quickly be downloaded and used.
In order to download cupp, you can use the following command:
apt-get install cupp
using "cupp -l" command, you can download large variety of dictionaries in different languages.
Cracking password with Hashcat
As I mentioned before, Hashcat is a highly skilled password cracking tool, which contains a suitable cracking mechanism for most of the widely used hashing algorithms.
Maybe one of the most important things to remember before starting attack on the protected file is to detect hash code equivalent to hashing method used for encrypting password. Detailed list of hash codes can be found here.
In our case, since our password protected file is a xlsx file which is created in Office 2010, our hash code will be 9500. If we use the wrong code then attack won't run as expected.
Step 1: Dictionary Attack
The dictionary I have downloaded previously is called dictionary.txt and my hash file hash.txt both are located on my computer desktop. Once I change the directory to desktop, in order to start the attack, we must run the following code:
Status...........: Cracked
Hash.Type........: MS Office 2010
Hash.Target......: $office$*2010*100000*128*16*c32223543116fa8ba50599...54e44c
Time.Started.....: Sun Apr 18 19:04:06 2021 (11 secs)
Time.Estimated...: Sun Apr 18 19:04:17 2021 (0 secs)
Guess.Base.......: File (dictionary.txt)
Guess.Queue......: 1/1 (100.00%)
Speed.#1.........: 2335 H/s (0.59ms) @ Accel:1024 Loops:64 Thr:1 Vec:16
Recovered........: 1/1 (100.00%) Digests, 1/1 (100.00%) Salts
Progress.........: 26130/26130 (100.00%)
Rejected.........: 0/26130 (0.00%)
Restore.Point....: 24576/26130 (94.05%)
Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:99968-100000
Candidates.#1....: ya -> XYZ
Step 2: Brute Force (Mask) Attack
Brute force attack in Hashcat is enhanced with mask attack, which means that we can restrict number of possibilities in order to shorten the time for cracking process.
| l | abcdefghijklmnopqrstuvwxyz | |
| u | ABCDEFGHIJKLMNOPQRSTUVWXYZ | |
| d | 0123456789 | |
| s | !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ | |
| a | ?l?u?d?s | |
| b | 0x00 - 0xff |
Status...........: Cracked
Hash.Type........: MS Office 2010
Hash.Target......: $office$*2010*100000*128*16*c3932223543116fa8ba50599...54e44c
Time.Started.....: Mon Apr 5 14:30:10 2021 (1 min, 6 secs)
Time.Estimated...: Mon Apr 5 14:31:16 2021 (0 secs)
Guess.Mask.......: ?a?a?a [3]
Guess.Queue......: 1/1 (100.00%)
Speed.#1.........: 2234 H/s (10.00ms) @ Accel:1024 Loops:256 Thr:1 Vec:16
Recovered........: 1/1 (100.00%) Digests, 1/1 (100.00%) Salts
Progress.........: 147456/456976 (32.27%)
Rejected.........: 0/147456 (0.00%)
Restore.Point....: 0/17576 (0.00%)
Restore.Sub.#1...: Salt:0 Amplifier:17-18 Iteration:99840-100000
Candidates.#1....: EAR-> EOV
Yorumlar
Yorum Gönder