Home Cracking Cracking WPA2 WPA with Hashcat in Kali Linux (BruteForce MASK based attack on Wifi passwords)

Cracking WPA2 WPA with Hashcat in Kali Linux (BruteForce MASK based attack on Wifi passwords)

by blackMORE

Cracking WPA2 WPA handshake with Hashcat

cudaHashcat or oclHashcat or Hashcat on Kali Linux is very flexible, so I’ll cover two most common and basic scenarios:

  1. Dictionary attack
  2. Mask attack

Dictionary attack

Grab some Wordlists, like Rockyou.

Read this guide Cracking Wifi WPA2 WPA passwords using pyrit cowpatty in Kali Linux for detailed instructions on how to get this dictionary file and sorting/cleaning etc.

First we need to find out which mode to use for WPA2 WPA handshake file. I’ve covered this in great length in Cracking MD5, phpBB, MySQL and SHA1 passwords with Hashcat on Kali Linux guide. Here’s a short rundown:

cudahashcat --help | grep WPA

So it’s 2500.

Now use the following command to start the cracking process:

cudahashcat -m 2500 /root/hs/out.hccap /root/rockyou.txt

cracking-wpawpa2-with-oclhashcat-cudahashcat-or-hashcat-on-kali-linux-bruteforce-mask-based-attack-blackmore-ops-2

Bingo, I used a common password for this Wireless AP. Took me few seconds to crack it. Depending on your dictionary size, it might take a while.

You should remember, if you’re going to use Dictionary attack, Pyrit would be much much much faster than cudaHashcat or oclHashcat or Hashcat. Why we are showing this here? Cause we can. :)

Another guide explains how this whole Dictionary attack works. I am not going to explain the same thing twice here. Read Cracking MD5, phpBB, MySQL and SHA1 passwords with Hashcat on Kali Linux for dictionary related attacks in full length.

Brute-Force Attack

Now this is the main part of this guide. Using Brute Force MASK attack.

To crack WPA WPA2 handshake file using cudaHashcat or oclHashcat or Hashcat, use the following command:

Sample:

cudahashcat -m 2500 -a 3 capture.hccap ?d?d?d?d?d?d?d?d

Where -m = 2500 means we are attacking a WPA2 WPA handshake file.

-a = 3 means we are using Brute Force Attack mode (this is compatible with MASK attack).

capture.hccap = This is your converted .cap file. We generated it using wpaclean and aircrack-ng.

?d?d?d?d?d?d?d?d = This is your MASK where d = digit. That means this password is all in numbers. i.e. 7896435 or 12345678 etc.

I’ve created a special MASK file to make things faster. You should create your own MASK file in similar way I explained earlier. I’ve saved my file in the following directory as blackmoreops-1.hcmask.

/usr/share/oclhashcat/masks/blackmoreops-1.hcmask

Do the following to see all available default MASK files provided by cudaHashcat or oclHashcat or Hashcat:

ls /usr/share/oclhashcat/masks/

In my case, the command is as follows:

cudahashcat -m 2500 -a 3 /root/hs/out.hccap  /usr/share/oclhashcat/masks/blackmoreops-1.hcmask

cracking-wpawpa2-with-oclhashcat-cudahashcat-or-hashcat-on-kali-linux-bruteforce-mask-based-attack-blackmore-ops-3

Sample .hcmask file

You can check the content of a sample .hcmask file using the following command:

tail -10 /usr/share/oclhashcat/masks/8char-1l-1u-1d-1s-compliant.hcmask

cracking-wpawpa2-with-oclhashcat-cudahashcat-or-hashcat-on-kali-linux-bruteforce-mask-based-attack-blackmore-ops-4

Edit this file to match your requirement, run Hashcat or cudaHashcat and let it rip.

Location of Cracked passwords

Hashcat or cudaHashcat saves all recovered passwords in a file. It will be in the same directory you’ve ran Hashcat or cudaHashcat or oclHashcat. In my case, I’ve ran all command from my home directory which is /root directory.

cat hashcat.pot

