Hands-on: hacking WiFi Protected Setup with Reaver

We try out an attack tool developed by researchers who wanted to demonstrate …

The MAC address and WiFi Protected Setup PIN for the router attacked in our Reaver test.

Photograph by Sean Gallagher

WiFi hacking has long been a favorite pastime of hackers, penetration testers, and people too cheap to pay for their own Internet connection. And there are plenty of targets out there for would-be hackers and war drivers to go after—just launch a WiFi scanner app in any residential neighborhood or office complex, and you're bound to find an access point that's either wide open or protected by weak encryption. Fortunately (or unfortunately, if you're the one looking for free WiFi), those more blatant security holes are going away through attrition as people upgrade to newer routers or network administrators hunt down vulnerabilities and stomp them out. But as one door closes, another opens.

Last week, security researchers revealed a vulnerability in WiFi Protected Setup, an optional device configuration protocol for wireless access points. WPS lets users enter a personal identification number that is hard-coded into the access point in order to quickly connect a computer or other wireless device to the network. The structure of the WPS PIN number and a flaw in the protocol's response to invalid requests make attacking WPS relatively simple compared to cracking a WiFi Protected Access (WPA or WPA2) password. On December 28, Craig Heffner of Tactical Network Solutions released an open-source version of an attack tool, named Reaver, that exploits the vulnerability.

To find out just how big the hole was, I downloaded and compiled Reaver for a bit of New Years geek fun. As it turns out, it's a pretty big one—even with WPS allegedly turned off on a target router, I was able to get it to cough up the SSID and password. The only way to block the attack was to turn on Media Access Control (MAC) address filtering to block unwanted hardware.

My target was a Cisco Linksys WRT54G2 Wireless-G Broadband Router, an older but fairly common residential WiFi router. The PIN for the router is printed on the bottom, along with its MAC address; in WPS mode, a computer can use that PIN to retrieve the network configuration information without the user having to worry about remembering a long password or otherwise mess with the router's administrative interface. Normally, to get the PIN, you'd need to have physical access to the router.

For my attack platform, I used an aging Toshiba Satellite A135 running Ubuntu 11.10. In order to compile Reaver, I also had to install libpcap, the network traffic capture library, through Ubuntu's Software Center. With libcap configured, Reaver compiled without a hitch, and it was time to start beating on the door.

The first step in mounting an attack on a WiFi router is to identify the target's MAC address. While I was able to read it right off the router, the address was also easy to grab using a WiFi scanning application. (The scanner also revealed that most of my neighbors' WiFi networks were also potentially vulnerable to Reaver, or that they were still running older routers using only WEP security—and some had no security in place at all.) With the MAC of my target recorded, I prepared to unleash Reaver.

Before launching a brute-force PIN hacking effort with Reaver, the attack platform's wireless adapter needs to be put into "monitor" mode. In Linux, that's done from the command line using ifconfig (an interface configuration tool) and iwconfig (which controls the configuration of wireless interfaces); both need to be run as the root user. After making sure I was disconnected from any other WiFi network, I went into an Ubuntu terminal window and entered:

With the wireless adapter now ready to perform packet capture, I launched Reaver. The open-source version of Reaver is a command-line tool; Tactical Network Solutions also sells a commercial version that includes a Web-based client and software support. While I used version 1.2 of Reaver, a 1.3 version was released on January 3, and it can speed up attacks. It does so by reducing the size of the "secret number" used to create the shared encryption key used to pass requests—this cuts the crypto workload on the access point and reduces the time needed between attempts.

Reaver only requires two inputs to launch an attack: the interface to use to launch them, and the MAC address of the target. Because it accesses the wireless adapter directly, it needs to be run as root:

sudo reaver -i wlan0 -b 00:01:02:03:04:05

I went with this default approach, but there are a number of other parameters that can be used to tweak the attack for different routers, such as setting the tool to pause when the access point stops responding, and adding a response back to the access point to clear out failed attempts (this is not required by most routers). The results:

Sean Gallagher

The attack took about six hours to properly guess the PIN and return the SSID and password for the target network. During that time, the router locked up once under load, as I was putting normal levels of network traffic through it from other devices. Some routers will also lock out WPS requests for five minutes or so when they detect multiple failed PIN submissions—mine stopped responding occasionally, generating a string of warnings, but Reaver picked back up where it left off once the Linksys started responding again.

Having demonstrated the insecurity of WPS, I went into the Linksys' administrative interface and turned WPS off. Then, I relaunched Reaver, figuring that surely setting the router to manual configuration would block the attacks at the door. But apparently Reaver didn't get the memo, and the Linksys' WPS interface still responded to its queries—once again coughing up the password and SSID.

The tool also managed to repeatedly cause the router to stop responding to other computers on the network, essentially creating a denial of service attack—a great thing to remember for the next time my neighbors have a loud, all-night Call of Duty session.

In a phone conversation, Craig Heffner said that the inability to shut this vulnerability down is widespread. He and others have found it to occur with every Linksys and Cisco Valet wireless access point they've tested. "On all of the Linksys routers, you cannot manually disable WPS," he said. While the Web interface has a radio button that allegedly turns off WPS configuration, "it's still on and still vulnerable."

MAC filtering doesn't help either— that's "easily circumvented," he said. All an attacker has to do is use a network monitoring tool to detect the MAC address of a system that has an existing connection to the router, and set that as the address of their attack platform.

Six to eight hours seems like a lot of time to spend trying to hack into someone's residential WiFi. But considering how many small and medium-sized businesses use access points like the Linksys—and the kinds of data that could be exposed by gaining access to the computers on even the average home network—there's plenty of potential damage to be done by those who run the tool, or something similar of their own devising. And the attack could be carried out unattended, using a device left near the target network and controlled remotely.

The bottom line is that, while WPS was designed for simple security, there is no such thing as simple security. The only way to be absolutely sure that someone can't gain access to your wireless network with the WPS hack is to make sure you use a router that doesn't support the protocol.

Sean Gallagher / Sean is Ars Technica's IT Editor. A former Navy officer, systems administrator, and network systems integrator with 20 years of IT journalism experience, he lives and works in Baltimore, Maryland.