The Broadband Guide
search advanced
 forgot password?

How To Crack WEP and WPA Wireless Networks

Cracking WEP, WPA-PSK and WPA2-PSK wireless security using aircrack-ng
2008-11-21 (updated: 2013-02-25) by
Tags: , , , , , , , , , , , , , , , ,



With the popularity of wireless networks and mobile computing, an overall understanding of common security issues has become not only relevant, but very necessary for both home/SOHO users and IT professionals alike. This article is aimed at illustrating current security flaws in WEP/WPA/WPA2.

Successfully cracking a wireless network assumes some basic familiarity with networking principles and terminology, as well as working with command-line tools. A basic familiarity with Linux can be helpful as well.

Disclaimer: Attempting to access a network other than your own, or one you have permission to use is illegal insome U.S. jurisdictions. Speed Guide, Inc. are not to be held liable for any damages resulting from the use or misuse of the information in this article.

To successfully crack WEP/WPA, you first need to be able to set your wireless network card in "monitor" mode to passively capture packets without being associated with a network. This NIC mode is driver-dependent, and only a relatively small number of network cards support this mode under Windows.

One of the best free utilities for monitoring wireless traffic and cracking WEP/WPA-PSK keys is the aircrack-ng suite, which we will use throughout this article. It has both Linux and Windows versions (provided your network card is supported under Windows). The aircrack-ng site has a comprehensive list of supported network cards available here: NIC chipset compatability list.

If your network card is not supported under Windows, one can use a free Linux Live CD to boot the system. BackTrack is probably the most commonly used distribution, since it runs from a Live CD, and has aircrack-ng and a number of related security auduting tools already installed.

For this article, I am using aircrack-ng on another Linux distro (Fedora Core) on a Sony Vaio SZ-680 laptop, using the built-in Intel 4965agn network card. If you're using the BackTrack CD aircrack-ng is already installed, with my version of linux it was as simple as finding it with:

yum search aircrack-ng
yum install aircrack-ng

The aircrack-ng suite is a collection of command-line programs aimed at WEP and WPA-PSK key cracking. The ones we will be using are:

airmon-ng - script used for switching the wireless network card to monitor mode
airodump-ng - for WLAN monitoring and capturing network packets
aireplay-ng - used to generate additional traffic on the wireless network
aircrack-ng - used to recover the WEP key, or launch a dictionary attack on WPA-PSK using the captured data.


1. Setup (airmon-ng)

As mentioned above, to capture network traffic wihtout being associated with an access point, we need to set the wireless network card in monitor mode. To do that under linux, in a terminal window (logged in as root), type:

iwconfig (to find all wireless network interfaces and their status)
airmon-ng start wlan0   (to set in monitor mode, you may have to substitute wlan0 for your own interface name)

Note: You can use the su command to switch to a root account.

Other related Linux commands:

ifconfig (to list available network interfaces, my network card is listed as wlan0)
ifconfig wlan0 down (to stop the specified network card)
ifconfig wlan0 hw ether 00:11:22:33:44:55 (change the MAC address of a NIC - can even simulate the MAC of an associated client. NIC should be stopped before chaning MAC address)
iwconfig wlan0 mode monitor (to set the network card in monitor mode)
ifconfig wlan0 up (to start the network card)
iwconfig - similar to ifconfig, but dedicated to the wireless interfaces.


2. Recon Stage (airodump-ng)

This step assumes you've already set your wireless network interface in monitor mode. It can be checked by executing the iwconfig command. Next step is finding available wireless networks, and choosing your target:

airodump-ng mon0 - monitors all channels, listing available access points and associated clients within range. It is best to select a target network with strong signal (PWR column), more traffic (Beacons/Data columns) and associated clients (listed below all access points). Once you've selected a target, note its Channel and BSSID (MAC address). Also note any STATION associated with the same BSSID (client MAC addresses). 

Click to expand
running airodump-ng displays all wireless access points and associated clients in range, as well as MAC addresses, SSIDs, signal levels and other information about them.

WEP is much easier to crack than WPA-PSK, as it only requires data capturing (between 20k and 40k packets), while WPA-PSK needs a dictionary attack on a captured handshake between the access point and an associated client which may or may not work.


3. Capture Data (airodump-ng)

