#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.


Throughout this series, we'll explore a range of attacks targeting wireless networks. We'll begin by examining methods to bypass common low-level security measures employed by network administrators, such as hiding SSIDs and enabling MAC filtering. Then, we'll delve into the core of this series, demonstrating the simplicity of cracking WEP/WPA/WPA2 pre-shared keys. Lastly, we'll discuss setting up a fake access point and compromising anyone connecting to it.


Preparing Wireless Infrastructure for WiFi Hacking Operations


To participate in the activities discussed in this series, you'll need:
  • A wireless access point.
  • A wireless adapter is capable of packet injection.

These two components are essential for our purposes. We use our own access point to ensure ethical behavior; attacking a neighbor's network would be unethical. As a penetration tester or ethical hacker, it's crucial to uphold ethical standards.

The second requirement, a wireless adapter, is paramount. It must support packet injection and be capable of operating in monitor mode for sniffing. Personally, I recommend the TP-Link AC600 wireless adapter for its affordability and compatibility with both 2.4 and 5 GHz frequencies. You can also explore additional options listed 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


Reasons for Avoiding Kali Linux for WiFi Penetration Testing

One major issue encountered with Kali Linux was the need to manually install drivers when connecting a WiFi adapter. To check if your adapter is recognized, use the " 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. To install the adapter, I used the command:

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

This command downloads the preferred Realtek adapters. After installation, it's essential to reboot the system. However, even after these steps, running " iwconfig " showed no wireless extensions detected.

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

I thought there would be a problem with the Virtual Box Guest addition. So, I attempted to address this issue by installing VirtualBox Guest Additions, which involved copying the disk contents to the desktop and running the installation program:

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

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

Unfortunately, I encountered a problem where the kernel headers were not found for Kali Linux's latest version, even after attempting a distribution upgrade.

Given these challenges, I opted to switch to the Parrot Security operating system.


Enable Network Monitor Mode on

To effectively conduct Wi-Fi penetration testing, we first switch our network card to monitor mode. This mode, also known as RFMON (Radio Frequency MONitor) mode, enables a wireless network interface controller (WNIC) to capture all traffic on a wireless channel.

Monitor mode is crucial for sniffing on wireless networks. The TP-Link AC600 card offers this capability, ensuring your network card can sniff in monitor mode for this task.

In monitor mode, your card can capture every packet in its vicinity.

By default, wireless devices operate in "Managed" mode, which restricts them to capturing packets with their own MAC address as the destination.


Approach 1: Enabling Monitor Mode via ifconfig and iwconfig

To switch the network card to monitor mode, use the following command:

┌─[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 another tool that is used in terms of enabling monitor mode. The tool is mostly used tool is airmon-ng


Approach 2: Enabling monitor mode with 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


Verifying Packet Injection Functionality with Aireplay-ng

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 can 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 this 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 understand, how a wireless adapter is important for wireless penetration testing.

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Ok, Go it!