A Key reinstallation attack is the technique where the attacker tricks the STA into reinstalling a previously used key to gain access to the network. KRACK exploits both WPA and WPA2 protocols 4- way handshake. The 4-way handshake starts by confirming the AP and the STA have the same pre-shared key (PSK) for the network. The AP and STA can do this without ever disclosing the PSK by sending an encryption that can only be decrypted if the recipient has the PSK. The way they do this is the AP send a number used once (Nonce) to the STA. A nonce is used in cryptographic communications to prevent replay attacks. The AP also send a key replay counter, the purpose of this is so that the AP can identify messages its receives from STAs match the nonce it has sent out. The STA will receive message 1 from the AP and using the PSK can create its own nonce value this will be sent along with the key replay counter from message 1 so that the AP can identify the authentication key and a message integrity code (MIC) this is a personal code that checks for tampering of the message. While the STA is doing all that it will also create a Pairwise Transient Key (PTK). PTK is a key that is generated from the Authenticator Nonce (ANonce) from the AP, Supplicant Nonce (SNonce) from the STA, PMK, AP media access control (MAC) address, STA MAC address. The PTK is then used to encrypt all unicast transmissions between the STA and the AP.Once the AP has received message 2 it verifies the ANonce, MIC and Replay counter if this is authenticated then sends the STA a MIC and a Group Temporal Key (GTK) this is a key that can be used if the AP broadcasts to the whole network or multicasts to more than on STAs on the network.