To capture data into a file, we use the airodump-ng tool again, with some additional switches to target a specific AP and channel. Most importantly, you should restrict monitoring to a single channel to speed up data collection, otherwise the wireless card has to alternate between all channels. Assuming our wireless card is mon0, and we want to capture packets on channel 6 into a text file called data:

airodump-ng -c 6 bssid 00:0F:CC:7D:5A:74 -w data mon0  (-c6 switch would capture data on channel 6, bssid 00:0F:CC:7D:5A:74 is the MAC address of our target access point, -w data specifies that we want to save captured packets into a file called "data" in the current directory, mon0 is our wireless network adapter)

Click to expand
Running airodump-ng on a single channel targeting a specific access point

You typically need between 20,000 and 40,000 data packets to successfully recover a WEP key.
One can also use the "--ivs" switch with the airodump-ng command to capture only IVs, instead of whole packets, reducing the required disk space. However, this switch can only be used if targeting a WEP network, and renders some types of attacks useless.


4. Increase Traffic (aireplay-ng) - optional step for WEP cracking

An active network can usually be penetrated within a few minutes. However, slow networks can take hours, even days to collect enough data for recovering the WEP key.

This optional step allows a compatible network interface to inject/generate packets to increase traffic on the wireless network, therefore greatly reducing the time required for capturing data. The aireplay-ng command should be executed in a separate terminal window, concurrent to airodump-ng. It requires a compatible network card and driver that allows for injection mode.

Assuming your network card is capable of injecting packets, in a separate terminal window try:

aireplay-ng -3 -b 00:0F:CC:7D:5A:74 -h 00:14:A5:2F:A7:DE -x 50 wlan0
-3  --> this specifies the type of attack, in our case ARP-request replay
-b ..... --> MAC address of access point
-h ..... --> MAC address of associated client from airodump
-x 50 --> limit to sending 50 packets per second
wlan0 --> our wireless network interface

Click to expand
aireplay-ng allows for injecting packets to greatly reduce the time required to recover a WEP key

To test whether your nic is able to inject packets, you may want to try: aireplay-ng -9 wlan0. You may also want to read the information available -here-.
To see all available replay attacks, type just: aireplay-ng


5. Crack WEP (aircrack-ng)

WEP cracking is a simple process, only requiring collection of enough data to then extract the key and connect to the network. You can crack the WEP key while capturing data. In fact, aircrack-ng will re-attempt cracking the key after every 5000 packets.

To attempt recovering the WEP key, in a new terminal window, type:

aircrack-ng data*.cap  (assuming your capture file is called data...cap, and is located in the same directory)

Click to expand
aircrack-ng can successfully recover a WEP key with 10-40k captured packets. The retreived key is in hexadecimal, and can be entered directly into a wireless client omitting the ":" separators

If your data file contains ivs/packets from different access points, you may be presented with a list to choose which one to recover.
Usually, between 20k and 40k packets  are needed to successfully crack a WEP key. It may sometimes work with as few as 10,000 packets with short keys.


6. Crack WPA or WPA2 PSK (aircrack-ng)

WPA, unlike WEP rotates the network key on a per-packet basis, rendering the WEP method of penetration useless. Cracking a WPA-PSK/WPA2-PSK key requires a dictionary attack on a handshake between an access point and a client. What this means is, you need to wait until a wireless client associates with the network (or deassociate an already connected client so they automatically reconnect). All that needs to be captured is the initial "four-way-handshake" association between the access point and a client. Essentially, the weakness of WPA-PSK comes down to the passphrase. A short/weak passphrase makes it vulnerable to dictionary attacks.

To successfully crack a WPA-PSK network, you first need a capture file containing handshake data. This can be obtained using the same technique as with WEP in step 3 above, using airodump-ng.

You may also try to deauthenticate an associated client to speed up this process of capturing a handshake, using:

aireplay-ng --deauth 3 -a MAC_AP -c MAC_Client mon0  (where MAC_IP is the MAC address of the access point,  MAC_Client is the MAC address of an associated client, mon0 is your wireless NIC).

The command output looks something like:
12:34:56  Waiting for beakon frame (BSSID: 00:11:22:33:44:55:66) on channel 6
12:34:56 Sending 64 directed DeAuth. STMAC: [00:11:22:33:44:55:66]   [ 5:62 ACKs]

