Professional Documents
Culture Documents
WEP: Dead Again The Feds Can Own Your WLAN Too Cracking WEP: Step by Step Cracking WEP and WPA Wireless Networks
The second thing working against your packet collection efforts is that only certain "interesting" or "weak" IVs are vulnerable to attack. Kismet also tells you how many of these have been gathered, although it may not use the same counting method as the various cracking tools. To make matters more difficult, wireless manufacturers responded to the FMS attack by filtering out the majority of weak IVs that their access points and wireless cards transmit. Unless your target network is using old equipment, chances are you'll have to collect no less than ten million encrypted packets to crack a WEP key using these older tools. In early 2002, h1kari released a tool called dwepcrack (part of the bsd-airtools package) that improved upon the existing implementations of the FMS attack. Although dwepcrack did a good job of advancing the practical implementation of statistical WEP cryptanalysis, its improvements were only incremental.
Aircrack
The first tool in our new WEP cracking toolbox is aircrack by Christophe Devine. Implementing KoreK's attacks as well as improved FMS, aircrack provides the fastest and most effective statistical attacks available. To give aircrack a try, simply collect as many packets as possible from a WEP
encrypted wireless network, save them as a pcap file, and then start aircrack from the command line.
The higher the fudge factor, the more branches aircrack will take. This generally results in a longer execution time unless a successful crack happens early in the process. The following graph shows the time of execution as reported by aircrack (not counting file loading and parsing) for a particular data set with various fudge factors. Blue dots represent the time required for a successful crack and red dots represent the time spent in a failed attempt.
If the default fudge factor (two) fails, I usually double it for each subsequent attack on the same data set. By terminating any attack that takes longer than five or ten minutes, I have had good luck finding a successful fudge factor fairly quickly. One of the nice features of aircrack is that it works for both 64 bit and 128 bit WEP keys by default. If you know the key length of the target network, giving the length to aircrack as a command line option can speed up the process.
WepLab
Although not quite as successful in my tests, Jose Ignacio Sanchez's WepLab provides an alternative implementation of the KoreK attacks that can be nearly as effective as aircrack, with a little experimentation. Similar to aircrack's fudge factor, WepLab provides a probability adjustment with its --perc command line option. The default --perc setting of 50% is fairly aggressive and results in relatively few branches, while higher settings increase the number of branches taken. In addition to excellent statistical attacks, WepLab provides brute force and dictionary cracking attacks that can be very effective. This combination of techniques makes WepLab an essential tool.
Unique IVs
16775533 16775167 16275925 12860342 12361369 11743639 11693841 5031233 7779299 4069824 3914568 3914553 3864743 978652 978633 974902 684992 681288 587184 489293 489286 391465 391433 293596 293579
Air crack
Failed Failed Failed Failed Failed Failed Failed Failed Failed 52 Failed 48 48 Failed Failed Failed 8 Failed Failed 8 15 5 Failed Failed Failed
Dwep crack
Error Failed Failed Error Failed Error Failed Error Failed Failed Error Error Failed Error Error Failed Error Failed Error Error Error Error Error Error Error
Although aircrack was successful with the greatest number of data sets, it did not perform as well as I expected with the default fudge factor. In fact, beyond about four million packets, its success rate
with default options noticeably declined with the addition of more packets. This problem was easily remedied, however, by increasing the fudge factor. A fudge factor of four was successful in nearly every case. In the few cases in which a fudge factor of four did not work, I was able to find a successful setting in the five to twenty range. WepLab's nearly complete failure with default options was surprising, but a little experimentation resulted in a --perc setting of 95% that rivaled even aircrack's best results. For some data sets, WepLab was more successful than aircrack; for others, aircrack was the winner. Overall, both tools yielded outstanding results with minor tweaking, though aircrack edged out WepLab in the smaller data sets. AirSnort's success rate matched my expectations quite closely, cracking nearly every key with ten million or more packets but failing most of the time when using a smaller data set. AirSnort's speed beat out aircrack and WepLab in every case. Of course, an extra minute or two is rarely a concern, so the superior cracking ability of the KoreK attacks with far less required input puts WepLab and aircrack well above AirSnort in my book. The most unexpected results were the total failures of WEPCrack and dwepcrack with all data sets. WEPCrack came up with as many as eleven out of thirteen correct bytes but always included incorrect bytes in its final result. Lacking a process to verify the correctness of a key, WEPCrack produced a false positive result every time. dwepcrack failed in every case, complaining of either "insufficient ivs," the inexplicable error, "unable to find a valid data packet in logfile," or, for my largest data set, "File too large." As the tests were performed under Linux, perhaps dwepcrack would be more successful in its native BSD environment.
dictionary, these tools result in a successful crack surprisingly often. Although both performed dictionary attacks successfully in my tests, WepLab executed faster while WepAttack provided the convenience of multiple simultaneous attack modes. If a dictionary attack fails, an optimized brute force attack based on the vendor's passphrase method may be fruitful. For devices that use null terminated ASCII keys, WepLab offers a brute force attack that only tries ASCII bytes, resulting in a somewhat smaller (though still generally too large) key space. For the more common MD5 hashed passphrases, dwepcrack can execute an optimized brute force attack for 64 bit keys. This method, devised and first implemented by Tim Newsham, dramatically reduces the potential key space from 2^40 to 2^21 possible keys, resulting in an extremely fast attack.
Notes:
Because a majority of the tools refer to 64 bit and 128 bit key lengths, this article adopts the convention. It is important to realize, however, that the secret portion of a 64 bit key is only 40 bits and the secret portion of a 128 bit key is only 104 bits. All tests were performed with a 1.6GHz Pentium-M laptop running Gentoo Linux (2.6.8.1 kernel). Linux was chosen for the tests in order to accommodate the greatest number of tools. Some of the tools are also available for OS X, Windows, and/or various BSDs. In addition, there are a few tools for the other platforms that are not available for Linux. None of these, however, appear to implement the KoreK attacks except for the current development version of KisMAC.
testers.pcap - source: http://weplab.sourceforge.net/ Ideally, the input data sets would come from a variety of source networks with varied hardware and WEP keys. Although the results are not fully comprehensive, the spot checks against various networks generally agree with the test results.
Part 2
Introduction
In part one we examined the latest generation of passive WEP cracking tools that use statistical or brute force techniques to recover WEP encryption keys from captured wireless network traffic. This time, in the second and final article, we take a look at active tools that use 802.11 transmissions to attack WEP networks. All of these active wireless attack techniques discussed in this article require the ability to inject arbitrary packets onto a wireless network. Although a variety of injection methods are available, most require Linux, are unsupported, and use hacked drivers that have support and availability problems. All of them require at least one wireless PCMCIA card based on the Prism2 chipset (such as the Senao 2511-CD-PLUS). Fortunately, the Auditor Security Collection [ref 1] live cd-rom can save you a number of headaches as it includes ready-to-use drivers for several active attack tools. Beware of network disruptions that can be caused by active attacks. Using these tools may have unpredictable effects in various environments. In my testing, I have encountered a few systems that had to be rebooted in order to function again after being bombarded with injected packets.
Can you find a TCP three-way handshake? Can you find an HTTP transaction? What hosts transmit/receive the most bytes/packets? Does any traffic occur with a distinct periodicity (like POP3 every 5 minutes)? Can you find any ARP traffic? (hint: frame.pkt_len==68 and wlan.da==ff:ff:ff:ff:ff:ff)
No wireless network based on WEP provides protection against replay attacks. With the right tools, you can take any captured packet and reinject it back onto the network. The packet will be correctly encrypted even though you have no idea of its contents. Then again, you may have a pretty good guess as to its contents based on traffic analysis. You might choose something that is likely to be an ARP request, hoping that it will generate a response from another host on the network. If you're right, you could replay the same packet hundreds or even thousands of times per second, forcing that host to spew an enormous stream of responses, individually encrypted with different IVs. This method described is exactly the method used by aireplay, a tool that comes with aircrack [ref 3]. A screenshot of aireplay is shown below in Figure 1. As we discovered in part one, both aircrack and WepLab [ref 4]are capable of cracking WEP keys after collecting just a few hundred thousand packets. With a successful aireplay attack, you can generate that many packets in just a few minutes. Therefore, people who say that re-keying every 10 minutes makes WEP unbreakable are dead wrong. Per-session, per-user keys also don't stand a chance against this attack. WEP is truly dead. . . again.
The Auditor Security Collection live cd-rom makes it relatively easy to try aireplay because it includes aircrack's patched hostap driver by default, but you will need two wireless cards with at least several inches distance between their antennas. You may find it easier to use two laptops, one with a Prism2 card to replay captured packets, and a second to capture all the new traffic that is generated. Be prepared to spend some time finding an appropriate packet to replay; you may need to save individual packets with Ethereal and feed them to aireplay. Another tool that implements a similar attack has been around for much longer in the BSD world. Part of OpenBSD's Wnet, reinj performs the same attack as aireplay and does it all with just one Prism2 card (as does the latest beta of aireplay). Whichever tool you use to generate traffic, I recommend WepLab or aircrack for cracking the WEP key.
To try out WEPWedgie, you'll need a system running a Linux 2.4 kernel, a Prism2 card, and Abaddon's AirJack [ref 7] driver. Unfortunately the Auditor CD's 2.6 kernel isn't supported by AirJack, so you'll have to prepare a system on your own. You might find the Wi-Fi Dog of War [ref 8] instructions helpful to get AirJack working.
You can use the Auditor CD and a single Prism2 card to try chopchop. Use the switch-to-wlanng script that Auditor provides, pop the card out and then back in again, and the linux-wlan-ng driver will be working, complete with KoreK's injection modifications.
Conclusion
Some vendors continue to sell products that completely lack reasonable wireless security features. In just two months since the publication of part one of this article, I've encountered multiple brand new devices, including Wi-Fi VOIP phones and an access point provided by a cable Internet provider, that provide no encryption capability other than WEP. As long as this continues, white hats and black hats alike will keep improving the attack techniques that render WEP even worse than useless. For the most part, the newer WEP attack tools exploit vulnerabilities that were described in theory four or more years ago. Perhaps people will learn from the history of WEP the lesson that theoretical vulnerabilities will become real vulnerabilities. Until they do, you can use these penetration testing tools to assess the weaknesses of your own network and maybe even convince someone that change is needed.
assigned it a SSID of NETGEARWEP. He encrypted the access point with a 128 bit key - made by just keying in random letters and numbers. Note that normally, you have to find wireless networks before you can crack them. The two wireless scanning tools of choice are Netstumbler for Windows or Kismet for Linux. Since the other WEP cracking tools are mainly Linux-based, most people find it easier to stick with Kismet, so they don't have to switch between Windows and Linux.
Another FBI agent started Kismet and immediately found the NETGEARWEP access point. Just for fun, a third agent used his laptop and ran FakeAP, a program that confuses scanning programs by putting up fake access points.
Attack!
After a target WLAN is found, the next step is to start capturing packets and convert them into pcap (short for packet capture) format. These pcap files will then be processed by other programs. Many programs, both commercial and open source, can be used to capture packets, but the two favorites seem to be Kismet or Airodump (now part of Aircrack). Ideally, one laptop should be scanning, while another laptop will be running the attack - which is what the FBI team did. About half a dozen different software tools were then used by the FBI team, and they are listed - along
with their download links - at the end of the article. Thankfully, the Auditor's Security Collection, which we reviewed last year, is a live CD that has all of these tools already installed. Even the FBI likes this distribution.
If a hacker is lucky enough to find an extremely busy wireless network, passive sniffing should provide enough good packets to allow the WEP key to be recovered. In most cases, however, an active attack or series of attacks are needed to jump start the process and produce more packets. Note that active attacks generate wireless traffic that can itself be detected and possibly alert the target of the attack. The FBI team used the deauth feature of void11 to repeatedly disassociate the laptop from the access point. Desired additional traffic was then generated as Windows XP tried to re-associate back to the AP. Note that this is not a particularly stealthy attack, as the laptop user will notice a series of "Wireless Network unavailable" notifications in the taskbar of their desktop screen. Another attack method the FBI team used is a replay attack. The basic premise of this attack is to capture at least one packet traveling from the victim laptop to victim access point. This packet can then be replayed into the network, causing the target AP to respond and provide more traffic to capture. Aireplay (also part of Aircrack) can perform a replay attack based on captured ARP (Address Resolution Protocol) packets, which are broadcast at regular intervals in wired and wireless networks and are easy to spot. Aireplay automatically scans a captured pcap file, pulls out the suspected ARP requests, and replays them to the access point. After about three minutes of capturing and cracking, the FBI team found the correct WEP key, and displayed it on a projected notebook screen. Agent Bickers, still speaking to the audience, turned around, looked at the screen and was surprised, "Usually it takes five to ten minutes."
Figure 4: Gotcha!
internal users 2) Change the default settings on your access point Default settings (SSID, administrator password, channel) are well known and even included as part of some WLAN attack tools 3) Use WPA with a strong key WPA is a definite improvement over WEP in providing wireless security. But the version intended for home and SOHO use - WPA-PSK - has a weakness shared by any passphrase security mechanism. The choice of simple, common and short passphrases may allow your WPA-protected WLAN to be quickly compromised via dictionary attack (more info here). 4) Update your firmware This is helpful if your AP or client doesn't currently support WPA. Many manufacturers have newer firmware for 802.11g products that add WPA support. You may also find this for 802.11b gear, but it's not as common. Check anyway! 5) Turn off the WLAN when not in use A $5 lamp timer from your local hardware store is a simple, but effective way to keep your WLAN or LAN from harm while you're sleeping. Bickers also said that if you have an access point that can swap keys fast enough, you may be able to stay ahead of an attacker. "Most likely they will get bored and attack someone else." But for most WLAN owners, this method isn't practical. The FBI demonstrated this attack to the computer security professionals at the ISSA meeting in order to show the inadequate protection offered by WEP. It is one thing to read stories of WEP being broken in minutes, but it is shocking to see the attack done right before your eyes. It was fast and simple.
To Explore Further
Tools Used
Auditor's Security Collection - Contains all the wireless hacking tools already installed Kismet Airsnort Aircrack (includes Aireplay and Airodump) void11
Figure 1: Gotcha!
This first article will help you set up your wireless lab and guide you through the scanning portion of WEP cracking. After all, you will need to find and document the wireless networks before you can crack them. The second article will describe the stimulation of the target WLAN to generate traffic and the actual process of capturing data and cracking the WEP key. After reading these two articles, you should be able to break WEP keys in a matter of minutes. A third article will turn things around and describe how to defend against multiple skill levels of wireless intruders NOTES:
A description of the basic approach and techniques used in this How To can be found in The Feds can own your WLAN too. You don't need to be a networking expert to successfully follow this How To, but you need basic familiarity with networking terminology and principles. You should know how to ping, open a Windows Command Prompt, enter command lines and know your way around the Windows networking properties screens.
You can actually run a WEP crack using one notebook equipped with a single wireless LAN card, but we don't recommend this configuration as a starting point. With only one notebook, its easy to get confused about what you're doing and we've found that the Auditor programs can get a bit unstable when used in this way.
Note that using an active attack vs. passively capturing traffic increases your chances of detection. But it can significantly speed a WEP key crack by forcing the generation of more packets than you would normally capture in a short time from a lightly-used WLAN. Tip: Although we refer to laptops / notebooks throughout this series, you can also use desktop computers or a mixture of laptops and desktops. However, you may find using notebooks easier due their portability and the wider range of compatible PC Card wireless adapters available. Here is a list of required hardware:
Wireless Access Point - This will be the "target" access point and can be any brand. We used a Netgear WGT624 v2 A laptop or computer with wireless capability - This will be the "target" computer and it doesn't matter which wireless chipset or card the computer uses. Our lab had a surplus Dell laptop with built-in wireless that worked just fine Two 802.11b PC Cards based on the PRISM 2 chipset - Some of the programs (such as Kismet) we use in this series can support a wide variety of wireless cards. But we suggest you stick to using cards based on the PRISM 2 chipset, which are supported by all the programs we will use. We used two 2511CD PLUS EXT2 cards. The 2511-CD PLUS EXT2 has two MMCX connectors for external antennas and does not have an internal antenna.These cards are typically found under the Senao, Engenius or Wireless LAN brand names (Figure 3). You can also search this list compiled by Absolute Value Systems to find other PRISM 2-based cards.
If you purchase a wireless card that has an external antenna connector, you may want to buy an antenna and appropriate "pigtail". (The pigtail is a short cable, that connects the end of the antenna cable to
your Wi-Fi card.) This isn't always necessary since some cards with external antenna connectors also have internal antennas. But note that the 2511CD PLUS EXT2 series of cards, do not have an internal antenna, so you must purchase an antenna if you're using that card. You are welcome to use any type of external antenna you want (or none at all), but we purchased the Mobile Patch antenna pictured in Figure 4. The suction cup bottom of the patch antenna makes it wonderful for wardriving, as you can temporarily attach it to your car windows.
This antenna has 8dBi of gain and, like many antennas, has a short cable that terminates in an NFemale connector. For the Senao / Engenius cards, you will need to buy a pigtail with MMCX connector on one end. The connector is about 1 mm in diameter, with a very small pin in the middle
As a side note, pigtail connectors are disliked by many people. It's an extra cable to carry around, and sometimes the connector breaks off. In addition, it is a pain to disconnect the pigtail from the Wi-Fi card, as it takes a decent amount of force to pull the connector off.
The Software
While cracking WEP requires several open source tools, all of these tools are thankfully pre-installed,
on the free Auditor Security Collection LIVE CD. The CD boots a modified Kanotix Linux distribution into RAM (it doesn't touch your hard-drive) and auto-detects and configures many wireless cards. The current version of Auditor as of 12/16/2006 is auditor-200605-02 and can be downloaded as a CD Image or .ISO file. Note that there are two versions: one for systems with for systems with Intel B/G wireless cards (IPW2200) and the other for all other systems. Since this procedure is based on using a card with a PRISM 2 chipset, you'll need to download the other file. This image can be burned to a CD with any CD-burning software such as Nero (commercial) or CDBurnerXP (free). You will need to burn one CD for each of your scanning and attacking notebooks. Please donate a few bucks to the author if you find Auditor useful!
MAC Address of the AP - This is usually displayed in the web configuration menu. It also may be found on a label on the bottom or side of the AP SSID of the AP Wireless channel of the AP - by default will probably be Channel 6, but make sure WEP key - If your AP displays the key as 0xFFFFFFFFFF (replace the F's with whatever your key is), write down only everything past the 0x
With the AP configured, we now need to get a client associated with it. (The following example uses Windows XP.) Right-click on the My Network Places icon on your desktop, or in your Start Menu. Then left-click Properties. Double-click the entry called Wireless Network Connection and a window similar to Figure 6 will open. Figure 6 shows that multiple WLANs are available, but your window may show only the "starbucks" AP that you just configured. Connect to your AP by double-clicking the corresponding SSID.
Because the AP has WEP enabled, Windows will ask for the network key in order to connect (Figure 7). Type in your WEP key (or cut and paste it from a Notepad or Wordpad document) and after a short wait Windows should report that you are connected to the network. Make sure that you are really connected by pinging a known computer on your wired LAN or opening your browser and checking your favorite website if your WLAN is connected to the Internet.
If you can't get a successful ping or browse the web, open your wireless adapter's Network properties, click on the Support tab and check that you have valid IP address information. If you don't, check that your LAN's DHCP server is enabled and also check that the wireless adapter's TCP/IP properties are set to "Obtain an IP address automatically". You may also need to run a Repair on the connection.
Lab Setup - AP
Once you are successfully connected, record the MAC Address of target computer. You can do this by opening a command prompt window and entering the ipconfig /all command. You should get a screen similar to Figure 8, in which I've highlighted the wireless network adapter MAC address information.
Since your client machine is running Windows XP, you can also get the MAC address from the Wireless Connection Status window. Click on the Support tab, then the Details button and the MAC address is right at the top (Figure 9), but of course called something different, i.e. "Physical Address".
You will notice that in Windows, the MAC address numbers and letters are separated by dashes. The
dashes make the characters more readable, but the actual MAC address doesn't have dashes. At this point, our target WLAN is configured and working, so shut down the target client.
The two most important icons will be the Programs and Command Line icons, which are located at the bottom left side of the screen (Figure 11).
Before you do anything else, you must make sure that your wireless network card has been recognized and configured by Auditor. Click on the command line icon to open a command line window, then type iwconfig. Among the other information that Audior spews out, you should see wlan0, which is the designation that Auditor gives to PRISM-based cards. If your screen looks similar to Figure 12, then Auditor has correctly detected your wireless card. You can now close out of the command line screen.
Repeat these same steps for your second notebook, then shut it down. You won't be needing it until Part 2, where you'll learn how to use it to stimulate WLAN traffic that will be captured by your first notebook.
In addition to scanning wireless networks, Kismet captures packets into a file for later analysis. So Kismet will ask for the directory to save the captured files in. Click Desktop and then OK (Figure 14).
Kismet will then ask for a prefix for the captured files (Figure 15). Change the default name to capture and then click OK.
As Kismet starts, it will display all the wireless networks in range (Figure 16), which should hopefully include the target WLAN you set up. The channel number, under the Ch column, should match what you have written down. If Kismet has found many nearby access points, you may want to move the lab farther away from the Access Points, or disconnect any high-gain antennas you have connected.
While Kismet is jumping through all the channels and SSIDs looking for interesting information, you will see the number of packets changing for all the access points. In the column at the right side of the screen, Kismet displays the total number of networks found, the number of packets captured and the number of encrypted packets seen. Even with the target computer off, Kismet is detecting packets from our AP. This is because APs send out "beacons", which tell wireless computers that an AP is in range. You can think of it as the AP announcing, "My name is XXXXX, please connect to me." Kismet starts in "autofit" mode, which doesn't list APs in any meaningful order. Press "s" to get to the Sort menu (Figure 17). Here you can specify sort orders, which will organize the APs better.
Press "c" and the access points will be ordered by channel. (Figure 18)
Kismet will by default hop through channels 1 to 11. Use the cursor keys to move the highlight bar to your SSID and press "L" (note capital "L") and Kismet will lock on the SSID's channel (Figure 19). You will notice that the packet numbers of other APs may still continue to increase. This is because many channels overlap each other in frequency.
Now that we are reasonably sure that Kismet is working, let's see what happens when the target computer on the network starts transmitting information. In most cases, this will be receiving / sending of email or web surfing. Start the target computer, while keeping the scanning laptop in Kismet. As the target computer boots into Windows and connects to the target AP, you will notice a surge in regular and encrypted packets being captured by Kismet. You'll be using these packets in the attacks described in Part 2 of this series.
Conclusion
At this point, you know the basic approach to WEP cracking, have a target WLAN configured and have both sniffing and attack computers configured and working. You also have gained a basic familiarity with Auditor and used Kismet to find in-range wireless LANs. In Part 2, we will use the second notebook to stimulate the target LAN to generate wireless traffic that we will capture and perform the actual WEP key crack. Until then, you can familiarize yourself with Kismet, go WLAN hunting and explore some of the other tools on the Auditor CD.
To Explore Further
Tools Used
Auditor's Security Collection - Contains all the wireless hacking tools already installed Kismet July 1st, 2004 - Auditor Review (not current version)
Related Articles
To successfully follow this How To, you need basic familiarity with networking terminology and principles. You should know how to ping, open a Windows Command Prompt, enter command lines and know your way around the Windows networking properties screens. Basic familiarity with Linux will be helpful too. These procedures assume the use of specific wireless hardware described in Part 1. They will not work with other hardware types without modification. These procedures assume that the target WLAN has at least one client associated with an AP or wireless router. They will not work with an AP that has no associated clients. This tutorial is based on the Auditor version released April 2005. Future versions could make this attack easier or harder. In addition, some of the commands shown are Auditor-specific scripts that don't exist (but can easily be made) in other Linux distributions. Accessing anyone else's network other than your own without the network owner's consent is illegal. SmallNetBuilder, Pudai, LLC and the author do not condone or approve of illegal use of this tutorial in any way
Also note that it is possible to perform WEP cracking using only one computer. But we have chosen to use two to more clearly illustrate the process and avoid some of the complications caused by using a single computer. The four main tools used in this article are airodump, void11, aireplay and aircrack, which are included on the Auditor Security Collection CD:
Airodump scans the wireless network for packets and captures these packets into files Void11 will deauthenticate computers from a wireless access point, which will force them to reassociate to the AP, creating an ARP request Aireplay takes this ARP request and resends it to the AP, spoofing the ARP request from the valid wireless client
Finally, aircrack will take the capture files generated by airodump and extract the WEP key
From your scanning with Kismet as described in Part 1, you should have written down the following four pieces of information:
MAC Address of the wireless Access Point (AP) MAC Address of the "Target" computer WEP key used Wi-Fi channel used
In the following procedures, we will call our laptops, Auditor-A and Auditor-B and call the target computer Target. Let's get started.
Finding the MAC Address of the AP is extremely easy with either Kismet or Netstumbler. Start Auditor-A with its Wi-Fi card and Auditor CD inserted. Once Auditor is up, start Kismet, just like you did in Part 1, and you will see a list of APs. Type s and then c to sort the APs by channel and using the arrow keys, move the highlight bar to your target AP's SSID. Then hit the Enter key. This will bring up
a detailed screen (Figure 2) that will show the selected AP's SSID, MAC address and channel. Voila! "Zero knowledge" has been transformed into almost all the information needed to run a WEP crack.
Figure 2: Kismet easily finds the SSID, Channel and MAC address
Tip: Some "security professionals" suggest cloaking your SSID / disabling SSID broadcasts. While this will defeat a Netstumbler scan, Kismet will easily detect "cloaked" SSIDs. Kismet captures more network information than Netstumbler and can find AP SSID's by following conversations between associated clients and the AP.
If you don't see the MAC address of the TARGET computer, check to make sure it's on and associated with the Target AP (boot the TARGET into Windows, have it connect to the AP and start browsing the web). In about 10-30 seconds, you should see the MAC address of the TARGET computer pop up in Kismet. A prudent cracker would probably record all the client MAC addresses found so as not to be thwarted if a client isn't present when the time comes to start the cracking process.
As amazingly fast as aircrack is, it still needs a sufficient number of "interesting" packets to work on in order to crack a WEP key. As we noted earlier, packet capture is done by airodump, which creates a file of captured data for aircrack. Let's see how it's done. You can use either computer, but we'll stick with Auditor-A. Open the shell and type in the following commands: Commands for setting up airodump
iwconfig wlan0 mode monitor
NOTES: - Replace THECHANNELNUM with the channel number of your Target WLAN - The /ramdisk directory is where the capture data will be stored If there are many wireless access points close by, you may want to use attach the MAC address of your target AP to the end of the airodump command like so:
airodump wlan0 cap1 MACADDRESSOFAP
This will instruct airodump to write only the packets of the target AP to the capture file. You can exit out of Airodump by typing Control-C. Typing ls -l will list the contents of the directory. Notice the size of the capture file which has the extension of .cap. If packets were successfully captured, the file size should be a few kB or so after a few seconds of capture. Note that if Airodump is stopped and restarted with the same parameters, the new capture file will appended to the previous one. You may want to make separate files by naming the first file cap1, the next, cap2 and so on.
While airodump is running, you should see the MAC address of your AP listed under BSSID on the left side of the window. You should also see the Packet count and IV count (Initialization Vector) going up. This is due to normal Windows network traffic that is generated even if you aren't surfing the web or checking your email. So you will see the IV count rise by a few IVs after a while. If you start surfing the web on the TARGET computer, you should see that each new webpage raises the IV count in airodump. We aren't interested in the Packet count, because doesn't help us with WEP cracking and many of the packets will be beacons coming from the AP. (Most APs send out ten beacons a second by default and you will see that reflected in the packet count in airodump.) The IV count is the important number to watch for since you will need to capture around 50,000 to 200,000 IVs in order to crack a 64 bit WEP key and for a 128 bit key, you will need around 200,000 to 700,000 IVs!
where ADDRESS_OF_ANOTHER_LAN_CLIENT is replaced by the IP address of the AP, router or any other pingable client on the LAN. Either of these methods will cause the IV count to rise a bit faster. But since they require access to the very WLAN that you are trying to obtain the WEP key for, they're useful only to illustrate that more traffic = more IVs. What is needed is a traffic-generation method that requires only the information that we've obtained via Kismet. This is where void11 comes in. Void11 is used to force a de-authentication of wireless clients from their associated AP,i.e. the clients are "kicked off" the AP. After being kicked off the wireless network, a wireless client will automatically try to reassociate with the AP. In the process of re-association, data traffic will be generated. This process is commonly referred to as a de-authentication or deauth attack. Here's how it's done.
Start Auditor-B with its Wi-Fi card and Auditor CD inserted. Once Auditor is up, open a shell and type
NOTE: Replace THECHANNELNUM with the channel number of your Target WLAN, and MACOFSTATION and MACOFAP with the MAC addresses of the Target WLAN client and AP respectively, i.e.
void11_penetration -D -s 00:90:4b:c0:c4:7f -B 00:c0:49:bf:14:29 wlan0
Tip: You may see an invalid argument error while running void11 on the Auditor Security Collection. Don't worry about this error, as void11 is working, which we'll verify next.
Figure 8 shows that the pings will time out while void11 is running. If you do a Control-C on AuditorB to stop the void11 attack, the pings will come back to life after a few seconds.
You can see if you are being deauthenticated from an AP by looking at your wireless client's utility program, which usually indicates the connection status. Figures 9 and 10 show the wireless client utility built into Windows WP. Before the void11 attack starts, everything will seem normal, and Windows will show that you are connected to the AP (Figure 9).
After void11 starts, the network status will change from connected to disconnected (Figure 10). After void11 is stopped on Auditor-B, the Target will reconnect back to the AP in a few seconds or so.
If you look back at Auditor-A - which we last left running airodump - while void11 is running, the IV count in airodump should increase to around 100-200 with a few seconds. This is due to the traffic generated by the Target client as it repeatedly tries to reassociate with its AP.
Let's start with a clean slate and reboot both Auditor-A and Auditor-B. Figure 12 shows the roles that Auditor-A and Auditor-B are playing. Notice that Auditor-A is running only aireplay and is just serving to stimulate traffic (and IVs) to shorten the time it takes to crack a WEP key. Also notice that Auditor-B is used for either running the deauth attack (via void11) or capturing traffic (via airodump) and running the actual crack against the captured data via aircrack which we'll get to shortly.
We'll first start aireplay. Go to Auditor-A, open a shell and type in these commands: Commands to set up aireplay to listen for an ARP packet
switch-to-wlanng cardctl eject cardctl insert monitor.wlan wlan0 THECHANNELNUM cd /ramdisk aireplay -i wlan0 -b MACADDRESSOFAP -m 68 -n 68 -d ff:ff:ff:ff:ff:ff
NOTES: - switch-to-wlanng and monitor.wlan are custom scripts that come installed on the Auditor CD to simplify commands and reduce typing - Replace THECHANNELNUM with the channel number of your Target WLAN At first, nothing too exciting will happen. You should see aireplay reporting it has seen a certain number of packets, but little else since the packets haven't matched the filter we've set (68 Byte packet with a destination MAC address of FF:FF:FF:FF:FF:FF). Now go to the Target client computer and open its wireless utility so that you can monitor its connection status. Then go to Auditor-B and start a void11 deauth attack by following the previous instructions. Once you've started void11, you should see the Target client lose contact with the Target AP. You should also see see the packet rate reported by aireplay increase at a faster rate. At some point, aireplay will display a captured packet and ask if you want to replay it (Figure 13).
You want a packet that matches the following criteria (also illustrated in Figure 13):
FromDS - 0 ToDS - 1 BSSID - MAC Address of the Target AP Source MAC - MAC Address of the Target computer Destination MAC - FF:FF:FF:FF:FF:FF
Type n (for no) if the packet does not match these criteria and aireplay will resume capture. When aireplay successfully finds a packet matching the above criteria, answer y (for yes) to the replay question and aireplay will switch from capture to replay mode and start the replay attack. Immediately go back to Auditor-B and stop the void11 deauth attack. Tips: - The capture of a packet via a deauth attack can be the trickiest part of the WEP cracking process. While the deauth attack generates traffic, it generally doesn't generate very much because of the time it takes for a client to realize that it has lost connection with its AP and then more time for the re-association process to complete. - Capture can be further complicated by the fact that the timing of these processes is different among client drivers (and operating systems). void11 can easily overwhelm a client with deauth packets so that it doesn't even have time to complete a re-association and generate the packets we'll be looking to capture. - Sometimes you may luck out with the first packet captured. But other times you may have to wait for multiple captures. - If aireplay doesn't produce a captured packet within a few thousand packets, void11 could be overwhelming the AP and client and not giving them any time any time to complete a reassociation. Try stopping void11 manually (control-C) and then restarting it. You can also try adding the -d parameter to the void11 command line (the delay value is in microseconds) and experimenting with different values to allow time for a successful reassociation. Be aware that some wireless clients lock up when subjected to a deauth attack and may need to be rebooted to recover! - You may have difficulty capturing ARP packets via a deauth attack if the Target client is idle. This is unlikely to happen with a real Target WLAN, but could be a problem with your practice Target WLAN. If aireplay is not flagging packets for you to approve, you may need to go to your Target client and run a continuous ping or start a download before you start the deauth attack. - As a final tip, if you absolutely cannot get void11 to work, you can test if aireplay is really working by cheating a little bit. Keep aireplay running on AUDITOR-A and turn off void11 on AUDITOR-B. Go to the TARGET computer and manually disconnect from the wireless network. You can do this through either the wireless connection properties or by simply turning the computer off. Now reconnect the computer or turn the computer back on. Within thirty seconds, aireplay on AUDITOR-A should see an ARP packet sent by the TARGET computer as it reconnects to the WLAN and requests an IP address.
NOTES: - switch-to-wlanng and monitor.wlan are custom scripts that come installed on the Auditor CD to simplify commands and reduce typing - Replace THECHANNELNUM with the channel number of your Target WLAN - If there are many wireless access points in range, append the MAC address of your target AP to the end of the airodump command, i.e. airodump wlan0 cap1 MACADDRESSOFAP After airodump starts, you should now see the IV count rise to about 200 per second, thanks to the aireplay replay attack running on Auditor-A
With airodump writing IVs into a capture file, we can run aircrack at the same time to find the WEP key. Keep airodump running and open another shell window. Type the following commands into the new window to start aircrack: Starting aircrack
cd /ramdisk aircrack -f FUDGEFACTOR -m MACADDRESSOFAP -n WEPKEYLENGTH -q 3 cap*.cap
NOTES: - FUDGEFACTOR is an integer (default is 2) - MACADDRESSOFAP is the MAC address of the Target AP - WEPKEYLENGTH is the length of the WEP key you are trying to crack (64, 128, 256 or 512) Figure 15 shows an example of a complete command.
Aircrack will read in unique IVs from all the capture files and then perform a statistical attack on those IVs. A lower "fudge factor" (-f parameter) has less chance of succeeding, but is very fast. A high fudge factor is slower, but has a higher chance of finding the WEP key. A fudge factor of 2 is the default starting point. You can stop aircrack by typing control-C or just let it run to completion (it will give up after awhile if it doesn't find the WEP key, at least for 64 bit WEP keys). If you followed our syntax above, you can simply hit the up arrow then enter. You can then restart aircrack by hitting the up arrow then enter keys, and aircrack will automatically include the updated contents of the airodump capture file. At some point, you should be rewarded with the screen shown in Figure 16.
Helpful hints
We broke a 64 bit WEP key in less than five minutes, which is the combined time for scanning with airodump and cracking with aircrack and stimulating traffic with aireplay running a simultaneous replay attack. There is a lot of luck involved and sometimes you may break the WEP encryption after gathering just 25,000 IVs, but most times it takes more than 100,000. You would expect a 128 bit key to take eons longer, but this is not the case. A 128 bit key can be broken with around 150,000 to 700,000 IVs. bit capturing more IVs will definitely speed up the cracking process. When we reconfigured our target AP with a 128 bit key, we were able to recover the WEP key with 200,000 IVs, but it took the laptop we used more than an hour. Having more captured IV's would have sped up the process dramatically. It's important to note that you must input the length of the WEP key that you are trying to recover into aircrack and that none of these tools provide that information. While you know this information in your practice target WLAN, you wouldn't know it in a zero knowledge exploit. So you may need to try both 64 and 128 WEP key lengths in aircrack in order to be successful.
Using a notebook with a fast processor and lots of memory for "Auditor-B" can help speed things along. You can also offload the capture files to other computers to speed up the cracking, while continuing to capture packets. We tested out this technique at the 2005 Interop Convention in Las Vegas. While one laptop was running airodump, we copied the capture files over to a very speedy server for cracking. The server (running aircrack) doesn't need wireless access since it just crunches away on the captured files. It goes without saying that you should use the fastest computer you can find to run aircrack. The new dual core processors from AMD and Intel may provide a speedup in WEP cracking since aircrack can spawn multiple processes with the -p option. You may find it convenient to save your capture files to a USB flash drive to "sneakernet" them to other computers. Simply open the shell and type the following: Saving capture files to USB flash drive
mkdir /mnt/usb mount -t vfat /dev/uba1 /mnt/usb copy /ramdisk/cap*.cap /mnt/usb umount /mnt/usb Note that you must perform a umount to actually write the files to the flash drive.
Conclusion
WEP was never meant to secure a network, but was designed only to provide a WLAN with the level of security and privacy comparable to that expected of a wired LAN. This is clearly indicated by its full name, "Wired Equivalent Privacy". Recovering a WEP key is the equivalent of gaining physical access to a wired network. What happens next depends on the steps that have been taken to secure resources of the network itself. Enterprise networks most always require a user login, i.e. authentication, before allowing access to their networks. Servers are physically secured in locked server rooms and network wiring panels secured in locked closets. Networks are frequently segmented so that users are kept from accessing shares and servers that they have no need to access. Unfortunately, trained in bad security habits by both Microsoft and Apple, most home PC users avoid logins and password-protected network shares like the plague. And while home networks may have made Internet and printer sharing possible, the combination of networked computers and poor security practices has turned more than one home network into a unholy mess of worm-infested zombies before people even know what hit them. WEP was shown to have failed in its function shortly after 802.11 networks came into widespread use and the industry has been playing catch-up ever since. Key rotation, stronger IVs and other proprietary schemes were tried first. But businesses quickly realized that these measures were ineffective and either closed down their wireless LANs entirely or segregated them into limited-access separate networks, required the use of VPNs or took additional security measures. Fortunately, the wireless equipment makers quickly realized that stronger measures were needed if they were to be able to continue to sell wireless products to businesses and more security-conscious home networkers. The answer came in the late fall of 2002 in the preliminary form of Wi-Fi Protected Access or WPA and followed a year or so later by the current improved version - WPA2. Despite the industry's foot-dragging in getting both technologies out to its users (and providing updates for existing products), either technology - even in its simplified "Personal" (or "PSK") form that uses password-based protection - will provide the level of security originally envisioned for WEP as long as a sufficiently random and long password is used. In Part 3 of this series, we will demonstrate some good and not so good ways to protect your network. But in the meantime, our basic recommendation is to secure your wireless LAN by using WPA or WPA2 (with a strong password), or turn off wireless access until you can. We hope that these articles have shown that WEP is simply not an option for real "wired equivalent" security.
To Explore Further
Tools Used
Auditor's Security Collection - Contains all the wireless hacking tools already installed Kismet
Related Articles
August 2, 2004 - Defcon 12: Hackers in Vegas August 2, 2004 - Black Hat: Day 2 Sounds Security Alarm July 30, 2004 - Black Hat Briefings Day 1 July 1, 2004 - Auditor Review (be advised that this version is old)
Command Summary
Commands for setting up airodump
iwconfig wlan0 mode monitor iwconfig wlan0 channel THECHANNELNUM cd /ramdisk airodump wlan0 cap
Starting aircrack
cd /ramdisk aircrack -f FUDGEFACTOR -m MACADDRESSOFAP -n WEPKEYLENGTH -q 3 cap*.cap
Why Bother?
For some people, setting up a secure wireless network is so daunting, they give up and run it wide open, ie. unsecured. I also hear people say, "I just surf the web and have nothing valuable on my computer. Why should I bother with security?" Good question, but here are some equally good answers. Running your WLAN wide open entails three major risks: 1) Your network resources are exposed to unknown users Once someone wirelessly connects to your LAN, they have the same access as users directly connected into your LAN's Ethernet switch. Unless you have taken precautions to limit access to network resources and shares, intruders can do anything trusted, known users can do. Files, directories, or entire hard drives can be copied, changed or entirely deleted. Or worse, keystroke loggers, Trojans, zombie clients or other programs can be installed and left to work for their unknown masters. 2) All of your network traffic can be captured and examined With the right tools, web pages can be reconstructed in real-time, URLs of websites you are visiting captured, and most importantly passwords you enter stolen and logged for future
mis-use, most notably identify theft. 3) Your Internet connection can be used for illegal, immoral or objectionable activities If your open WLAN is used to transfer bootleg movies or music, you could possibly be the recipient of a lawsuit notice from the RIAA. In a more extreme case, if your Internet connection were used to upload child pornography to an FTP site, or used to host the server itself, you could face more serious trouble. Your Internet connection could also be used by spammers, DoS extortionists and purveyors of malware, viruses and their like. It may be a noble sentiment to give free Internet access to anyone within range of your wireless LAN. But unless you put some serious protection between your "open" LAN and the one you use, you are exposing your data, and perhaps more, to serious risk. The approach I'll take in formulating WLAN security recommendations is based on the expected skill level of potential wireless intruders. I'll then provide recommended security countermeasures for each skill level. NOTE: I will generally use "AP" (Access Point) throughout this article, but this should be read as meaning "Access Point or wireless router".
Changing the default channel of your AP might help you avoid interference from nearby wireless LANs, but it has little value as a security precaution since wireless clients generally automatically scan all available channels for potential connections. Countermeasure 2: Upgrade Your Firmware, and maybe Hardware Having the most current firmware installed on your AP can sometimes help improve security. Updated firmware often includes security bug fixes and sometimes adds new security features. With some newer consumer APs, a single click will check for and install new firmware. This is in contrast to older APs which required the user to look up, download and install the latest firmware from a sometimes difficultto-navigate support site. APs that are more than a few years old have often reached their end of support lifecycle, meaning that no new firmware upgrades will be made available. If you find that your AP's latest firmware doesn't support at least the improved security of WPA (Wi-Fi Protected Access), and preferably the latest version called WPA2, you should seriously consider upgrading to new gear. The same goes for your wireless clients! Virtually all currently-available 802.11g gear supports at least WPA and is technically capable of being upgraded to WPA2. But manufacturers are not always diligent in their support of older products, so if you want to be sure that your gear supports WPA2, either check the Wi-Fi Alliance's certification database, or do some Googling in both the Web and Groups. Countermeasure 3: Disable SSID broadcast Most APs allow users to disable SSID broadcasting, which will thwart a Netstumbler scan. This will also stop Windows XP users using XP's built-in Wireless Zero Configuration utility and other client applications from initially seeing the wireless network. Figure 1 shows the control labeled "Hide ESSID" that will do the trick on a ParkerVision access point. ("SSID" and "ESSID" both refer to the same thing.)
NOTE: Disabling SSID broadcast will not prevent a potential intruder using Kismet or other wireless survey tools such as AirMagnet from seeing your wireless network. These tools don't rely on SSID broadcast for available network detection.
Countermeasure 4: Turn it off! People commonly overlook the simplest way of securing their wireless network - turning off the AP! A simple lamp timer can be used to turn off your AP during the overnight hours when you're not using it. If you have a wireless router, this will mean that your Internet connection will also be disabled, which also isn't such a bad thing. If you can't or don't want to periodically shut down your Internet connection, you'll have to remember to disable your wireless router's radio manually - if it has this feature. Figure 2 shows a typical wireless disable control. This manual method is more prone to error, however, since it's just one more thing to forget. Perhaps at some point manufacturers will add radio disable to the features that can be scheduled on wireless routers.
Countermeasure 5: MAC Address Filtering MAC Address filtering is used to control access to your AP by allowing (or denying) access to a list of wireless client MAC addresses you enter. It will prevent an unskilled intruder from connecting to your WLAN, but MAC addresses are easily captured by more skilled attackers and wireless adapter MAC addresses easily changed to match a captured address.
Countermeasure 6: Lower the transmit power While only a few consumer APs have this feature, lowering your transmit power can help limit intentional and accidental unauthorized connections. But with the increased sensitivity of wireless cards that even unskilled users can purchase, it may not be worth the bother - especially if you're trying to prevent unwanted connections in an apartment building or dorm.
Most skilled attackers typically use high-gain antennas, which allow them to detect very low signal levels and effectively offset this countermeasure.
For most personal WLANs, using WPA-PSK will provide adequate protection, but it is essential to use a key that is sufficiently long and random. Do not use a number, or a word from the dictionary, since programs such as cowpatty are already available to perform dictionary-based attacks against WPAPSK. Robert Moskowitz, Senior Technical Director ICSA Labs, recommended in this article using an 128 bit PSK. Fortunately, all WPA implementations accept alphanumeric PSKs, which would require only 16 characters to implement Mr. Moskowitz' recommendation. There are many password generators available on the Internet that can be found by a quick search. This one has lots of bells and whistles and even provides an estimation of how long it would take to crack the password it generates. As a final note, some manufacturers have started selling APs and wireless cards that promise "one touch" easy setup of secured wireless connections. Buffalo Technology had the first products based on their AOSS (AirStation One-Touch Secure Station) technology. Linksys has recently starting selling products based on similar technology from Broadcom dubbed SecureEasySetup. These offerings will be reviewed in a future article.
Countermeasure 8: Add Authentication To address this emerging threat, users should implement authentication. Authentication adds another layer of security by requiring a client computer to "sign-in" to the network. Traditionally this has been done with a mix of certificates, tokens, or hand-typed passwords (also called Pre-Shared-Keys) that are negotiated with an authentication server. 802.1X provides the access control framework used by WEP, WPA and WPA2 and supports several EAP (Extensible Authentication Protocol) types that do the actual authentication. George Ou's excellent article on Authentication Protocols contains probably more than you'd ever want to know about EAP, WPA and WPA2! Configuring authentication can be a daunting and expensive task for networking professionals, let alone home networkers. At this year's RSA conference in San Francisco, for example, many attendees didn't bother to set up their wireless connection because of the full page of instructions they had to follow to do it! Thankfully, things are getting better, and you don't need to buy a full-blown RADIUS server, as there are a number of easier-to-implement alternatives. LucidLink offers a free fully-functional version of its namesake product through the end of 2005, which supports wireless security and authentication setup for up to three users. A similar product is Wireless Security Corporation's (recently purchased by McAfee) WSC Guard. It's a subscription-based product starting at $4.95 per user per month with discounts for volume purchases. A free 30 day trial download is available here. Another free option worth investigating for more experienced networkers is TinyPEAP, which adds a small RADIUS server supporting PEAP-based authentication into Linksys WRT54G and GS wireless routers. Note that since this firmware isn't officially supported by Linksys, you're on your own if you mess up your router while installing TinyPEAP.
1) Require authentication to access any network resource Any server, network share, router, etc. should preferably require user-level authentication for access. Although you won't be able to implement real user-level authentication without some sort of authentication server, you can at least password-protect all shared folders and disable Guest logins if you're running Windows XP. And never share the contents of entire hard drives! 2) Segment your network In the extreme case, a computer not attached to a network is safe from network-based intrusion. But there are other ways to keep network users away from where they shouldn't be. A few properly-connected Inexpensive NAT-based routers can be used to establish firewalled LAN segments while still allowing Internet access. See this How To for the details. Switches or routers with VLAN capabilities can also be used to separate LAN users. VLAN features can be found on most any "smart" or managed switch, but are harder to come by in consumer-priced routers and unmanaged switches. 3) Bulk up your software-based protection At minimum, you need to run current versions of good anti-virus applications that automatically update their virus definition files. Personal firewalls such as ZoneAlarm, BlackICE, etc. can alert you to suspicious use of your network. And, unfortunately, the latest generaton of malware and spyware threats make adding an anti-spyware application also necessary. Webroot Software's Spy Sweeper seems to be getting good marks lately, along with Sunbelt Software's CounterSpy. Note that you must install protection on every machine on your LAN in order to have effective protection! 4) Encrypt your files Encrypting your files with strong encryption should provide effective protection in the event unauthorized users do gain access to them. Windows XP users can use Windows Encrypted File System (EFS). Mac OS X Tiger users can use FileVault. The downside to encryption is that it takes time and computing power to encrypt and de-crypt files, which could slow things down more than you'd like.
Conclusion
Wireless networking provides us with convenience, but we must take a common sense approach in securing it. There is no single thing that will shield you from attack and complete protection is very difficult to achieve against a determined intruder. But if you take the time to understand the possible risks your wireless LAN is likely to encouter, you can implement effective protection.
To Explore Further
The Unofficial 802.11 Security Page Airdefense Top 10 Wireless LAN Policy Violations NetworkWorld Protecting Wireless Networks Wardrive.net Checklist for Defending Your Wireless Network Joint Forces Staff College Defending Your Home Computer Snort Wireless List of IDS software (Commercial and Open Source)
Pre-Installation
Checklist
Tools I've been really, really successful with basically one tool set called AirCrack. Download that. Kismet is an excellent tool for sniffing out wireless networks as well and could prove useful. An encrypted wireless network. We'll be working on WEP encrypted networks as well as static passkey WPA or WPAPSK
Note: Make sure you can get your card into monitor mode (sometimes called raw monitor or rfmon). This is VERY important
WEP Cracking
Theory
A little theory first. WEP is a really crappy and old encryption techinque to secure a wireless connection. A 3-byte vector, called an Initalization Vector or IV, is prepended onto packets and its based on a pre-shared key that all the authenticated clients know... think of it as the network key you need to authenticate. Well if its on (almost) every packet generated by the client or AP, then if we collect enough of them, like a few hundred thousand, we should be able to dramatically reduce the keyspace to check and brute force becomes a realistic proposition. A couple of things will cause us some problems.
If the key is not static, then you'll mix up all your IVs and it'll take forever to decrypt the key. Theres no traffic, therefore no packets - we can fix this. MAC Address Filtering - we can fix this too.
Encryption type: Is it WEP 64-bit? 128-bit? What channel is it on? Can greatly speed up IV collection. AP's IP Address BSSID ESSID
All this info isn't required but the more you have, the more options you have later to crack and sniff. We can get a lot of this from airodump as well but I find the channel is important.
Capturing IVs
Alright, we know what we wanna crack, so lets start capturing packets. You can use kismet to capture files but I prefer airodump because it keeps a running count of all the IVs I've captured and I can crack and airodump will automatically update aircrack with new IVs as it finds them. Note: kimset can interfere with airodump so make sure you close it down before starting airodump. Airodump is pretty straight forward with its command line looking something like this:
./airodump <interface> <output prefix> [channel] [IVs flag]
interface is your wireless interface to use - required. output prefix is just the filname it'll prepend, - required. channel is the specific channel we'll scan, leave blank or use 0 to channel hop. IVs flag is either 0 or 1, depending on whether you want all packets logged, or just IVs.
My wireless card is ath0, output prefix i'll use "lucid", the channel we sniffed from kismet is 6, and IVs flag is 1 because we just want IVs. So we run:
./airodump ath0 lucid 6 1
Airodump will come up with a graph showing us all the APs and their relevant info, as well as client stations connected to any of the APs.
PWR 76
Beacons 21995
CH 6
MB
ENC
ESSID hackme
54. WEP
The second line shows us some info about the AP as well as the number of beacons and data packets we've collected from the AP. The two last lines show us two authenticated clients. Where they are connected to and the packets they are sending. We won't use this client info in a straight theory hack but in practice we'll need this info to actively attack the AP. This step may take a long time or could be very short. It depends how busy the AP is and how many IVs we are collecting. What we are doing is populating a file "lucid.ivs" with all the IV important packet info. Next, we'll feed this to aircrack. To move onto the next step, we'll want at least 100,000 packets (under # Data in airodump) but probably more.
There are a lot of options so you can look them up yourself, i'll be using common ones here that should get you a crack. Our input file is "lucid.ivs", the options we will use are:
-a 1 : forces a WEP attack mode (2 forces WPA) either -b for the bssid or -e for the essid : whichever is easier to type but I like using a BSSID because its more unique. -n 64 or -n 128 : WEP key length, omit if not known by now.
./aircrack -a 1 -b 00:23:1F:55:04:BC -n 128 lucid.ivs
and off it goes, resembling the picture from the top. Keep an eye on the Unique IV count as it should increase if airodump is still running. For all intents and purposes you are done. That'll pop open most old wireless routers with some traffic on them.
Anticipated Problems
There are lots of problems that can come up that will make the above fail, or work very slowly.
No traffic No traffic is being passed, therefore you can't capture any IVs. What we need to do is inject some special packets to trick the AP into broadcasting. Covered below in WEP Attacks MAC Address filtering AP is only responding to connected clients. Probably because MAC address filtering is
on. Using airodumps screen you can find the MAC address of authenticated users so just change your MAC to theirs and continue on. Using the -m option you can specify aircrack to filter packets by MAC Address, ex. -m 00:12:5B:4C:23:27
Can't Crack even with tons of IVs Some of the statistical attacks can create false positives and lead you in the wrong direction. Try using -k N (where N=1..17) or -y to vary your attack method. Increase the fudge factor. By default it is at 2, by specifying -f N (where N>=2) will increase your chances of a crack, but take much longer. I find that doubling the previous fudge factor is a nice progression if you are having trouble. Still Nothing Find the AP by following the signal strength and ask the admin what the WEP key is.
WPA Cracking
Differences
WPA is an encryption algorithm that takes care of a lot of the vunerablities inherent in WEP. WEP is, by design, flawed. No matter how good or crappy, long or short, your WEP key is, it can be cracked. WPA is different. A WPA key can be made good enough to make cracking it unfeasible. WPA is also a little more cracker friendly. By capturing the right type of packets, you can do your cracking offline. This means you only have to be near the AP for a matter of seconds to get what you need. Advantages and disadvantages.
WPA Flavors
WPA basically comes in two flavors RADIUS or PSK. PSK is crackable, RADIUS is not so much. PSK uses a user defined password to initialize the TKIP, temporal key integrity protocol. There is a password and the user is involved, for the most part that means it is flawed. The TKIP is not really crackable as it is a per-packet key but upon the initialization of the TKIP, like during an authentication, we get the password (well the PMK anyways). A robust dictionary attack will take care of a lot of consumer passwords. Radius involves physical transferring of the key and encrypted channels blah blah blah, look it up to learn more about it but 90% of commercial APs do not support it, it is more of an enterprise solution then a consumer one.
The Handshake
The WPA handshake was designed to occur over insecure channels and in plaintext so the password is not actually sent across. There are some fancy dancy algorithms in the background that turn it into a primary master key, PMK, and the like but none of that really matters cause the PMK is enough to connect to the network. The only step we need to do is capture a full authentication handshake from a real client and the AP.
This can prove tricky without some packet injection, but if you are lucky to capture a full handshake, then you can leave and do the rest of the cracking at home. We can force an authenication handshake by launching a Deauthentication Attack, but only if there is a real client already connected (you can tell in airodump). If there are no connected clients, you're outta luck. Like for WEP, we want to know the channel the WPA is sitting on, but the airodump command is slightly different. We don't want just IVs so we don't specify an IV flag. This will produce "lucid.cap" instead of "lucid.ivs". Assume WPA is on channel 6 and wireless interface is ath0.
./airodump ath0 lucid 6
Either you'll get it or you won't... depends on the strength of the password and if a dictionary attack can crack it.
Using Aireplay
Aireplay is the fun part. You get to manipulate packets to trick the network into giving you what you want.
WEP Attacks
Attacks used to create more traffic on WEP networks to get more IVs. ARP Injection: ARP Replay is a classic way of getting more IV traffic from the AP. It is the turtle. Slow but steady and almost always works. We need the BSSID of the AP and the BSSID of an associated client. If there are no clients connected, it is possible to create one with another WEP attack explained below: Fake Authentication Attack. With airodump listening, we attack:
./aireplay -3 -b <AP MAC Address> -h <Client MAC Address> ath0
Note: The -3 specifys the type of attack (3=ARP Replay). This will continue to run, and airodump, listening fron another terminal, will pick up any reply IVs.
Interactive Packet Replay: Interactive Packet Reply is quite a bit more advanced and requires capturing packets and constructing your own. It can prove more effective then simple ARP requests but I won't get into packet construction here. A useful attack you might try is the re-send all data attack, basically you are asking the AP to re-send you everything. This only works if the AP re-encrypts the packets before sending them again (and therefore giving you a new IV). Some APs do, some don't.
.aireplay -2 -b <AP MAC> -h <Client MAC> -n 100 -p 0841 -c FF:FF:FF:FF:FF:FF ath0
Fake Authentication Attack: This attack won't generate any more traffic but it does create an associative client MAC Address useful for the above two attacks. Its definately not as good as having a real, connected client, but you gots to do what you gots to do. This is done easiest with another machine because we need a new MAC address but if you can manually change your MAC then that'll work too. We'll call your new MAC address "Fake MAC". Now most APs need clients to reassociate every 30 seconds or so or they think they're disconnected. This is pretty arbitrary but I use it and it has worked but if your Fake MAC gets disconnected, reassociate quicker. We need both the essid and bssid and our Fake MAC.
./aireplay -1 30 -e '<ESSID>' -a <BSSID> -h <Fake MAC> ath0
Now you can use the above two attacks even though there were no clients connected in the first place! If it fails, there may be MAC Address Filtering on so if you really want to use this, you'll have to sniff around until a client provides you with a registered MAC to fake.
WPA Attacks
So far, the only way to really crack WPA is to force a re-authentication of a valid client. We need a real, actively connected client to break WPA. You might have to wait a while.
Deauthentication Attack
This is a simple and very effective attack. We just force the connected client to disconnect then we capture the re-connect and authentication, saves time so we don't have to wait for the client to do it themselves (a tad less "waiting outside in the car" creepiness as well). With airodump running in another console, your attack will look something like this:
.aireplay -0 5 -a <AP MAC> -c <Client MAC> ath0
After a few seconds the re-authentication should be complete and we can attempt to Dictionary Brute Force the PMK.