Wi-Fi Protected Access (WPA) 101

WPA, WPA1, WPA2

By suktech24, Sun 23 Nov 2024, Estimated reading time : 5-7 mins

Have you ever wondered how devices are authenticated when connecting to Wi-Fi? What authentication methods and wireless protocols ensure a secure connection?

When you connect a device to a Wi-Fi network, its authentication is critical to maintaining a secure connection. Wi-Fi Protected Access (WPA) protocols are designed to verify devices and encrypt the data exchanged between them and the router. Over the years, these protocols—WPA, WPA2, and WPA3—have evolved, offering enhanced security and performance. This blog post will explore the basic of how devices are authenticated, the differences between these protocols, and key vulnerabilities.

The following topics will be covered:

  1. WPA
  2. WPA2
  3. WPA3
  4. Differences between WPA2 and WPA3
  5. CVE-2023-52161
    • CVE
    • MITRE Tactics and Techniques
  6. Find your wi-fi security protocol and encryption type
  7. Summary

1. WPA

WPA, introduced in 2003 as a successor to the insecure WEP (Wired Equivalent Privacy), aimed to improve Wi-Fi security. It employed Temporal Key Integrity Protocol (TKIP) for encryption, providing better protection against unauthorized access. However, WPA was quickly succeeded by WPA2 due to its vulnerabilities, including susceptibility to brute-force attacks.


2. WPA2

WPA2, launched in 2004, became the standard for secure Wi-Fi. It replaced TKIP with Advanced Encryption Standard (AES), significantly enhancing encryption strength. WPA2 introduced mandatory support for the Counter Mode Cipher Block Chaining Message Authentication Code Protocol (CCMP), further strengthening data integrity and confidentiality.

However, WPA2 is not without flaws, as it is vulnerable to KRACK (Key Reinstallation Attacks), which can allow attackers to decrypt and manipulate data transmitted over the network. To address these vulnerabilities, the Wi-Fi Alliance introduced WPA3 in 2018. However, WPA2 remains widely used and is still considered secure when implemented with strong passwords and regular security updates.


3. WPA3

WPA3, introduced in 2018, addressed the shortcomings of WPA2 with improved encryption and new features:

  • Simultaneous Authentication of Equals (SAE), also known as Dragonfly, for secure key exchanges. It provides stronger protection against offline dictionary attacks and enhances the security of the password-based authentication process.
  • It introduces forward secrecy, ensuring that even if an attacker manages to obtain a user’s password, they cannot decrypt previously captured data.
  • Despite these advancements, WPA3 is still subject to some attacks, such as the Dragonblood (dragonfly handshake) vulnerability.

4. Differences Between WPA2 and WPA3

Below table illustrates the overview of WPA2 and WPA3.

FeatureWPA2WPA3
EncryptionAES with 128-bit keySupports 192-bit encryption
Key Establishment
4-way handshake
Dragonfly handshake
AuthenticationPre-Shared Key (PSK)Simultaneous Authentication of Equals (SAE)
Password SecurityVulnerable to offline dictionary attackResistant to offline dictionary attack
Forward SecrecyNot supportedProvided, preventing decryption of previously captured data
Side-channel protectionNot supportedIncluded, protecting
Protocols & Security– Advanced Encryption Standard (AES)
– Counter Mode Cipher Block Chaining Message – Authentication Code Protocol (CCMP)
– 802.1X Authentication
– Simultaneous Authentication of Equals (SAE)
– 192-bit Encryption Standard
– Forward Secrecy

5. CVE-2023-52161

5.1 CVE

CVE-2023-52161 is a high-severity vulnerability affecting the Access Point functionality in iNet wireless daemon (IWD) before version 2.14.

The vulnerability in IWD stems from its implementation of the 4-way handshake, which is used when connecting to any protected WiFi network for the first time. It is exploitable when IWD is operating in Access Point (AP) mode.

Vulnerable versions of IWD fail to verify in which order message 2 or 4 of the handshake are received, i.e. it fails to store or check what the expected next message should be in the handshake. Instead, IWD simply accepts any message.

This vulnerability allows attackers to gain unauthorized access to protected Wi-Fi networks by exploiting a weakness in the EAPOL handshake process. Systems running IWD before version 2.14, particularly Linux systems, are at risk.