Note the last two numbers in brackets [ 5:62 ACKs] show the number of acknowledgements received from the client NIC (first number) and the AP (second number). It is important to have some number greater than zero in both. If the first number is zero, that indicates that you're too far from the associated client to be able to send deauth packets to it, you may want to try adding a reflector to your antenna (even a simple manilla folder with aluminum foil stapled to it works as a reflector to increase range and concentrate the signal significantly), or use a larger antenna.

Click to expand
Simple antenna reflector using aluminum foil stapled to a manilla folder can concentrate the signal and increase range significantly. For best results, you'll have to place the antenna exactly in the middle and change direction as necessary. Of course there are better reflectors out there, a parabolic reflector would offer even higher gain, for example.

Once you have captured a four-way handshake, you also need a large/relevant dictinary file (commonly known as wordlists) with common passphrases. See related links below for some wordlist links.

You can, then execute the following command in a linux terminal window (assuming both the dictionary file and captured data file are in the same directory):

aircrack-ng -w wordlist capture_file (where wordlist is your dictionary file, and capture_file is a .cap file with a valid WPA handshake)

Additional Notes:
Cracking WPA-PSK and WPA2-PSK only needs 4 packets of data from the network (a handshake). After that, an offline dictionary attack on that handshake takes much longer, and will only succeed with weak passphrases and good dictionary files. A good size wordlist should be 20+ Megabytes in size, cracking a strong passphrase will take hours and is CPU intensive.

Cracking WPA/WPA2 usually takes many hours, testing tens of millions of possible keys for the chance to stumble on a combination of common numerals or dictionary words. Still, a weak/short/common/human-readable passphrase can be broken within a few minutes using an offline dictionary attack. My record time was less than a minute on an all-caps 10-character passphrase using common words with less than 11,000 tested keys! A modern laptop can process over 10 Million possible keys in less than 3 hours.

WPA hashes the network key using the wireless access point's SSID as salt. This prevents the statistical key-grabbing techniques that broke WEP, and makes hash precomputation more dificult because the specific SSID needs to be added as salt for the hash. There are some tools like coWPAtty that can use precomputed hash files to speed up dictionary attacks. Those hash files can be very effective (sicne they're much less CPU intensive and therefore faster), but quite big in size. The Church of WiFi has computed hash tables for the 1000 most common SSIDs against a million common passphrases that are 7Gb and 33Gb in size...


7. Crack WPA using the WPS Vulnerability (Reaver)

Many Wi-Fi devices are aslo vulnerable to a WPS (Wi-Fi Protected Setup) vulnerability described in US-CERT TA12-006A Alert. WPS provides simplified mechanisms to secure wireless networks, most often using a PIN as a shared secret to authenticate clients and share the WEP/WPA/WPA2 passwords and keys. The external PIN exchange mechanism is susceptible to brute-force attacks that allow for bypassing wireless security in a relatively short time (few hours). The only remedy is to turn off WPS, or use an updated firmware that specifically addresses this issue.

A free Linux open-source tool called Reaver is able to exploit the WPS vulnerability. To launch an attack:

1. Install Reaver -
2. Set your network adapter in monitor mode as described above, using:

ifconfig wlan0 down
iwconfig wlan0 mode monitor
ifconfig wlan0 up

Alternatively, you can put your network card in monitor mode using: airmon-ng start wlan0 (this will produce an alternate adapter name for the virtual monitor mode adapter, usually mon0 )

3. Before using Reaver to initiate a brute-force WPS attack, you may want to check which access points in the area have WPS enabled and are vulnerable to the attack. You can identify them using the "wash" Reaver command as follows:

wash -i mon0 --ignore-fcs

4. Run Reaver (it only requires two inputs: the interface to use, and the MAC address of the target)

reaver -i mon0 -b 00:01:02:03:04:05 -vv

There are a number of other parameters that one can explore to further tweak the attack that are usually not required, such as changing the delay between PIN attempts, setting the tool to pause when the access point stops responding, responding to the access point to clear out failed attempts, etc. The above example adds "-vv" to turn on full verbose mode, you can use "-v" instead for fewer messages. Reaver has a number of other switches (check with --help), for example " -c11" will manually set it to use only channel 11, " --no-nacks" may help with some APs.

