WiFi Hacking
My school is doing a festival and my club P.I.N.G. is doing some projects to show off. I suggested wifi hacking and man in the middle attack to demonstrate the dangers of http and public wifi. I've done a little bit of work in this area a few years ago so I don't think it will be that hard to repeat. I learned some of the things from the book Network Basics for Hackers by OccupyTheWeb.
Getting Started
From what I remembered, WEP to WPA2 hacking is relatively easy. Capture packet, decrypt password, and you're in. Now is it going to work this easy when I set this up, probably not, but I'll figure it out. To get started I checked what equipment I had. I have plenty of laptops, wifi cards that support monitor mode, and routers. This should be everything I need. I decided that I would attempt to use the web UI of a second router to act as a webserver I could get in the middle of. I setup the main router with the network 192.168.1.1/24 and connected the dLink router to the lan of the ASUS router. I configured the dLink to allow remote web management and tested the connection from the main network. It was a success, with that working it was time to remember how aircrack works.
What is aircrack-ng
Aircrack is a suite of tools used to evaluate and test wireless networks up to WPA2. It is composed of 4 main tools
| Name | Use |
|---|---|
| airmon-ng | Enables monitor mode for your wifi card |
| airodump-ng | Used to capture wifi packets |
| aireplay-ng | Used to send packets like for deauthentication |
| aircrack-ng | Used to crack the wifi keys |
How do you use the tools
The process is rather simple. Put your network card into monitor mode with airmon-ng. With the card in monitor mode you can use airodump-ng to capture surrounding wifi networks. Once you find a target network you can write down the BSSID (the MAC Address) and the SSID (the network name). With these two things you can start to dial in the attack. Using airodump again you can specify the BSSID and channel of the network to only listen to a single point of entry.
Now is the waiting game, you just have to listen and wait for someone to connect to the network and hope that you can capture the handshake. This can take a while if the network isn't very active, but it can be sped up. Using the tool aireplay-ng allows you to broadcast packets on a network. If you can find the MAC address of a devices on the network you can target it with a deauthentication attack. You basically pretend to be the router and broadcast the victim routers MAC address to the victim device telling it to disconnect. This forces the victim device to reconnect allowing more opportunity to grab the handshake.
The Setup
My original setup was thrown together with what scraps I could find. ASUS Router which will act as the target network. I then had the second DLink router that acted as a makeshift webserver. I discovered that Windows doesn't support USB passthrough or aircrack-ng, so I had to go download the latest Kali ISO and dual boot my main system. Once into Kali I got started with aircrack. I didn't know my BSSID so I did a quick airmon-ng scan and found all the info I needed.
kali@system:~$ sudo airmon-ng start wlan1
kali@system:~$ sudo airodump-ng wlan1mon
BSSID PWR Beacons #Data, #/s CH MB ENC CIPHER AUTH ESSID
34:97:F6:xx:xx:xx -20 6 0 0 8 65 WPA2 CCMP PSK DangerousNetwork
With the target wifi BSSID and ESSID I can start trying to capture a handshake. I start the airodump again but I add in specific selectors. Along with starting that, I started a deauth attack on one of the devices connected to the wifi network. After a few minutes I was able to capture a handshake.
kali@system:~$ sudo aireplay-ng -0 5 -a 34:97:F6:xx:xx:xx -c ta:rg:et:ma:ca:dd wlan1mon
20:00:00 Waiting for beacon frame (BSSID: 34:97:F6:xx:xx:xx) on channel 8
20:00:01 Sending 64 deauth to station -- STMAC: [ta:rg:et:ma:ca:dd] [ 5 / 5 pckts]
... GAP IN TIME ...
20:05:23 Sending 64 deauth to station -- STMAC: [ta:rg:et:ma:ca:dd] [ 9394 / 9394 pckts]
Once the packet is captured you can stop the airodump and put the wifi card back into station mode. The airodump should have created files in the folder where you ran the command. The one we're looking for is the wpacap-XX.cap which holds all the data from the wifi dump we collected. Using the last tool in the suite of aircrack is aircrack itself. Now this is just a dictionary attack, meaning if the password isn't in the list, you can't get in. There are other methods of hacking including bruteforce, but I don't have 4 years to crack a password.
kali@system:~$ sudo aircrack-ng -w /usr/share/wordlists/rockyou.txt ~/wpacap-03.cap
Reading packets, please wait...
Opening /home/kali/wpacap-03.cap
Read 4152 packets.
# BSSID ESSID Encryption
1 34:97:F6:xx:xx:xx DangerousNetwork WPA (1 handshake, with PMKID)
Choosing first network as target.
Reading packets, please wait...
Opening /home/kali/wpacap-03.cap
Read 4152 packets.
1 potential targets
Aircrack-ng 1.7
[00:00:00] 51/10303727 keys tested (2930.83 k/s)
Time left: 58 minutes, 35 seconds 0.00%
KEY FOUND! [ password ]
We now have access inside of the encrypted network.
The full setup.
Its time to finalize the setup. I have 3 laptops and 1 router. My server laptop is running the fake bank page and is directly wired to a lan port on the router. That completes the network and server side now i need a victim and an attacker. My Kali laptop will be running wireshark with an alfa card attached to it. Lastly the victim laptop is an old macbook air that will connect to the wifi and login to the fake bank page.
With all the device setup I can start the demonstration.
- Get into the wifi network
- Setup the attack laptop to monitor the broadcast of channel 8 with airmon-ng.
- Use airodump-ng to capture all packets on the wlan1mon to attempt to capture the handshake in a .cap file
- Connect the victim laptop to the wifi or attempt to deauth a client to capture a handshake.
- Find the wifi password with a dictionary attack.
- Analyze the network traffic
- Enable decryption in wireshark and add the password:SSID as a wpa-psw
- Sort the wireshark using the http filter
- Wait for http login form to cross the network.
I'm actively working on this page — check back later for the rest.