cracking-wpawpa2-with-oclhashcat-cudahashcat-or-hashcat-on-kali-linux-bruteforce-mask-based-attack-blackmore-ops-5

Conclusion

This guide explains a lot. But you should read read Wiki and Manuals from www.hashcat.net to get a better understanding of MASK and Rule based attacks because that’s the biggest strength of Hashcat.

Thanks for reading. Feel free to share this article. More on similar series:

 

Cracking Wifi WPA/WPA2 passwords

 

You may also like

36 comments

Aprhodite December 4, 2014 - 2:39 am

what if the password is: ‘abc123efgh’ what mask is best to crack it.? Will ?l?d?l?d?l?d?l? be able to crack it??

Reply
serg December 5, 2014 - 12:29 am

:~/Desktop# oclhashcat -m 2500 /root/Desktop/12AC7F.hccap /root/Desktop/newrockyou.txt
oclHashcat v1.30 starting…
Device #1: Tahiti, 2904MB, 1100Mhz, 32MCU
STOP! Unsupported or incorrect installed GPU driver detected!
You are STRONGLY encouraged to use the official supported GPU driver for good reasons
See oclHashcat’s homepage for official supported GPU drivers
You can use –force to override this but do not post error reports if you do so

RADEON R9 280X gigabyte with installed drivers for pyrit.

any idea what is missing ?

Reply
VinnyG January 10, 2015 - 7:29 am

You’ll never crack awpa password you dumb

Reply
dchen January 27, 2015 - 11:55 am

What ?a missing is space character. Most passphrase contains space characters. Therefore, ?a will never be able to crack a very common passphrase which has a space character.

Reply
blackMORE Ops January 27, 2015 - 9:33 pm

That means you just need to redo your mask.

Reply
balong March 30, 2015 - 12:55 pm

when i try this commnad:- cudahashcat –help | grep WPA
Output will be …
bash: cudahashcat: command not found
help me!

Reply
fake1 July 19, 2015 - 5:03 am

If you have nvidea graphic cards it is cudahashcat but if you have AMD it is oclhashcat

Reply
chirag moradiya January 31, 2015 - 7:48 pm

when i try this commnad:- cudahashcat –help | grep WPA
Output will be …
bash: cudahashcat: command not found
help me!

Reply
Arion September 3, 2015 - 12:55 pm

You need to have root access. Try sudo command.

Reply
jovdo November 8, 2015 - 11:16 pm

Try hashcat in stead of cudahashcat.

Reply
hluizmelo February 4, 2015 - 11:02 pm

Hello everybody!

I would like to capture encrypted frames, but I can’t. Help me, please.
Used the commands:

ifconfig wlan0 down
iwconfig wlan0 mode monitor
ifconfig wlan0 up

airodump-ng –bssid 9c:d6:43:a8:9d:60 -c 4 -w test2015 wlan0

My pcap file show only control frames: Clear-to-send, ack; and beacon frames.

I would like capture a bit stream encrypted 1001110110101001 by data frames…. How can I do it?

Thank you very much.

Reply
Vendetta March 3, 2015 - 11:54 pm

Your explanation is way better than the shit they gave back in wiki.Thanks for your patience.Appreciate it.

Reply
blackMORE Ops March 6, 2015 - 10:05 pm

Problem with Wiki is you get more than you ask for! I gave a very simple but working explanation. Once someone is used to that, they can start making complex ones.
Thanks for your compliment. Cheers,
-BMO

Reply
frafri (@frafrii) March 12, 2015 - 9:33 pm

Sir, what is the difference between Mask attack and dictionary attack ?
THank you !
Great tutorial, I always revisit this tutorial.

Reply
Juno September 10, 2017 - 3:21 pm

Thanks for this guide. It is great as a primer. From here you can dive deeper to understand the working parts in more detail. Awesome work!

Reply
jon May 16, 2015 - 4:56 pm