5. Spoof client MAC address if needed. In some cases you may want/need to spoof your MAC address. Reaver supports MAC spoofing with the --mac option, however, for it to work you will have to change the MAC address of your card's physical interface (wlan0) first, before you specify the reaver option to the virtual monitor interface (usually mon0). To spoof the MAC address:

ifconfig wlan0 down
ifconfig wlan0 hw ether 00:11:22:33:44:55
ifconfig wlan0 up
airmon-ng start wlan0
reaver -i mon0 -b .... -vv --mac=00:11:22:33:44:55

An attack using Reaver typically takes between 4 and 8 hours (provided WPS requests are not being limited by the AP), and returns the SSID, WPS PIN and WPA passphrase for the target network. Note that some routers may lock you out for a few minutes if they detect excessive failed WPS PIN attempts, in such cases it may take over 24 hours.

Some routers (including most popular Cisco/Linksys models) will NOT turn off WPS even if turned off via the radio button in their web admin interface. You may be able to turn it off using third-party firmware, such as DD-WRT (wich does not support WPS).
Reportedly, some models/vendors/ISPs all come configured with a default pin. Common pins are 12345670, 00005678, 01230000, etc. Reaver attempts known default pins first.
Reaver comilation requires libpcap (pcap-devel) and sq3-devel (sqlite3-dev) installed, or you will get a "pcap library not found" error.


Troubleshooting Tips

Even with the above tools properly installed, it is common to get a few errors/warnings during the attacks, usually related to timeouts, poor signal, or interface driver not supporting monitor/injection modes. Here are some points to consider:

1. Is your adapter properly set in monitor mode ?
2. Does the adapter driver support injection (is aireplay-ng working) ?
3. Do you have to spoof your MAC address (if AP limits MACs, change both physical and virtual monitor interface) ?
4. Do you have a good signal to the AP ?
5. Do you see associated clients (for WPA handshake capture) ?
6. Do you see WPS pin count incrementing (Reaver WPA cracking) ?
7. Does the target AP support WPS and is it enabled (for WPS attacks, check with the "wash" command) ?


Final Thoughts

As demonstrated above, WEP cracking has become increasingly easier over the years, and what used to take hundreds of thousands packets and days of capturing data can be accomplished today within 15 minutes with a mere 20k data frames. Simply put, cracking WEP is trivial.

WPA/WPA2-PSK encryption is holding its ground if using a strong, long key. However, weak passphrases are vulnerable to dictionary attacks. WPA/WPA2 may be on borrowed time as well, according to some recent news.

The WPS vulnerability renders even WPA/WPA2 secured wireless networks very vulnerable. An extensive list of vulnerable devices is available here: google docs spreadsheet. Note that some routers (including most popular Cisco/Linksys models) will NOT turn off WPS even if turned off via the radio button in their web admin interface. You may be able to turn it off using third-party firmware, such as DD-WRT (which does not support WPS).


Related Links
reaver (WPS vulnerability)
WPA Wordlists - Torrent search
Openwall wordlist collection
Wordlists mirror
the A.R.G.O.N. - wordlists
Church of WiFi hash tables

  User Reviews/Comments:
by anonymous - 2010-08-21 20:29
I found this article extremely educational. I now see not only that WEP is not as secure as WPA, but why, and how my network is likely to be attacked. Thank you.
by anonymous - 2010-08-24 09:49
I am using a wireless adapter "AWUS036H" and i want to crack into a wireless network connection WPA. I tried using aircrack-ng but there are wierd symbols and it shows master key and transient key. Can u help???
by anonymous - 2010-09-13 13:43
As a LEO (Law Enforcement Officer) I would advise any individual whether private, public, corporate, or government to prosecute hackers !
by GingerBreadMan - 2010-09-24 01:27
Hey LEO ... you need to catch them first dahhhh. the world has moved on LEO and you are still playing with your gun. wait til some hacker swithes the light off on you...Oops LEO shot himself in the dark and died. hum sad story.
by anonymous - 2010-10-06 23:06
On a totally new subject.

I seriously need help with using aircrack-ng can someone give me a simple guide on how to use this program under root.
by Harold420 - 2010-10-19 14:13
If I have a home WiFi network what is the best way to protect it?

