WPA2 Key Reinstallation Attack


Prologue: Ethical Considerations and Code Disclaimer

The information presented in this project is conducted solely for academic purposes, aiming to enhance our understanding of wireless network vulnerabilities. It is crucial to emphasize that the code snippets and implementation details provided in this document are pseudocode representations and deliberately non-functional.

Introduction

During our Fall 2022 semester at Florida State University Panama City, we undertook a comprehensive exploration of wireless network security as part of our Computer Networks (EEL-4781) course. Given that we were simultaneously enrolled in both Computer Networks and Cyber Security (EEL-4347), we saw an opportunity to combine knowledge from both disciplines into a meaningful research project. Our focus landed on one of the most significant wireless security vulnerabilities discovered in recent years: the Key Reinstallation Attacks (KRACK) against WPA2 [1].

Understanding WPA2 Security

Wi-Fi Protected Access 2 (WPA2) has been the cornerstone of wireless network security since its introduction in 2004. The protocol implements robust encryption and authentication mechanisms to ensure secure communication between wireless devices and access points. At its core, WPA2 relies on a sophisticated handshake protocol that establishes secure connections through careful key management and message verification.

The protocol's security hinges on the 4-way handshake process, during which a client and access point negotiate unique encryption keys for their session. Each packet transmitted during a session receives unique encryption parameters, theoretically preventing any replay or decryption attacks. This system worked remarkably well for over a decade, protecting billions of wireless connections worldwide.

The KRACK Vulnerability

The Key Reinstallation Attack (KRACK) exploits a fundamental flaw in the WPA2 protocol design. When a device connects to a WPA2-protected network, it performs the 4-way handshake to establish encryption keys. During this process, the protocol includes a mechanism to handle potential message losses - if a key installation message isn't acknowledged, the access point will resend it. This seeming innocuous feature becomes the cornerstone of the KRACK attack.

By capturing and replaying these key installation messages, an attacker can force devices to re-install already-in-use keys. This re-installation resets critical encryption parameters that should never be re-used. The impact of this vulnerabilitity varies depending on the specific encryption protocol in use, but in all cases, it undermines the fundamental security guarantees that WPA2 was designed to provide.

Our Implementation

We constructed a controlled test environment to explore and demonstrate this vulnerability. Our setup consisted of an intentionally unpatched Netgear router, an Android 6.0 smartphone known to be vulnerable to the attack, and a Linux laptop equipped with a wireless adapter capable of packet injection and monitor mode operation.

The implementation of the attack required careful timing and precise packet manipulation. Here's a simplified representation of our approach:

def execute_krack_attack():
  target_network = identify_vulnerable_network()
  rogue_ap = create_evil_twin(target_network)
  while not attack_successful:
    intercept_handshake()
    replay_key_installation()
    verify_key_installation()

Our attack script first identifies vulnerable networks, establishes a position to intercept communications, and then executes the key re-installation attack through careful message manipulation and replay.

Security Implications and Mitigations

The discovery of KRACK prompted a swift response from device manufacturers and software developers. Patches were released that fundamentally changed how devices handle key installation messages, preventing the possibility of key re-installation. Modern devices running updated software are no longer vulnerable to this attack.

Additionally, the widespread adoption of HTTPS and other security protocols provides an additional layer of protection even on vulnerable networks. These protocols ensure that senitive data remains encrypted even if the underlying wireless security is compromised.

Conclusion

Our exploration of the KRACK vulnerability demonstrates the complexity of wireless security and the importance of continuous security updates. While most modern devices have been patched against this specific attack, it serves as a compelling reminder that even well-established security protocols can harbor subtle vulnerabilities.

The implications of our research extends beyond this specific vulnerability. They highlight the critical importance of maintaining up-to-date network infrastructure and implementing layered security approaches. As wireless technologies continue to evolve, the lessons learned from KRACK remain relevant: security is an ongoing process, not a one-time implementation.

We strongly encourage network administrators and users to maintain rigorous update schedules for all network devices, consider upgrading to newer standards like WPA3 where possible, and implement additional security measures such as VPNs and network segregation. Only through continued vigilance and proactive security measures can we maintain the integrity of our wireless communications.