I'm trying to learn how ephemeral keys in WPA2 4-way handshake are derived.
Starting from 4 EAPOL packets sniffing, I successfully derived PMK
and PTK
reading ANonce
, SNonce
, and knowing ASCII-PSK and the SSID.
From PTK
I derived, by splitting it, the KCK
(128bit), the KEK
(128bit), TK
for ENC (128bit) and the TK
for MIC
(128bit).
I'm stuck in a GTK
derivation.
If I understood correctly, the GTK
is transmitted encrypted from AP to ST in WPA Key Data field using the chiper suite described in first field of Key Information, in my case "AES Cipher.
In WPA2 AES is used in CTR mode for confidentiality, so i tried to decrypt the Key Data using OpenSSL, using KEK
as key and filed Key IV as IV
. I obtain 6c 1b 11 38 1f 8e 01 ee e1 d0 7b [...]
from decryption, but reading the IEEE 802.11 I saw that the first Key Data's octect in EAPOL Key Frame is Type and should be0xdd
, so decryption fails.
What's wrong?