How much would these help?

Using a 63 character randomly generated hex number for the password?

Requiring the mac address of each device

Any suggestions
by Philip - 2010-10-20 09:24
The best way to protect it is using WPA2 encryption (avoid WEP as it is easily hacked), and a strong password as you've already guessed.

MAC address filtering, or disabling SSID broadcast do not add much to the above.
by Kitz - 2010-10-22 16:33
Hi Philip

Can you help?

I have Intel 4965AGN under Windows 7

what do i have to instal to prior to aircrack ?
1. I understand i need a linuxbox? what would you sugest.
2. I've read on the forums about the need to inject the driver for 4965 under the linuxbox or something like that. Could you expand on that?
3. Any additional tips or problems you think i might encounter.

and sorry about the bad english.
by reysaj - 2010-11-05 00:01
Does it work using Windows 7? I need your immediate reply, please.
by webtravelvietnam - 2010-11-05 05:53
thanks you so much!
by kox - 2010-11-11 19:02
I got *.cap file when I cracking WPA PSK (TKIP) but I don't have good dictionary to find password, it requires much time I thought.
by anonymous - 2011-01-08 23:57
my original window is window vista and now upgrade to window 7 ultimate (64 bit) .can I use air-crack ng in current system of window .
thank in advance.
by jatt - 2011-01-18 09:05
wpa impossible
by Philip - 2011-01-18 09:23
Actually, with a good wordlist of common passwords, cracking WPA works well over 60% of the time in my lmited testing experience. This could be much higher, given enough time and large enough dictionary/computing power.

The key being, one should use longer, non-dictionary passphrases with WPA.
by anonymous - 2011-02-02 06:14

If I suspect that someone has cracked my internet connection, is there any way to monitor the traffic on my internat connection? What I would like to see is which MAC address uses my connection, when they connect, and the amount of data transferred (I suppose that information about the servers the machines connects to or the nature of the data transferred is out of reach).

Is that possible? Or are they better means of monitoring the traffic on your own connection and detecting possible hacks?
by nye - 2011-02-05 07:50
great thanks
i already did this without understanding a thing (following a tutorial)
now thx to u i understand what i'm doin
excellent job thx for posting
i still have some problems but i'll try to solve them myself
by Philip - 2011-02-05 11:04
Monitoring wireless clients depends on the device they're connected to, i.e. your wireless AP/router. Take a look at our routers database for information on how to login to your router and look through its menus. Many devices will have a page with list of currently connected clients, some will even have statistics.
by anonymous - 2011-02-07 16:34
how do you do this dictionary atack? where can i get this dictionary file? i try google but it give me a different dictionary (i think...)
by Philip - 2011-02-08 14:12
You can just click the "WPA Wordlists" link at the bottom of the article, in the "Related Links" section.
by anonymous - 2011-03-22 22:23
I can't get first base!!!! Each and every time I type airmon-ng, I get the three column headers (Interface, Chipset, Driver) but there is nothing under them!

What gives? Anybody got some help for me?
by Malaysian - 2011-04-24 21:14
your information guided me a lot...tq
by anonymous - 2011-06-22 12:38
Hi all,

what you can also do if you need more help is to go to youtube and there are detail instructions on how to hack into your own wireless network.

Hope this helps.
by anonymous - 2011-07-10 16:53
is a pavilion dv6 with win 7 compatible
by bonzai - 2011-07-13 11:49
can it be used with win7?
by anonymous - 2011-10-03 11:47
Right. As an example...Just because I look at a lot of porn doesn't mean that it's ethically wrong or that the people demonstrating the techniques are liable or responsible for how I may utilize the content, though I do only use my newfound techniques on those allowing me access in this case...the concept is the same however.
News Glossary of Terms FAQs Polls Cool Links SpeedGuide Teams SG Premium Services SG Gear Store
Registry Tweaks Broadband Tools Downloads/Patches Broadband Hardware SG Ports Database Security Default Passwords User Stories
Broadband Routers Wireless Firewalls / VPNs Software Hardware User Reviews
Broadband Security Editorials General User Articles Quick Reference
Broadband Forums General Discussions
Advertising Awards Link to us Server Statistics Helping SG About