Intro to Hash Cracking

Cyclone

Active member
Trusted
Contributor
Retired Moderator
Feedback: 3 / 0 / 0
Joined
Dec 30, 2019
Messages
3,176
Reaction score
900
Credits
5,904
Intro to Hash Cracking - by cyclone

Intro



So you want to crack hashes? Let’s first briefly cover what hashing is, and why it’s used.

Rather than storing sensitive information, such as login credentials in plaintext, most databases use hashing to obscure sensitive database entries. For example, if you used a password such as, password, and the server was using the hashing algorithm MD5, your hashed password would be, 5F4DCC3B5AA765D61D8327DEB882CF99. Databases store passwords in hashed entries, and hash cracking is the process of turning these hashed entries back into plaintext. Concerning modern hash algorithms, the only way to retrieve the plaintext is to crack the hash. Since hashing is a one-way function, the only way to crack the hash is to guess the plaintext. There’s no hack or “dehashing” exploit. Guessing the plaintext is cracking the hash. This is where good hash cracking practices come into play with efficient wordlists, rules, and fast GPU’s all playing an important part in this process. The most important part of this process is you as the hash cracker must know when and where to apply your skills for the process to be both effective and efficient.

Hash Cracking Programs

There are multiple programs that can be used for hash cracking such as John the Ripper or MDXfind, but we’ll focus on Hashcat. If you haven’t already, download the binary files here: https://hashcat.net and unzip the hashcat-6.x.x.7z file we just downloaded into a directory called “hashing” (or whatever you want to call it).

You’ll notice Hashcat includes binaries for both Windows (.exe) and Linux (.bin), but for this tutorial we’ll be demonstrating the commands from a Linux terminal (real hash crackers use Linux!). Keep in mind that most of the commands we’ll be using for this tutorial are similar for both OS’s, so once you’ve learned how to run Hashcat on Linux, switching over to a Windows command line is fairly easy and visa-versa.

Wordlists

The wordlist we use is extremely important to the success of our attack. A poor wordlist will give poor results, and just because a wordlist is huge with 10’s of gigabytes doesn’t mean it’s efficient. This is especially true with slow algorithms such as bcrypt where running an efficient wordlist would be necessary due to time. What is all this talk about time and efficiency? Keep in mind that the same wordlist + rules that only takes a few minutes to run on a list of 100 MD5’s could take years to complete on 100 bcrypt.

Since we’ll need a wordlist for our attack, we’ll download one from weakpass.com which contains a short list of 100,000 most common passwords. Unzip this wordlist inside your Hashcat folder. I like to keep my wordlists in their own subfolder called “wordlist”, but you can choose to set up your folder structure however you like. Just keep in mind where you extract the wordlist as we’ll need to know that when we assemble our command line in terminal.
https://weakpass.com/wordlist/49

The Attack

We need a sample set of hashes to try our attack on, so copy and paste the following MD5 hashes into a file called hashes.txt and place this file in your Hashcat folder as well.
5f4dcc3b5aa765d61d8327deb882cf99
0d107d09f5bbe40cade3de5c71e9e9b7
84d961568a65073a3bcf0eb216b2a576
f25a2fc72690b780b2a14e140ef6a9e0
8afa847f50a716e64932d995c8e7435a
55f9c405bd87ba23896f34011ffce8da
58e50f904aab05ac687efc1635421d78
72a97fb793d496318518aebc7e9298b2
c62d929e7b7e7b6165923a5dfc60cb56
e0e34c5ad05aac3eef6ab31eacbf7a5c
5e8667a439c68f5145dd2fcbecf02209
ce608d5892ee2872771f4b67144405e0
dbfd69abf4df53dee082a1165ded4f08
94d756215ab39626d9e84a5c1a63aef5
97db1846570837fce6ff62a408f1c26a
faf5ba124a0b97c9e59c1f9c8c7d2d24
0d2489f3616693c707709295fd091c84
eb01627e574fe1054d0e1be3dbd02335
cd08b61ac93896d976abde8694980166
9fceecbb0047b7f21a62ab4cb07d073d
1b4329e9b4051be1f368e300285b6903
084a0ff182baa188032cf8e9b4d632cc
cadac4d712c63f4cec146d91f18bfb85
e88d4453db667bfcf194521b5072fa63
5dcc146ae54e2f6ed3c0e1400b0bdc6b
a36d09f3df5a75f6814c74fa1b20a06a
bc11dd3115d29514c9362c77ffa7427c
All of the password hashes listed below were derived from the wordlist we downloaded in the previous step.

Open a terminal in your Hashcat directory and run the following command:

Note: you may need to edit this command to match the folder structure on your system if your wordlists are in a subfolder, or if using Windows.

Code:
hashcat.bin -m 0 -a 0 -O -w 3 hashes.txt 10_million_password_list_top_100000.txt

Let’s take a moment to explain the command and options we’re using.

