#1 An Introduction to Wireless Hacking

Over time, many homes and organizations have moved toward wireless networks. One of the reasons, why people are switching to wireless networks is, to overcome physical limitations. From a hacker’s perspective, wireless networks are an easy target; when compared with wired networks, they are easy to sniff and attack.


In this series, we will cover a wide variety of attacks that can be performed against a wireless network. we will start by discussing how to bypass the low-level security that a network administrator often implements, such as hiding SSID and enabling MAC filtering. After that, we will dive into the essence of this series, where I will demonstrate how easy it is to crack WEP/WPA/WPA2 pre-shared keys. Finally, we will talk about where I will demonstrate how to set up a fake access point and compromise anyone connecting to your fake access point.

Requirements

For this purpose, your Requirements will be

  • A Wireless access point,
  • And a Wireless adapter that supports packet injection.

These two things are all we require for replicating what’s being discussed in this series. The access point is required because we don’t want to attack the neighbor’s access point because it would be unethical, and as a penetration tester or an ethical hacker, you should make sure that you follow ethics.

The second and the most important requirement is a wireless adapter that supports packet injection and is also able to sniff in the monitor mode. Personally, I prefer the tp-link AC600 wireless adapter; it not only supports packet injection but also supports both 2.4 and 5 GHz frequencies at a cheap price. You can find out a few others I will list them in my blog.

Once you have a tp-link AC600 adapter that supports packet injection, then plug in the adapter to your computer, and since we are running Parrot Security OS from our virtual machine, we need to attach the network adapter to our Parrot security Operating system machine.

This can be done by going into the menu at the bottom of your PC → USB → Click on the Realtek 802.11ac WLAN adapter. It will automatically manage to detect our network adapter.

Next, we will execute the “iwconfig” command to confirm that our Parrot security machine has been able to detect our network adapter.

┌─[mr-dev@ParrotSec]─[~]
└──╼ $iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlx5ca6e6d99859  unassociated  ESSID:""  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency=2.412 GHz  Access Point: Not-Associated   
          Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=0/100  Signal level=0 dBm  Noise level=0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Our Parrot Security machine has managed to detect our wireless network adapter; however, as we can see, it is not associated with any access point.

We could use the network manager from the top of the window to check the available wireless networks.

Once we have connected to the appropriate access point and executed “iwconfig”, we will see that the interface contains information regarding ESSID, MAC address, etc.

┌─[mr-dev@ParrotSec]─[~]
└──╼ $iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlx5ca6e6d99859  IEEE 802.11bgn  ESSID:"AndroidAP"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.437 GHz  Access Point: BC:D1:1F:00:C0:09   
          Bit Rate:72.2 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=100/100  Signal level=-41 dBm  Noise level=0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0



Why I did not prefer to use the Kali Linux for wifi penetration testing?

The first problem I found was that while I plug in the wifi adapter to Kali Linux I found that I have to install the driver separately.

You can list the adapters by running lsusb command. 

┌─[mr-dev@kali]─[~]
└──╼ $ lsusb
Bus 001 Device 003: ID 2357:0120 TP-Link Archer T2U PLUS [RTL8821AU]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
┌─[mr-dev@ParrotSec]─[~]
└──╼ $

As you can see my adapter is listed here. You can install the adapter by running sudo apt-get install realtek-*. 

┌─(mr-dev@kali)─[~]
└──$ sudo apt-get install realtek-*

This will download all preferred adapters for Realtek. Once you are done with this then reboot your system.

Now, execute the “iwconfig” command to confirm if our Kali Linux machine has been able to detect our network adapter or not. As I already told you this will not happen.

┌─(mr-dev@kali)─[~]
└──$ iwconfig
lo        no wireless extensions.
eth0      no wireless extensions.
eth1      no wireless extensions.

I thought there will be a problem with the Virtual Box Guest addition. So I install that. Firstly copy the disk to the desktop. Now change the directory to cdrom0 and list the files and directories and execute the program. 

┌─(mr-dev@kali)─[~/Desktop]
└──$ sudo cp -r /media/cdrom0 .
┌─(mr-dev@kali)─[~/Desktop]
└──$ sudo ./VBoxLinuxAdditions.run

Notice the output, I have spotted a problem, the kernel header is not found for Kali Linux's latest version. So there may be a fault with Virtual Box. I have tried with dist upgrade but there will be no solution there. 

So I switch to Parrot Security operating system.


Putting the wireless card in Monitor Mode

The next thing we want to do is switch our network card into monitor mode. A doubts come to my mind, why monitor mode in Wi-Fi penetration testing is so important? The result is, The Monitor mode, or RFMON (Radio Frequency MONitor) mode, allows a computer with a wireless network interface controller (WNIC) to sniff all traffic received on a wireless channel.

However, to sniff on wireless networks, we need to make sure that our network card is in monitor mode. One of the advantages of the tp-link ac600 card is that it allows us to sniff in the monitor mode, so you need to make sure that your network card is allowed to sniff in the monitor mode for this work.

In Monitor mode, your card can listen to every packet that is around us.

By default, the mode of wireless devices is set to "Managed" which means our wireless device will only capture packets that have our device's MAC address as the destination MAC.

We can use the following command to change the network card to the monitor mode:

