4-Way Hand-Shake
4-Way Hand-Shake
The Pairwise Master Key (PMK) is derived from the Passphrase/Password will be present in both Client
and AP side.
1st Message: AP sends ANONCE (AP generated random number) along with the MAC address details.
Client will generate SNONCE (station generated random number). Now client has PMK, SNONCE,MAC
address of the AP and its own MAC address. All these are required to create the PTK for the client
(Pairwise Transient Key). (Fig 2)
PTK (Pairwise Transient Key) is used to encrypt all unicast traffic between a client and the AP. It is
unique between client and AP. Here I addressed some of the important keys that PTK has. They are,
1. KEK (Key Encryption Key) which is used to encrypt the keys. GTK will be encrypted in
Message3 using KEK.
2. KCK (Key Confirmation Key) which is used during the creation of the MIC, Hash will be
generated using KCK.
3. TK (Temporal Key) which is used for encryption and decryption of unicast packets.
PTK key generation:
The keys generated should never be sent over the air. So, the concept of MIC verification has come
up.
WPA2 PSK- uses HMAC-SHA1 (Hash-Based Message Authentication Codes) to generate the MIC and it
uses the KCK (Key Confirmation Key) to generate hash.
Now Access point can then use the MIC to verify that the message has not been tampered during
transmission. Now AP got all the parameters required for computing PTK. (Fig 3)
Once the AP receives that packet (here with wrong credentials) It will check by verifying MIC
(Message Integrity Check).
AP compares the MIC sent by the client with the MIC that AP has generated with details received in
the 2nd message. If the MIC is not same, it is because PMK from client side is different from the PMK
on AP side (i.e., Password given by the client is wrong)
Thus, as a result only 2-way handshake happens due to failure in MIC validation.
Here is the process when we enter the right password.
(Fig: 4)
1st Message: AP sends client ANONCE (random number) along with the MAC details. Now client has
PMK, SNONCE, and its own MAC address that is needed to create the PTK because client already has
ANONCE (Fig: 5)
2nd message: The client sends to the AP SNONCE and the encrypted part of PTK (i.e.) MIC(Message
Integrity Check)
Once the AP validates the MIC from client and itself, if it matches, then the 3 rd message of handshake
will start. (Fig: 6)
3rd Message: In 3rd message, AP derives the GTK.
GTK (Group Temporal Key) is helpful to encrypt the broadcast and multicast traffic between the
clients and the AP. Now AP will send the GTK to the client and the GTK will be encrypted using KEK
(Key Encryption Key).
KEK (Key Encryption Key) which is used to encrypt the keys. GTK will be encrypted in 3rd Message using
KEK to deliver to the client.
So, after the 4-way handshake, the data frames (MSDU) will be encrypted using PTK or GTK keys
depending upon unicast or multicast/broadcast frame.
HAPPY LEARNING😊