WPA-Enterprise: 802.1X, EAP and RADIUS
With a shared passphrase, the whole office has one key: when someone leaves, everyone gets a new one, and anyone who knows it can impersonate the network. WPA2/WPA3-Enterprise gives every user and device its own credentials, checked by a central server, with per-session keys and per-user policy such as the VLAN a user lands in. It is the default for organisations, and its security rests on two things this lesson and the next one examine: the EAP method and whether clients verify the server.
Three roles, two protocols
- The supplicant (client) and the authenticator (the AP, or a switch for wired 802.1X) speak EAP over LAN (EAPOL). Until authentication succeeds, the AP forwards nothing but EAP from that client.
- The AP relays EAP inside RADIUS (UDP 1812) to the authentication server, which checks the credentials against a directory and decides the policy.
- After success the server sends Access-Accept, with policy attributes (VLAN, session time) and the key material: the EAP method produces a MSK (master session key, at least 512 bits), the server sends it to the AP encrypted under the RADIUS shared secret, and both client and AP take its first 256 bits as the PMK. The 4-way handshake follows, exactly as in the PSK case, but with a PMK unique to this user and session.
EAP methods
EAP (RFC 3748) is a framework; the method decides what is actually checked.
| Method | Client proves itself with | Server proves itself with | Notes |
|---|---|---|---|
| EAP-TLS (RFC 5216; TLS 1.3 in RFC 9190) | a client certificate | a server certificate | strongest common choice: no passwords to phish; needs a PKI to issue device certificates (often via MDM) |
| PEAP (with EAP-MSCHAPv2 inside) | username + password, inside a TLS tunnel | a server certificate | very common with Windows/AD; secure only if clients validate the server certificate, because MSCHAPv2 responses can be brute-forced |
| EAP-TTLS (with PAP, MSCHAPv2 … inside) | password inside a TLS tunnel | a server certificate | like PEAP; with PAP the password itself crosses the tunnel |
| TEAP (RFC 7170, replaced by RFC 9930 in 2026) | certificates and/or passwords, chained | a server certificate | tunnelled method designed to replace PEAP and EAP-FAST |
| EAP-SIM / AKA / AKA' | SIM card | network (mutual via the SIM) | mobile carriers, Passpoint |
| EAP-PWD | password (Dragonfly PAKE) | password | no certificates; shared the Dragonblood implementation bugs |
| EAP-MD5, LEAP | password | nothing | broken or no server authentication: never for Wi-Fi |
Inside the tunnelled methods the outer identity (sent in the clear before the tunnel) can be anonymous, such as anonymous@lab.test; the real username goes inside the tunnel.
RADIUS integrity: the shared secret at work
The AP and the RADIUS server share a secret. It authenticates the server's answers, so an attacker on the network path can't turn a reject into an accept or change the VLAN. Two checks matter:
- The Response Authenticator (RFC 2865): an MD5 hash over the response, the request's 16-byte authenticator and the shared secret.
- The Message-Authenticator attribute (type 80, RFC 3579): an HMAC-MD5 over the whole packet, mandatory for EAP.
The program builds an Access-Accept that puts alice@lab.test on VLAN 20, verifies it as the AP does, and then changes the VLAN to 10 without the secret:
import hashlib, hmac, struct
SECRET = b"lab-radius-shared-secret-7f3c9a" # AP <-> RADIUS shared secret (lab value; real: long, unique per AP)
REQ_AUTH = bytes.fromhex("0f1e2d3c4b5a69788796a5b4c3d2e1f0") # from the Access-Request; real: fresh per request
def attr(t, value): return bytes([t, 2 + len(value)]) + value
def access_accept(ident, attrs):
"""RADIUS Access-Accept (RFC 2865) with a Message-Authenticator (RFC 3579)."""
body = b"".join(attrs) + attr(80, bytes(16)) # Message-Authenticator, zero for now
hdr = lambda auth: struct.pack(">BBH", 2, ident, 20 + len(body)) + auth
ma = hmac.new(SECRET, hdr(REQ_AUTH) + body, hashlib.md5).digest() # HMAC-MD5 over the packet
body = body[:-16] + ma
resp_auth = hashlib.md5(hdr(REQ_AUTH) + body + SECRET).digest() # Response Authenticator
return hdr(resp_auth) + body
def ap_verify(pkt):
code, ident, length = struct.unpack_from(">BBH", pkt)
resp_auth, body = pkt[4:20], pkt[20:length]
ok_resp = hmac.compare_digest(hashlib.md5(pkt[:4] + REQ_AUTH + body + SECRET).digest(), resp_auth)
attrs, pos = {}, 0
while pos < len(body):
t, ln = body[pos], body[pos + 1]
attrs[t] = (pos, body[pos + 2:pos + ln]); pos += ln
ma_pos, ma = attrs[80]
zeroed = body[:ma_pos + 2] + bytes(16) + body[ma_pos + 18:]
ok_ma = hmac.compare_digest(hmac.new(SECRET, pkt[:4] + REQ_AUTH + zeroed, hashlib.md5).digest(), ma)
return ok_resp, ok_ma, attrs[1][1].decode(), attrs[81][1].decode()
pkt = access_accept(7, [attr(1, b"alice@lab.test"), attr(81, b"20")]) # User-Name, VLAN 20 (staff)
print("Access-Accept:", len(pkt), "bytes, header", pkt[:4].hex(" "))
print("AP check (response auth, message-authenticator, user, VLAN):", ap_verify(pkt))
# Someone on the path changes the VLAN from 20 (staff) to 10 (admins) without knowing the secret
i = pkt.index(attr(81, b"20"))
tampered = pkt[:i] + attr(81, b"10") + pkt[i + 4:]
print("tampered (response auth, message-authenticator, user, VLAN):", ap_verify(tampered))Access-Accept: 58 bytes, header 02 07 00 3a
AP check (response auth, message-authenticator, user, VLAN): (True, True, 'alice@lab.test', '20')
tampered (response auth, message-authenticator, user, VLAN): (False, False, 'alice@lab.test', '10')
Both checks fail on the tampered packet, so the AP drops it. MD5 is weak, though, and in July 2024 the Blast-RADIUS attack (CVE-2024-3596) showed that an attacker who can sit between AP and server can use an MD5 chosen-prefix collision to forge a valid Response Authenticator for an Access-Accept, when the Message-Authenticator isn't required. The fixes: require Message-Authenticator on every Access-Request and response (all major servers and many network devices added this setting), and carry RADIUS inside TLS (RadSec, RFC 6614) when it crosses networks you don't control.
How Enterprise weaknesses are detected
- Configuration review of clients: is the server certificate validated (trusted CA, expected server name)? Outer identity anonymous? Allowed EAP methods restricted? (next lesson)
- Configuration review of servers: weak methods (EAP-MD5, LEAP, PAP outside a tunnel) enabled; TLS versions; Message-Authenticator required; shared secrets long and unique per AP; RADIUS traffic restricted to the management network.
- RADIUS logs: authentication failures per user and per AP, unknown NAS (AP) addresses, accounts authenticating from unusual APs at unusual times; these feed the SIEM like any login log.
How it is fixed
- Prefer EAP-TLS with device certificates issued by MDM; where passwords stay, use PEAP or TEAP with enforced server validation pushed by device management.
- Require Message-Authenticator, use long random shared secrets per AP, isolate RADIUS on the management network or wrap it in RadSec.
- Use RADIUS policy for least privilege: VLANs or roles per user group, session timeouts, revocation when an account is disabled.
- For WPA3-Enterprise, require PMF; the 192-bit mode adds Suite-B ciphers for high-security environments.
Pitfalls
- "Enterprise is secure by itself": PEAP without server validation hands password hashes to any evil twin.
- Sharing one RADIUS secret across all APs and writing it in documentation.
- Leaving RADIUS over plain UDP across the Internet between sites.
Practice
1. Where does the PMK come from in Enterprise mode, and who knows it?
From the MSK produced by the EAP method: client and RADIUS server derive it, the server sends it to the AP (protected with the RADIUS shared secret), and both client and AP use its first 256 bits as the PMK. Other users never know it, unlike a PSK.
2. In the program, the attacker also knows the shared secret. Can the AP still detect the VLAN change?
No. With the secret the attacker can recompute both authenticators. The shared secret is the root of trust between AP and server, so it must be long, unique per AP and kept off shared documents.
3. Why is EAP-MD5 unsuitable for Wi-Fi?
It authenticates only the client, with an MD5 challenge-response that can be guessed offline from a capture, and it produces no keys for encrypting the session. Any fake AP can collect the responses.
Test yourself
In 802.1X, which device checks the user's credentials?
- The access point
- The authentication (RADIUS) server
- The DHCP server
- The client
Which EAP method uses certificates on both sides and no passwords?
- PEAP-MSCHAPv2
- EAP-TTLS/PAP
- EAP-TLS
- EAP-MD5
What protects a RADIUS Access-Accept against tampering on the path?
- UDP checksums
- The Response Authenticator and the Message-Authenticator, both keyed by the shared secret
- The VLAN number
- Encryption of the whole packet
What is the main fix for Blast-RADIUS (CVE-2024-3596)?
- Turn off 802.1X
- Require the Message-Authenticator attribute (and use RADIUS over TLS across untrusted networks)
- Use WEP
- Shorten the shared secret