┌─[mr-dev@ParrotSec]─[~]
└──╼ $sudo ifconfig wlx5ca6e6d99859 down
[sudo] password for mr-dev: 
┌─[✗]─[mr-dev@ParrotSec]─[~]
└──╼ $sudo iwconfig wlx5ca6e6d99859 mode monitor
┌─[mr-dev@ParrotSec]─[~]
└──╼ $sudo ifconfig wlx5ca6e6d99859 up
┌─[mr-dev@ParrotSec]─[~]
└──╼ $

So now we can see that we have successfully enabled monitor mode on the wlx5ca6e6d99859 interface. We can use the "iwconfig" command to confirm all the interfaces that have monitor mode enabled.

┌─[mr-dev@ParrotSec]─[~]
└──╼ $iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlx5ca6e6d99859  unassociated  ESSID:""  Nickname:"<WIFI@REALTEK>"
          Mode:Monitor  Frequency=2.437 GHz  Access Point: Not-Associated   
          Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=0/100  Signal level=0 dBm  Noise level=0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

There is an another tool which is used in terms of enabling monitor mode. The tool is mostly used tool is airmon-ng

airmon-ng

Airmon-ng is a part of Aircrack-ng. Aircrack-ng is a set of utilities for analyzing WiFi networks for weaknesses. You can use it to monitor WiFi security, capture data packets, and export them to text files for additional analysis. Capture and injection of WiFi cards can be done to verify their performance. We will briefly summarize all tools in the next in this series.

Before using the airmon-ng tool, firstly we have to change the mode to manage. Once you did, we can use the airmon-ng start and paste the interface name command to change the network card to the monitor mode.

┌─[✗]─[mr-dev@ParrotSec]─[~]
└──╼ $sudo iwconfig wlx5ca6e6d99859 mode managed
┌─[mr-dev@ParrotSec]─[~]
└──╼ $sudo airmon-ng start wlx5ca6e6d99859

So now we can see that we have successfully enabled monitor mode on the wireless interface. We can use the iwconfig command to confirm all the interfaces that have monitor mode enabled.

┌─[mr-dev@ParrotSec]─[~]
└──╼ $iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlx5ca6e6d99859  unassociated  ESSID:""  Nickname:"<WIFI@REALTEK>"
          Mode:Monitor  Frequency=2.437 GHz  Access Point: Not-Associated   
          Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=0/100  Signal level=0 dBm  Noise level=0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Let’s check if the wireless adapter is capable of packet injection or not using the aireplay-ng --test <adapter name>.

┌─[mr-dev@ParrotSec]─[~]
└──╼ $sudo aireplay-ng --test wlx5ca6e6d99859

On execution, it will check and you can see the result on my screen, which means it is capable of packet injection.


Monitoring Beacon Frames on Wireshark

Now that we have the monitor mode enabled, we will sniff on the network interfaces, which will bring us beacon frames containing the SSID that is being broadcasted. If the SSID is not broadcasted, it won’t show up.

Firstly start Wireshark, and select the appropriate interface.

We selected the appropriate interface to sniff on. Now, we are now able to see beacon frames from other access points, which we are not associated with. 

Whenever the client authenticates against the access point with the hidden SSID, it will send an SSID parameter; therefore, we can easily figure out what the real SSID is.


Monitoring the traffic using Airodump-ng

The easy way around is to use airodump-ng to start monitoring the traffic; as soon as the client authenticates, the SSID will be revealed.

Airodump-ng is a packet capture utility that captures and saves raw data packets for further analysis.

To capture the packets use airodump-ng and specify the interface name. 

┌─[mr-dev@ParrotSec]─[~]
└──╼ $sudo airodump-ng wlx5ca6e6d99859

Before executing let me start the hotspot of my smartphone. One of them is broadcasting a 2.4 GHz frequency band and another one is a 5GHZ frequency band.

 CH  8 ][ Elapsed: 24 s ][ 2022-04-22 20:06 

 BSSID              PWR  Beacons    #Data, #/s  CH   MB   ENC CIPHER  AUTH ESSID

 BC:D1:1F:00:C0:09  -37       20        0    0   6   65   WPA2 CCMP   PSK  AndroidAP                                            

 BSSID              STATION            PWR   Rate    Lost    Frames  Notes  Probes

 BC:D1:1F:00:C0:09  4C:34:88:7A:A5:CB  -35    0 - 1      0        1  

On execution, it will start sniffing all of the information of access points around me. As you can see we have one access point listed, which is a 2.4GHz band access point. So it means

By default, the airodump-ng is set to the 2.4 GHz band. So we have to specify the band while on execution.

┌─[mr-dev@ParrotSec]─[~]
└──╼ $sudo airodump-ng --band a wlx5ca6e6d99859

 CH  8 ][ Elapsed: 24 s ][ 2022-04-22 20:06 

 BSSID              PWR  Beacons    #Data, #/s  CH   MB   ENC CIPHER  AUTH ESSID

 BC:D1:1F:00:C0:09  -37       20        0    0   6   65   WPA2 CCMP   PSK  AndroidAP                                            
 76:C1:7D:A7:74:16  -48       7         0    0   13  65   WPA2 CCMP   PSK  Infinix Hot 8

 BSSID              STATION            PWR   Rate    Lost    Frames  Notes  Probes

 BC:D1:1F:00:C0:09  4C:34:88:7A:A5:CB  -35    0 - 1      0        1  

On execution, you will be sniffing all of the information of access points that are not listed previously, which means sniffing is set to the 5 GHz frequency band.

I hope you understood, how a wireless adapter is important for wireless penetration testing.

Post a Comment

If you have any doubts or any queries you can specify here.

Previous Post Next Post