Can anyone help me eith issue with hashcat and cudahashcat64 i have all drivers installed correctly but hashcat is 1000 time faster than cudahashcat. to crack 8 letter including upercase and digits passwords takes 10 years in cudahashcat but when piped to pyrit using hahscat 1hr 12 Minutes the VGA driver is gtx760 and works with no errors.
Also running hashcat displays 42million words per second when crunching
But in cudahashcat it shows around 40,000 pks .
Hardware intel i7 4820k 16 Gb ram Nvidia gtx 760 1gb ram

Reply
Stefan July 28, 2015 - 11:12 pm

Is this possible without an Nvidia or Amd graphic card ? because i am using an standard intel videocard hope ro hear you soon

Reply
blackMORE Ops July 29, 2015 - 11:41 pm

Hi Stefan,
You can always use hashcat instead. Thanks,
-BMO

Reply
ParseMeHard September 2, 2015 - 1:13 pm

When running the conversion from .cap to .hccap, I get a “Failed to create Hashcat capture file” error :(

Any help?

Reply
Nano October 2, 2015 - 11:47 pm

This video leads me here, just posting so you know that the tutorial works

Reply
Peter April 22, 2016 - 1:07 am

Amazing tutorial! Thank you so much!

Is there any disadvantage using just hashcat instead of oclhashcat or cudahashcat ?

Reply
Nate April 23, 2016 - 5:09 am

Hi first of all many thanks for taking the time for this tutorial.

I am currently stuck in that I try to use the cudahashcat command but the parameters set up for a brute force attack, but i get “bash: cudahashcat: command not found”.

I have followed the previous instructions and have my graphics card showing as a CUDA device when i use the pyrit list_cores command and also when running a benchmark.

My card is a GTX 970 and I am running on Kali 4.4.0 amd-64

Using “hashcat” works fine but I assume that it is not using my GPU.

Any help would be appreciated!

Thanks

Reply
Paul Raver May 5, 2016 - 8:11 am

Any device running a WN823N chip is confirmed on mon and injection.

Reply
ForTN0X May 28, 2016 - 8:24 pm

With the command aircrack-ng I will always get this:
Opening hs/haha.cap
Read 0 packets.

No networks found, exiting.

Any sugestions what’s going on here?

Reply
ForTN0X May 28, 2016 - 9:31 pm

By the way I’ve used wifite -wpa -cowpatty to got my Handshakes. This worked instandly. Maybe is this the failure, I don’t know.

Reply
krown77 December 11, 2016 - 2:34 am

hey ho%**

i got hashcat running nicely. i have a converted handshake file i want sorted but i want to know
how much faster is cudahashct? than regular hashcat?

salutation and supplications

Reply
Mister Mister December 13, 2016 - 4:10 am

Significantly.

Reply
urootf December 29, 2016 - 6:24 am

Am getting this error as hashcat is starting

ERROR: clGetDeviceIDs () : -1 : CL_DEVICE_NOT_FOUND

Where could i have gone wrong? What is it exactly am I missing?
Thank in advance

Reply
HackERpro January 2, 2017 - 5:11 am

I think the problem is with your graphics card driver. Make sure that’s up to date…

http://lists.alioth.debian.org/pipermail/pkg-nvidia-devel/2013-January/008420.html

Reply
krown77 March 22, 2017 - 5:04 am

i got this question, how fast, in keys per sec, is cudahashcat quicker than usual cpu hashcat?

many thanks and cranks

Reply
Martynas June 26, 2017 - 9:25 pm

Hello,
I have same gpu gtx210. But i get this error: hashcat: this device local mem size is too small.

Reply
Salman September 13, 2017 - 2:54 pm

Sir …. I have intel HD Graphic cars what should I install???? Plzzzzz

Reply
blackMORE Ops October 10, 2017 - 8:44 pm

Nothing required for Intel cards. It uses standard drivers.

Reply
Rose October 14, 2017 - 10:04 pm

Question, but not related to post
Would a D-Link DWA-125 work for kali linux as a wireless card?

Reply
fdfdf May 21, 2018 - 9:06 pm

windows.alert(“wdwe”)

Reply
pppppp August 15, 2018 - 9:29 am

“>alert();

Reply

Leave your solution or comment to help others.

This site uses Akismet to reduce spam. Learn how your comment data is processed.