Code:
hashcat.bin        hashcat binary
-m 0               -m = MODE, 0 = MD5
-w 3               Workload profile 3 = High
-a 0               -a = attack, 0 = wordlist
-O                 Optimised kernel - speeds up attack on supported modes
hashes.txt         Text file containing hashes we’re trying to crack
10_million_pass... Wordlist we’re using for the attack

If everything went well, we should have cracked 13 / 27 hashes! If you received an error, double check your command syntax and make sure you’ve installed the correct drivers for your GPU. You can always run hashcat.bin -h to display a full list of commands and supported algorithms Hashcat supports.

0d2489f3616693c707709295fd091c84:PLATINUM
f25a2fc72690b780b2a14e140ef6a9e0:iloveyou
e0e34c5ad05aac3eef6ab31eacbf7a5c:victoria
5e8667a439c68f5145dd2fcbecf02209:87654321
8afa847f50a716e64932d995c8e7435a:princess
72a97fb793d496318518aebc7e9298b2:cowboys
97db1846570837fce6ff62a408f1c26a:1q2w3e4r5t
c62d929e7b7e7b6165923a5dfc60cb56:q1w2e3r4
5f4dcc3b5aa765d61d8327deb882cf99:password
0d107d09f5bbe40cade3de5c71e9e9b7:letmein
84d961568a65073a3bcf0eb216b2a576:superman
55f9c405bd87ba23896f34011ffce8da:maverick
58e50f904aab05ac687efc1635421d78:eagles

Rules

Next, let’s expand our attack by using rules for our wordlist. This is done by adding the -r switch to our Hashcat command and specifying the ruleset to use. Hashcat includes several rulesets so we’ll start off by using a basic set of rules, best64.rule. Using rules will mangle each word contained in our wordlist. For example, the rule l (lower case L) will lower the case of each word, so PassWord becomes password.

Hashcat Rules: https://hashcat.net/wiki/doku.php?id=rule_based_attack

Run the following command from terminal.

Code:
hashcat.bin -m 0 -a 0 -O -w 3 hashes.txt 10_million_password_list_top_100000.txt -r rules/best64.rule

Note the added -r rules/best64.rule appended to the previous command.

Applying best64.rule to our wordlist cracked 6 more hashes!

eb01627e574fe1054d0e1be3dbd02335:qweasdzxc13
faf5ba124a0b97c9e59c1f9c8c7d2d24:garfield123
94d756215ab39626d9e84a5c1a63aef5:liverpool77
ce608d5892ee2872771f4b67144405e0:qwerty123123
dbfd69abf4df53dee082a1165ded4f08:theqwerty123
cd08b61ac93896d976abde8694980166:CzPS5NYNDWCkSC23

Let’s try another ruleset called generated.rule and see how many more hashes we can crack.

Code:
hashcat.bin -m 0 -a 0 -O -w 3 hashes.txt 10_million_password_list_top_100000.txt -r rules/generated.rule

Running our attack with generated.rule cracked 3 more hashes.

1b4329e9b4051be1f368e300285b6903:uoyevo,li
9fceecbb0047b7f21a62ab4cb07d073d:Mcoolbugi2000Mcoolbugi2000
cadac4d712c63f4cec146d91f18bfb85:9coolbugi2000G

Advanced Cracking - Rule Stacking

Let’s try something else, rule stacking. This is where we’ll stack multiple sets of rules to further mangle our wordlist. This is typically only feasible with fast hash algorithms as rule stacking can add considerable time to the attack. To keep things simple, for this attack we’ll stack best64.rule. Make sure to add a second -r switch before the 2nd rule like our example below:

Code:
hashcat.bin -m 0 -a 0 -O -w 3 hashes.txt 10_million_password_list_top_100000.txt -r rules/best64.rule -r rules/best64.rule

Two more hashes fell to our rule stacking attack.

a36d09f3df5a75f6814c74fa1b20a06a:seirrebnarc21
bc11dd3115d29514c9362c77ffa7427c:|hecoolbugi2000

The Last 20%

While our last 3 uncracked hashes do not equal 20% of this test set, the last remaining hashes that haven’t cracked are commonly referred to as The Last 20%. Our 3 remaining hashes will crack with a good wordlist and rules, but in the real world of hash cracking some hashes with long, complex plaintext would never crack in a feasible amount of time even with mask / brute force attacks due to the time required to run through their entire keyspace. The good news for you is the 3 remaining hashes in this test set will crack if you find the right wordlist + ruleset, so explore some of your newly learned skills and have fun cracking these.

Conclusion

While we’ve only scratched the surface when it comes to hash cracking, I hope you’ve had fun cracking these hashes and learned a few things along the way.

~Cyclone

