Hashcat Tutorial for beginner
Password cracking is a very interesting topic and loved by every hacker.
There are multiple password cracking software exist in the market for cracking the password. but hashcat is unique.
Hashcat is working well with GPU, or we can say it is only designed for using GPU. GPU has amazing calculation power to crack the password.
In this article, I will cover the hashcat tutorial, hashcat feature, Combinator Attack, Dictionary Attack, hashcat mask attack example, hashcat Brute force attack, and more. This article covers the complete tutorial about hashcat.
Hello friends, you reading articles on Password cracking under Penetration Testing this article will cover about another tool hashcat tutorial. It is the best password cracking tool. and give the best result with GPU Machine.
Description of Hashcat for Password Cracking
According to the official website, Hashcat is the world’s fastest CPU-based password recovery tool.
While it’s not as fast as its GPU counterpart oclHashcat, large lists can be easily split in half with a good dictionary and a bit of knowledge of the command switches.
Hashcat was written somewhere in the middle of 2009. Yes, there were already close-to-perfect working tools supporting rule-based attacks like “PasswordsPro”, “John The Ripper”. However, for some unknown reason, both of them did not support multi-threading. That was the only reason to write Hashcat: To make use of the multiple cores of modern CPUs.
Granted, that was not 100% correct. John the Ripper already supported MPI using a patch, but at that time it worked only for Brute-Force attack. There was no solution available to crack plain MD5 which supports MPI using rule-based attacks.
How to use Hashcat in Kali Linux
Hashcat is preinstalled in Kali Linux, To see more about hashcat execute following code in terminal
#hashcat –help | more
Press enter and read about available options for hashcat
Features Of Hashcat :
- Multi-Hash (up to 24 million hashes)
- Multi-OS (Linux, Windows and OSX native binaries)
- Multi-Algo (MD4, MD5, SHA1, DCC, NTLM, MySQL, …)
- SSE2, AVXand XOP accelerated
- All Attack-Modesexcept Brute-Force and Permutation can be extended by rules
- Very fast Rule-engine
- Rules compatible with JTR and PasswordsPro
- Possible to resume or limit session
- Automatically recognizes recovered hashes from outfile at startup
- Can automatically generate random rules
- Load salt is from an external file and then use them in a Brute-Force Attack variant
- Able to work in a distributed environment
- Specify multiple wordlists or multiple directories of wordlists
- Number of threads can be configured
- Threads run on the lowest priority
- Supports hex-charset
- Supports hex-salt
- 90+ Algorithm implemented with performance in mind
- ……and much more
Combinator Attack with hashcat
In this attack, hashcat create a password list by combinator method in this method each word of a dictionary is appended to each word in a dictionary.
For Example, I have the following word in my dictionary:
Output we get by hashcat
hashcat is that CPU hashcat does the combination of the plains given in a single dictionary file (wordlist) This implies that one should specify only and exactly 1 (dictionary) file within the command line for hashcat (besides the hash file).
Example of combinatory attack:
The combinator attack hence will combine each and every word within the single dictionary file. In the example I used the RockYou wordlist file in Kali Linux.
#hashcat -m 0 -a 1 hash.txt dict.txt
Bruteforce Attack with Hashcat Tutorial
Tries all combinations from a given Keyspace. It is the easiest of all the attacks.
In Brute-Force we specify a Charset and a password length range. The total number of passwords to try is Number of Chars in Charset ^ Length. This attack is outdated. The Mask-Attack fully replaces it.
Dictionary Attack with hashcat tutorial
The dictionary attack is a very simple attack mode. It is also known as a “Wordlist attack”.
All that is needed is to read line by line from a textfile (called “dictionary” or “wordlist”) and try each line as a password candidate.
Mask Attack with hashcat tutorial
Try all combinations from a given keyspace just like in Brute-Force attack, but more specific.
The reason for doing this and not to stick to the traditional Brute-Force is that we want to reduce the password candidate keyspace to a more efficient one.
Here is a single example. We want to crack the password: Julia1984
In traditional Brute-Force attack, we require a charset that contains all upper-case letters, all lower-case letters and all digits (aka “mixalpha-numeric”). The Password length is 9, so we have to iterate through 62^9 (13.537.086.546.263.552) combinations. Let’s say we crack with a rate of 100M/s, this requires more than 4 years to complete.
In Mask attack, we know about humans and how they design passwords. The above password matches a simple but common pattern. A name and year appended to it. We can also configure the attack to try the upper-case letters only in the first position. It is very uncommon to see an upper-case letter only in the second or the third position. To make it short, with Mask attack we can reduce the keyspace to 52*26*26*26*26*10*10*10*10 (237.627.520.000) combinations. With the same cracking rate of 100M/s, this requires just 40 minutes to complete.
Examples of Mask Attack
The following commands all define the same custom charset that consists of the chars “abcdefghijklmnopqrstuvwxyz0123456789” (aka “lalpha-numeric”):
-1 loweralpha_numeric.hcchr # file that contains all digits + chars (abcdefghijklmnopqrstuvwxyz0123456789)
The following command defines a charset that consists of the chars “0123456789abcdef”:
The following command defines a full 7-bit ASCII charset (aka “mixalpha-numeric-all-space”):
The following command sets the first custom charset (-1) to russian language specific chars:
The following commands create the following password candidates:
command: -a 3 ?l?l?l?l?l?l?l?l
keyspace: aaaaaaaa – zzzzzzzz
command: -a 3 -1 ?l?d ?1?1?1?1?1
keyspace: aaaaa – 99999
command: -a 3 password?d
keyspace: password0 – password9
command: -a 3 -1 ?l?u ?1?l?l?l?l?l19?d?d
keyspace: aaaaaa1900 – Zzzzzz1999
command: -a 3 -1 ?dabcdef -2 ?l?u ?1?1?2?2?2?2?2
keyspace: 00aaaaa – ffZZZZZ
command: -a 3 -1 efghijklmnop ?1?1?1
keyspace: eee – ppp
Password length increment
A Mask attack is always specific to a password length. For example, if we use the mask “?l?l?l?l?l?l?l?l” we can only crack a password of the length 8. But if the password we try to crack has the length 7 we will not find it. That’s why we have to repeat the attack several times, each time with one placeholder added to the mask. This is transparently automated by using the “–increment” flag.