For more details, visit the Red Hat Bugzilla report.

5.2 MITRE Tactics and Techniques

  1. Initial Access (TA0001)
    • Exploit public-facing application (T1190), https://attack.mitre.org/techniques/T1190/ – The attacker exploits the vulnerability in IWD’s 4-way handshake while operating in AP mode to gain access to the network.
  2. Persistence (TA0003)
    • The attacker can maintain persistence.
  3. Privilege escalation (TA0004)
    • Bypassing normal authentication process, the attacker escalates privileges
  4. Defense Evation (TA0005)
  5. Credential Access (TA0006)

6. Find your wi-fi security protocol and encryption type

To find out your wifi security protocol and encryption type, in windows, you can :

  1. Run this command as admin : netsh wlan show interfaces
  2. Run below python script

NOTE: This script is only for learning purpose. shell=True can open door to shell injection attacks.

import subprocess

def get_wifi_security():
    # Command to get wifi information
    command = "netsh wlan show interfaces"
    
    try:
        # Run the command and capture the output
        result = subprocess.run(command, capture_output=True, text=True, shell=True)
        
        if result.returncode != 0:
            print("Error running the command.")
            print(result.stderr)
            return None, None
        
        # Print full command output for debugging
        print("Command output:\n", result.stdout)
        
        output = result.stdout
        security_type = None 
        protocol = None 
            
        # Parse the output for Authentication and cipher
        for line in output.splitlines():
            if "Authentication" in line:
                protocol = line.split(":")[1].strip()
            elif "Cipher" in line:
                security_type = line.split(":")[1].strip()
        
        if not protocol or not security_type:
            print("Security details not found in the output.")
            return None, None
        
        return protocol, security_type
    except Exception as e:
        print(f"An error has occured: {e}")
        return None, None

def display_wifi_security():
    protocol, security_type = get_wifi_security()

    if protocol and security_type:
        print(f"Wi-Fi Security Protocol\t\t: {protocol}")
        print(f"Wi-Fi Encryption Type\t\t : {security_type}")
    else:
        print("Could not retrieve Wi-Fi security information")
          
def main():
    display_wifi_security()

if __name__ == "__main__":
    main()

Summary

Wi-Fi Protected Access (WPA) protocols are designed to verify devices and encrypt the data exchanged between them and the router. Over the years, these protocols—WPA, WPA2, and WPA3—have evolved, offering enhanced security and performance. The evolution of WPA protocols—from WPA to WPA3—demonstrates the industry’s ongoing efforts to combat threats to Wi-Fi security.

🍃 1. WPA

  • Introduced in 2003 to replace insecure WEP, used Temporal Key Integrity Protocol (TKIP), but was vulnerable to brute-force attacks, replaced by WPA2.

🍃 2. WPA2

  • Introduced in 2004 with stronger encryption using AES.
  • Mandatory support for Counter Mode Cipher Block Chaining Message Authentication Code Protocol (CCMP) for data integrity.
  • Vulnerable to KRACK attacks but still widely used.

🍃 3. WPA3

  • Launched in 2018 to address WPA2 shortcomings. Uses Simultaneous Authentication of Equals (SAE) for secure key exchange and has features forward secrecy to protect past data, even if passwords are compromised. Vulnerable to Dragonblood attacks.

🍃 4. Differences Between WPA2 and WPA3

  • WPA3 offers 192-bit encryption, SAE authentication, and forward secrecy, unlike WPA2’s 128-bit AES and Pre-Shared Key (PSK)-based authentication.

🍃 5. CVE-2023-52161

  • A flaw in IWD (pre-2.14) allows unauthorized access by exploiting the 4-way handshake, impacting Linux systems in AP mode.
  • Attackers gain access using techniques like Adversary-in-the-Middle, network sniffing, and privilege escalation.

🍃 6. Find your wi-fi security protocol and encryption type

  • netsh wlan show interfaces or run python script

References

  1. https://io.hfcl.com/blog/wpa2-vs-wpa3/
  2. https://www.securew2.com/blog/wpa3-vs-wpa2
  3. https://www.paloaltonetworks.com/blog/2013/09/risks-to-wireless-networks-attacks-on-wpawpa2/
  4. https://www.top10vpn.com/research/wifi-vulnerabilities/
  5. https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2023-52161

Leave a comment