247CTF - 00ps, my WiFi disconnected
1 | Our WiFi keeps disconnecting. We captured wireless traffic to try and figure out what’s happening, but it’s all temporal zeros to us! I think someone is trying to exploit a WiFi vulnerability.. Can you decrypt the traffic and gain access to the flag? |
The hint "temporal zeros" and the context of a WiFi vulnerability strongly suggest the KRACK (Key Reinstallation Attack), specifically CVE-2017-13077.
Vulnerability Analysis: Why "Zeros"?
In a standard WPA2 4-way handshake, the client and AP negotiate a PTK (Pairwise Transient Key). KRACK works by intercepting and replaying Message 3 of the handshake, forcing the client to reinstall an already in-use key. This resets nonces (packet numbers) and replay counters.
For certain versions of wpa_supplicant (notably 2.4 and
2.5), a critical implementation bug exists: when the key is reinstalled,
the Temporal Key (TK) is not just reused, but
cleared to all zeros.
The captured 802.11 CCMP packets are encrypted using a
16-byte key of \x00 values.
The WPA2 4-way Handshake & PTK
- Message 1: AP sends a random number (ANonce) to the Client.
- Message 2: Client generates its own random number (SNonce), derives the PTK using both Nonces, and sends SNonce to the AP.
- Message 3: AP derives the same PTK, sends the Group Temporal Key (GTK), and instructs the Client to install the PTK.
- Message 4: Client confirms installation with an ACK.
The KRACK attack manipulates Message 3 to trigger the "all-zero" TK bug.
Decryption Methods
Method 1: Wireshark GUI
If you prefer a visual approach, you can configure Wireshark to decrypt the traffic using the zeroed key:
- Open Preferences
(
Ctrl + Shift + P). - Go to Protocols -> IEEE 802.11.
- Check "Enable decryption".
- Click "Edit..." next to Decryption keys.
- Add a new key:
- Key type:
tk - Key:
00000000000000000000000000000000(32 zeros)
- Key type:
Method 2: Scapy Script (CLI)
The following script manually reconstructs the CCM Nonce and decrypts the packets using the zeroed Temporal Key.
1 | import binascii |