802.11 Frames, Management Frames and PMF (802.11w)
A Wi-Fi network's whole security policy is announced in the clear, ten times a second, in every beacon. A defender who can read a beacon can audit an access point without logging in to it, and a wireless intrusion-detection sensor reads the same fields. This lesson takes frames apart byte by byte, then looks at the management frames that were unauthenticated for the first decade of Wi-Fi and the amendment that fixed them: Protected Management Frames, IEEE 802.11w (2009), now part of IEEE 802.11.
The frame header
Every 802.11 frame starts with a Frame Control field (2 bytes, little-endian), then a duration and up to four addresses:
| Field | Size | Content |
|---|---|---|
| Frame Control | 2 | protocol version (bits 0–1), type (2–3: 0 management, 1 control, 2 data), subtype (4–7), then flags: To DS, From DS, More Fragments, Retry, Power Management, More Data, Protected (bit 14), +HTC/Order |
| Duration/ID | 2 | how long the medium is reserved |
| Address 1 | 6 | receiver |
| Address 2 | 6 | transmitter |
| Address 3 | 6 | BSSID (for most management frames) |
| Sequence Control | 2 | fragment number (4 bits) and sequence number (12 bits) |
| Body | n | fixed fields and elements (management), or the payload (data) |
| FCS | 4 | CRC-32 (often stripped by capture drivers) |
Useful management subtypes: 0 association request, 1 association response, 4 probe request, 5 probe response, 8 beacon, 10 disassociation, 11 authentication, 12 deauthentication, 13 action. A beacon's Frame Control is therefore 80 00, a deauthentication's c0 00.
The RSN element: the security policy in one place
Element 48, the RSN element (robust security network), lists: version 1, the group cipher, the pairwise ciphers, the AKM suites (authentication and key management: 1 = 802.1X, 2 = PSK, 6 = PSK-SHA256, 8 = SAE, all under the OUI 00-0F-AC) and two bytes of RSN capabilities, where bit 7 is MFPC (management frame protection capable) and bit 6 MFPR (required).
The program builds three beacons with struct, the way an access point would, and parses them back as a sensor does:
import struct
def mac(b): return ":".join(f"{x:02x}" for x in b)
def m(s): return bytes.fromhex(s.replace(":", ""))
def rsn(akms, caps): # version 1, CCMP group + one CCMP pairwise, the AKM list, capabilities
body = struct.pack("<H", 1) + m("000fac04") + struct.pack("<H", 1) + m("000fac04")
body += struct.pack("<H", len(akms)) + b"".join(m("000fac") + bytes([a]) for a in akms)
return body + struct.pack("<H", caps)
def beacon(bssid, ssid, ch, rsn_body):
hdr = struct.pack("<HH", 0x0080, 0) + m("ff:ff:ff:ff:ff:ff") + m(bssid) + m(bssid) + struct.pack("<H", 42 << 4)
fixed = struct.pack("<QHH", 0, 100, 0x0411) # timestamp, interval (TU), capabilities (ESS, privacy)
elems = bytes([0, len(ssid)]) + ssid.encode() + bytes([3, 1, ch]) + bytes([48, len(rsn_body)]) + rsn_body
return hdr + fixed + elems
AKM = {1: "802.1X", 2: "PSK", 6: "PSK-SHA256", 8: "SAE"}
def parse(frame):
fc, = struct.unpack_from("<H", frame, 0)
out = {"type": (fc >> 2) & 3, "subtype": (fc >> 4) & 15, "bssid": mac(frame[16:22])}
pos = 24 + 12 # MAC header, then a beacon's fixed fields
while pos + 2 <= len(frame):
eid, ln = frame[pos], frame[pos + 1]
body = frame[pos + 2:pos + 2 + ln]
if eid == 0: out["ssid"] = body.decode()
if eid == 3: out["channel"] = body[0]
if eid == 48:
n_pw, = struct.unpack_from("<H", body, 6)
p = 8 + 4 * n_pw
n_akm, = struct.unpack_from("<H", body, p)
out["akm"] = [AKM.get(body[p + 2 + 4 * i + 3], "?") for i in range(n_akm)]
caps, = struct.unpack_from("<H", body, p + 2 + 4 * n_akm)
out["mfpc"], out["mfpr"] = bool(caps & 0x80), bool(caps & 0x40)
pos += 2 + ln
return out
frames = [beacon("02:00:00:0a:0a:01", "LabNet", 6, rsn([2, 8], 0x0080)), # transition mode, PMF capable
beacon("02:00:00:0a:0b:01", "LabNet-IoT", 11, rsn([2], 0x0000)), # WPA2-PSK, no PMF
beacon("02:00:00:0a:0c:01", "LabNet-Staff", 36, rsn([8], 0x00c0))] # WPA3 only, PMF required
print("header of the first beacon:", frames[0][:24].hex(" "))
for f in frames:
b = parse(f)
pmf = "required" if b["mfpr"] else "capable" if b["mfpc"] else "OFF"
print(f"type {b['type']} subtype {b['subtype']:>2} {b['ssid']:12} {b['bssid']} ch {b['channel']:>2}"
f" AKM {'+'.join(b['akm']):8} PMF {pmf}")header of the first beacon: 80 00 00 00 ff ff ff ff ff ff 02 00 00 0a 0a 01 02 00 00 0a 0a 01 a0 02
type 0 subtype 8 LabNet 02:00:00:0a:0a:01 ch 6 AKM PSK+SAE PMF capable
type 0 subtype 8 LabNet-IoT 02:00:00:0a:0b:01 ch 11 AKM PSK PMF OFF
type 0 subtype 8 LabNet-Staff 02:00:00:0a:0c:01 ch 36 AKM SAE PMF required
Three networks, three policies. The IoT network is the weak one: WPA2-PSK only and no PMF. That is common, because cheap IoT chips are often the last devices to support WPA3 and PMF; Network Segmentation for IoT limits the damage.
Why management frames needed protection
Until 802.11w, management frames had no integrity protection at all. A deauthentication or disassociation frame is a few bytes with a reason code, and a station believed any such frame that carried the right addresses. Anyone in range could forge one with the AP's address and disconnect clients (a denial of service); disconnecting a client also makes it repeat its handshake, which is how weak WPA2 passphrases end up exposed to offline guessing, and how clients are pushed towards an evil twin.
PMF fixes this once keys exist:
- Unicast management frames such as deauthentication, disassociation and robust action frames are encrypted and integrity-protected with the pairwise key (CCMP), like data.
- Broadcast/multicast management frames carry a MIC element computed with a group key, the IGTK, using BIP (broadcast integrity protocol, AES-CMAC by default).
- An unprotected deauthentication received by a PMF client is ignored. If a client tries to re-associate while the AP still thinks it is connected, the AP runs an SA Query to check whether the old association is still alive instead of tearing it down on request.
PMF can't protect frames sent before keys exist (beacons, probes, authentication), and it doesn't stop radio jamming. It is mandatory for WPA3 and for Wi-Fi 6 certification, and optional ("capable") in WPA2.
The client-side rule fits in a few lines. Two deauthentication frames from the lab sensor's log, as raw bytes:
import struct
logged = {
"unprotected": "c0003a01020000" "0a0a05" "0200000a0a01" "0200000a0a01" "4006" "0700",
"protected": "c0403a01020000" "0a0a05" "0200000a0a01" "0200000a0a01" "5006" "<CCMP header + encrypted body + MIC>",
}
REASONS = {1: "unspecified", 3: "station leaving", 7: "class 3 frame from nonassociated station"}
def client_accepts(frame_hex, pmf_negotiated):
raw = bytes.fromhex(frame_hex.split("<")[0])
fc, = struct.unpack_from("<H", raw, 0)
subtype, protected = (fc >> 4) & 15, bool(fc & 0x4000)
assert subtype == 12 # deauthentication
if protected:
if not pmf_negotiated:
return "dropped: protected frame, but no management-frame keys were agreed"
return "decrypt with TK and check the MIC first; only a valid frame disconnects"
if pmf_negotiated:
return "IGNORED: PMF is on and this deauth is not protected"
return f"accepted: reason {raw[24]} ({REASONS.get(raw[24], '?')}), client disconnects"
for name, frame in logged.items():
for pmf in (False, True):
print(f"{name:11} PMF {'on ' if pmf else 'off'}: {client_accepts(frame, pmf)}")unprotected PMF off: accepted: reason 7 (class 3 frame from nonassociated station), client disconnects
unprotected PMF on : IGNORED: PMF is on and this deauth is not protected
protected PMF off: dropped: protected frame, but no management-frame keys were agreed
protected PMF on : decrypt with TK and check the MIC first; only a valid frame disconnects
Only the first line disconnects the client: without PMF, a forged frame with the right addresses is enough.
Auditing beacons with real tools
Sensors and analysts read the same fields with Wireshark's dissectors. This session (in the sandbox, with no network and no radio) writes the three lab beacons to a capture file with scapy and reads them back with tshark:
cat > beacons.py <<'PY'
from scapy.all import RadioTap, Dot11, Dot11Beacon, Dot11Elt, wrpcap
def rsn(akms, caps):
return (bytes.fromhex("0100000fac040100000fac04") + len(akms).to_bytes(2, "little")
+ b"".join(bytes.fromhex("000fac") + bytes([a]) for a in akms) + caps.to_bytes(2, "little"))
nets = [("LabNet", "02:00:00:0a:0a:01", 6, [2, 8], 0x80), ("LabNet-IoT", "02:00:00:0a:0b:01", 11, [2], 0),
("LabNet-Staff", "02:00:00:0a:0c:01", 36, [8], 0xc0)]
pkts = []
for i, (ssid, bssid, ch, akms, caps) in enumerate(nets):
p = (RadioTap() / Dot11(type=0, subtype=8, addr1="ff:ff:ff:ff:ff:ff", addr2=bssid, addr3=bssid)
/ Dot11Beacon(cap=0x0411) / Dot11Elt(ID=0, info=ssid.encode()) / Dot11Elt(ID=3, info=bytes([ch]))
/ Dot11Elt(ID=48, info=rsn(akms, caps)))
p.time = 1768471200 + i
pkts.append(p)
wrpcap("beacons.pcap", pkts)
PY
python3 beacons.py
tshark -r beacons.pcap -T fields -E header=y -e wlan.bssid -e wlan.ds.current_channel \
-e wlan.rsn.akms.type -e wlan.rsn.capabilities.mfpc -e wlan.rsn.capabilities.mfprwlan.bssid wlan.ds.current_channel wlan.rsn.akms.type wlan.rsn.capabilities.mfpc wlan.rsn.capabilities.mfpr
02:00:00:0a:0a:01 6 2,8 True False
02:00:00:0a:0b:01 11 2 False False
02:00:00:0a:0c:01 36 8 True True
Each row is one access point's policy: the AKM types (2 = PSK, 8 = SAE) and the two PMF bits. A survey that lists every BSSID with mfpc/mfpr false is a ready-made finding list.
How deauthentication abuse is detected
- WIDS counters: deauthentication and disassociation frames per BSSID and per client per time window; a burst far above the baseline (normal networks send a handful per hour) raises an alert. Rogue APs and Wireless Intrusion Detection builds one.
- Sequence-number anomalies: forged frames carry sequence numbers that don't fit the real AP's counter.
- Client symptoms: repeated reconnections and handshakes in AP logs, users reporting drop-outs.
- On PMF networks: unprotected deauthentications aimed at PMF clients are a strong signal on their own, because the real AP never sends them.
How it is fixed
- PMF required (
ieee80211w=2in hostapd terms) on every SSID whose clients support it; WPA3 networks have it by definition. - PMF capable (optional) on transition and mixed networks, so newer clients get it.
- Keep the IoT SSID separate, and plan its upgrade to WPA3/PMF with the device vendors.
- Accept the limits: jamming and frames before key establishment can't be prevented by protocol; they are detected and located.
Pitfalls
- Reading "PMF capable" as "protected": a client that doesn't support PMF still connects without it.
- Assuming PMF stops all denial of service: radio jamming and pre-association floods remain.
- Turning PMF to "required" on a network with old clients without testing: they silently fail to join.
Practice
1. A beacon's RSN capabilities field is 0x0080. What does it say about PMF?
Bit 7 (MFPC) is set and bit 6 (MFPR) is not: the AP supports PMF but doesn't require it. Clients that support PMF use it; others connect without it.
2. Why does a forged deauthentication help an attacker who wants to guess a WPA2 passphrase?
The disconnected client reconnects at once and repeats the 4-way handshake, so a nearby observer captures it without waiting. PMF removes that lever, and a strong passphrase or SAE removes the payoff.
3. Change the second program so that a protected deauthentication with an invalid MIC is reported as an alert.
Add a parameter mic_ok and, when protected and pmf_negotiated are true and mic_ok is false, return "DROP and alert: protected frame with a bad MIC". Frames that fail integrity checks are a signal worth logging, not just discarding.
Test yourself
What does Frame Control c0 00 identify?
- A beacon
- A deauthentication frame
- A data frame
- A probe request
Which RSN capability bits tell you PMF is required?
- MFPC only
- MFPR (bit 6), together with MFPC (bit 7)
- The Privacy bit of the capabilities field
- AKM type 2
How are broadcast management frames protected under PMF?
- They are encrypted with the PTK
- They carry a MIC element computed with the IGTK (BIP)
- They are not protected
- With WEP
Which attack does PMF NOT prevent?
- Forged deauthentication of a PMF client
- Forged disassociation
- Radio jamming
- Spoofed robust action frames