Hacking With Hashcat - A Practical Guide
Hacking With Hashcat - A Practical Guide
Note: All my articles are for educational purposes. If you use it illegally
and get into trouble, I am not responsible. Always get permission from the
owner before scanning / brute-forcing / exploiting a system.
https://medium.com/p/97b5d0d037e5/edit 1/10
12/6/22, 6:26 PM Editing Hacking with Hashcat — A Practical Guide – Medium
What is password hashing?
Hashing is the process of converting an alphanumeric string into a
fixed-size string by using a hash function. A hash function is a
mathematical function that takes in the input string and generates
another alphanumeric string.
Hashing
There are many hashing algorithms like MD5, SHA1, etc. To learn
more about different hashing algorithms, you can read the article
here.
42f749ade7f9e195bf475f37a44cafcb
https://medium.com/p/97b5d0d037e5/edit 2/10
12/6/22, 6:26 PM Editing Hacking with Hashcat — A Practical Guide – Medium
850eaebd5c4bb931dbb2bbcf7994c021
UGFzc3dvcmQxMjM=
When we signup for a website, they will hash our password before
saving it (hopefully!). When we try to log in again, the same hashing
algorithm is used to generate a hash for our input. It is then
compared with the original hash saved in the database.
Now that we know how Hashing works, let's look at what Hashcat is.
What is Hashcat?
https://medium.com/p/97b5d0d037e5/edit 3/10
12/6/22, 6:26 PM Editing Hacking with Hashcat — A Practical Guide – Medium
Hashcat is also one of the few tools that can work with the GPU.
While CPUs are great for sequential tasks, GPUs have powerful
parallel processing capabilities. GPUs are used in Gaming, Artificial
intelligence and can also be used to speed up password cracking.
Here is the difference between a CPU and a GPU if you want to learn
more.
Now that we know what Hashcat is, let's go and install it.
How to install Hashcat?
Hashcat comes pre-installed in Kali and Parrot OS. To install it in
Ubuntu / Debian-based systems, use the following command.
https://medium.com/p/97b5d0d037e5/edit 4/10
12/6/22, 6:26 PM Editing Hacking with Hashcat — A Practical Guide – Medium
$ hashcat -h
Hashcat help menu
Working with Hashcat
Now that we know what Hashing and Hashcat are, let’s start cracking
some passwords.
https://medium.com/p/97b5d0d037e5/edit 5/10
12/6/22, 6:26 PM Editing Hacking with Hashcat — A Practical Guide – Medium
Let’s create two hashes: A MD5 hash and a SHA1 hash for the string
“Password123”. We are using a weak password to help you
understand how easy it is to crack these passwords.
We can store these hashes under the names md5.txt and sha1.txt to
use them when working with Hashcat.
Let’s dissect the syntax. We have used two flags, -m and -a . The -
m flag is used to specify the hash type and the -a flag is to specify
the attack mode. You can find the list of hash types and attack modes
here.
Let’s crack our md5 hash first. We will crack this hash using the
Dictionary mode. This is a simple attack where we provide a list of
words (RockYou) from which Hashcat will generate and compare
hashes.
We can specify the hash mode as “md5” using the value 0. But
Hashcat can also identify the hash type automatically for common
hash algorithms.
For the attack mode, we will be using the dictionary mode (0) using
the flag -a . Here is the full command.
https://medium.com/p/97b5d0d037e5/edit 6/10
12/6/22, 6:26 PM Editing Hacking with Hashcat — A Practical Guide – Medium
Hashcat will quickly find the value for the hash, in this case,
“Password123”.
Hashcat MD5 crack
Looks simple, doesn't it? Now let’s crack our SHA hash. The hash
mode value for SHA1 is 100. Here is the command.
Hashcat SHA1 crack
https://medium.com/p/97b5d0d037e5/edit 7/10
12/6/22, 6:26 PM Editing Hacking with Hashcat — A Practical Guide – Medium
passpass
pass123
passhello
123pass
123123
123hello
hellopass
hello123
hellohello
https://medium.com/p/97b5d0d037e5/edit 8/10
12/6/22, 6:26 PM Editing Hacking with Hashcat — A Practical Guide – Medium
The mask attack is out of scope for this article, but you can learn
more about mask attacks here.
Defending against Hashcat
The first and obvious step is to set strong passwords. The stronger
the password is, the harder it is to crack it. You can check if your
password has been exposed to the internet here.
To crack a salted password, the attacker should know both the hash
and salt values. This makes it harder to crack hashes using methods
such as Rainbow tables.
You can read this article to learn more about how Salts work in
password hashing.
Summary
Hashing is the method of using a mathematical function to generate
a random string. It is a one-way function and helps to secure data
such as user passwords.
https://medium.com/p/97b5d0d037e5/edit 9/10
12/6/22, 6:26 PM Editing Hacking with Hashcat — A Practical Guide – Medium
. . .
Loved this article? Join Stealth Security Weekly Newsletter and get articles
delivered to your inbox every Friday. You can also connect with me on
Linkedin.
https://medium.com/p/97b5d0d037e5/edit 10/10