5f4dcc3b5aa765d61d8327deb882cf99:password
0d107d09f5bbe40cade3de5c71e9e9b7:letmein
84d961568a65073a3bcf0eb216b2a576:superman
f25a2fc72690b780b2a14e140ef6a9e0:iloveyou
8afa847f50a716e64932d995c8e7435a:princess
55f9c405bd87ba23896f34011ffce8da:maverick
58e50f904aab05ac687efc1635421d78:eagles
72a97fb793d496318518aebc7e9298b2:cowboys
c62d929e7b7e7b6165923a5dfc60cb56:q1w2e3r4
e0e34c5ad05aac3eef6ab31eacbf7a5c:victoria
5e8667a439c68f5145dd2fcbecf02209:87654321
ce608d5892ee2872771f4b67144405e0:qwerty123123
dbfd69abf4df53dee082a1165ded4f08:theqwerty123
94d756215ab39626d9e84a5c1a63aef5:liverpool77
97db1846570837fce6ff62a408f1c26a:1q2w3e4r5t
faf5ba124a0b97c9e59c1f9c8c7d2d24:garfield123
0d2489f3616693c707709295fd091c84:PLATINUM
eb01627e574fe1054d0e1be3dbd02335:qweasdzxc13
cd08b61ac93896d976abde8694980166:CzPS5NYNDWCkSC23
9fceecbb0047b7f21a62ab4cb07d073d:Mcoolbugi2000Mcoolbugi2000
1b4329e9b4051be1f368e300285b6903:uoyevo,li
084a0ff182baa188032cf8e9b4d632cc:grarfield12333333
cadac4d712c63f4cec146d91f18bfb85:9coolbugi2000G
e88d4453db667bfcf194521b5072fa63:cranberris!!!
5dcc146ae54e2f6ed3c0e1400b0bdc6b:thegarfield1234
a36d09f3df5a75f6814c74fa1b20a06a:seirrebnarc21
bc11dd3115d29514c9362c77ffa7427c:|hecoolbugi2000
 

Cyclone

Active member
Trusted
Contributor
Retired Moderator
Feedback: 3 / 0 / 0
Joined
Dec 30, 2019
Messages
3,176
Reaction score
900
Credits
5,904
Preparing Truecrypt Containers for Cracking with Hashcat - by cyclone

Intro
At the time of this writing, hashcat does not use a "hash" for tc containers, but rather the actual tc container itself. This creates a privacy issue for the tc container owner if they want to request the assistance of the hash cracking community. This is due to the fact that all the files within the tc container are exposed if the tc container is cracked.
There is an easy way to avoid this privacy issue. Read on.

Truecrypt Logical Drives
Truecrypt containers are mounted on the host OS as a logical drive. Concerning passphrase protected containers, in order for the host OS to mount / decrypt the encrypted ts container, Truecrypt stores the hashed passphrase within the 512 bytes of the tc container. Knowing this, we can truncate the tc container down to the first 512 bytes, then only share the truncated tc container for cracking with hashcat. If cracked by the community, no files can be compromised since the truncated tc container does not contain any files from the original container.

Using dd to Truncate

It is recommended to have a zipped backup of the tc container before attempting any of the commands below. Using commands such as dd are destructive if you don't know what you're doing.

Make sure you have a backup, and only proceed if you are familiar with linux terminal commands.

Example of truncating tc container: truecrypt_container.tc

On linux:
# truncate the first 512 bytes of truecrypt_container.tc
Code:
dd if=truecrypt_container.tc of=truncate.tc bs=512 count=1
# you can now safely share truncate.tc without compromising the files inside the original tc container

Using Cyclone Container Truncator Tool
You can skip the dd command line and simply run this tool to truncate Truecrypt or Veracrypt containers so you can run them with hashcat.
https://github.com/cyclone-github/cyclone_container_truncator

Truecrypt Full Disk Encryption

Concerning Full Disk Encryption, the data need for hashcat is not located within the first 512 bytes as it is with tc containers. The offset will vary depending on the encryption type, ex: boot vs hidden. See links below for a good explanation to which offset you'll need.
https://hashcat.net/forum/archive/index.php?thread-6910.html
https://hashcat.net/wiki/doku.php?i...o_i_extract_the_hashes_from_truecrypt_volumes

Veracrypt Containers

While not fully tested, the methods described above have worked in my testing with Veracrypt containers. Simply change the commands above to match your veracrypt .vc container or dd offset.
ex:
Code:
dd if=veracrypt_container.vc of=truncate.vc bs=512 count=1

**EDIT**1/29/2022 added bs=512 to dd command for better compatibility
**EDIT**2/24/2022 added Full Disk Encryption info
**EDIT**1/23/2023 added link to github tool 'Cyclone Container Truncator'
 
Last edited:

tychotithonus

New member
M.I.A.
Feedback: 0 / 0 / 0
Joined
Jun 6, 2020
Messages
1
Reaction score
6
Credits
8
Specifically, you need the first 512 bytes of the file (if it's a file). This is probably dd's default on many systems, but it might be safest to explicitly specify the block size. If it's a full disk image, or a nested container, you might need to start from a different part of the disk/file.

Ref thread: https://hashcat.net/forum/archive/index.php?thread-6910.html
 
Top