GO KALI FREE
IntermediateNetworking

WiFi Security Basics: Protecting Wireless Networks

An intermediate guide to WiFi security covering wireless protocols, common attacks, defensive techniques, and tools for securing and testing wireless networks.

#WiFi security#wireless#WPA3#network security#aircrack-ng

The Unique Challenges of Wireless Security

Wireless networks introduce security challenges that wired networks do not face. Radio waves propagate through walls and into public spaces, meaning anyone within range can intercept your wireless communications. Unlike wired networks where physical access is required to tap into the network, wireless attackers only need to be within signal range.

Understanding WiFi security protocols, common attack techniques, and defensive measures is essential for both home users and security professionals.

WiFi Security Protocols

Wireless security has evolved through several protocols, each addressing weaknesses in its predecessor.

WEP (Wired Equivalent Privacy)

WEP was the original WiFi security protocol, introduced in 1997. It proved catastrophically flawed. WEP uses the RC4 cipher with a static encryption key and a 24-bit initialization vector (IV), which guarantees IV reuse after enough traffic. Tools like aircrack-ng can crack WEP keys in minutes by capturing enough packets. WEP is considered completely broken and should never be used.

WPA (WiFi Protected Access)

WPA was an interim solution designed to address WEP's most critical flaws without requiring hardware upgrades. It introduced TKIP (Temporal Key Integrity Protocol), which dynamically changed keys to prevent the IV reuse attack that broke WEP. However, TKIP itself was later found to have vulnerabilities, particularly the Beck-Tews attack and the Michael MIC countermeasure exploit.

WPA2

WPA2 replaced WPA as the mandatory WiFi security standard in 2004. It introduced CCMP (Counter Mode Cipher Block Chaining Message Authentication Code Protocol) based on AES encryption, a significant improvement over TKIP. WPA2 supports two authentication modes:

  • **WPA2-Personal (PSK)** — Uses a pre-shared key (password) for home and small office networks
  • **WPA2-Enterprise** — Uses RADIUS authentication servers for centralized user management
  • Despite its strength, WPA2 has vulnerabilities. The KRACK (Key Reinstallation Attack) exploit discovered in 2017 targets the four-way handshake to force nonce reuse, allowing attackers to decrypt traffic.

    {@visual wpa-handshake-capture}

    WPA3

    WPA3, introduced in 2018, addresses WPA2's weaknesses. Key improvements include:

  • **Simultaneous Authentication of Equals (SAE)** — Replaces the four-way handshake with Dragonfly handshake, resistant to offline dictionary attacks
  • **Forward secrecy** — Past traffic cannot be decrypted even if the password is compromised
  • **Protected Management Frames (PMF)** — Prevents deauthentication attacks
  • **192-bit security suite** — For government and enterprise deployments
  • WPA3 is backward compatible with WPA2 devices through transition mode, though this can introduce weaknesses if not configured carefully.

    Common WiFi Attacks

    Evil Twin Attack

    An evil twin is a rogue access point that mimics a legitimate WiFi network. The attacker sets up an access point with the same SSID as a nearby legitimate network. Unsuspecting users connect to the evil twin, allowing the attacker to intercept traffic, steal credentials, or serve malicious content.

    Detecting evil twins requires monitoring for multiple access points with the same SSID but different BSSID (MAC addresses). WPA2-Enterprise with certificate validation can prevent this attack by verifying the access point's identity.

    Deauthentication Attack

    Deauthentication attacks send forged deauth frames to disconnect clients from an access point. Since WiFi management frames are typically unencrypted (even on WPA2 networks), an attacker can broadcast deauth packets with a spoofed source address, disconnecting all clients.

    This attack enables several malicious activities: forcing clients to connect to an evil twin, capturing the WPA handshake for offline cracking, or simply disrupting network connectivity. WPA3's Protected Management Frames help prevent this attack.

    KRACK Attack

    KRACK (Key Reinstallation Attack) exploits a vulnerability in the WPA2 four-way handshake. By manipulating and replaying handshake messages, the attacker forces the client to reinstall an already-in-use encryption key. This causes nonce reuse, enabling decryption of subsequent traffic.

    The vulnerability affects the client side specifically, so patching client devices is critical. WPA3 completely eliminates this vulnerability.

    WPS Attack

    WiFi Protected Setup (WPS) was designed to simplify connecting devices by using an 8-digit PIN instead of the full password. Unfortunately, the WPS PIN verification process reveals whether the first half of the PIN is correct, reducing the effective search space from 10^8 to roughly 10^4 attempts. Tools like Reaver can crack WPS PINs in hours. Disable WPS on your router.

    Securing WiFi Networks

    Router Configuration

    Start by changing the default administrator username and password on your router. Disable remote administration. Use WPA2 or WPA3 encryption — never WEP or open networks. Choose a strong, unique SSID that does not reveal personal information. Disable WPS, UPnP, and unnecessary services.

    Network Segmentation

    Create separate VLANs for different types of devices. Keep IoT devices (smart home gadgets, cameras) on a separate network from your computers and phones. Most consumer routers support guest networks, which effectively segment traffic.

    Monitoring

    Regularly check connected devices on your network. Monitor for unknown devices that could indicate an unauthorized user. Enable router logging if available. Use network monitoring tools like Wireshark or ntopng for advanced analysis.

    WiFi Security Tools

    Aircrack-ng Suite

    Aircrack-ng is the most widely used wireless security assessment toolkit. It includes:

  • **airmon-ng** — Enables monitor mode on wireless interfaces
  • **airodump-ng** — Captures packets and discovers nearby networks and clients
  • **aireplay-ng** — Injects packets for deauth attacks and replay attacks
  • **aircrack-ng** — Cracks WEP keys and WPA/WPA2 PSK passwords from captured handshakes
  • **airdecap-ng** — Decrypts WEP/WPA capture files
  • Kismet

    Kismet is a wireless network detector, sniffer, and intrusion detection system. It can discover hidden networks, detect deauthentication attacks, and track devices across multiple channels. Kismet works with any wireless card that supports monitor mode.

    Wifite

    Wifite automates wireless auditing by running multiple attacks against target networks. It automatically selects the best attack method based on the target's configuration, making it useful for efficiency but also requiring careful ethical consideration.

    Legal and Ethical Considerations

    Only test WiFi security on networks you own or have explicit written permission to test. Intercepting or accessing unauthorized wireless networks is illegal under laws including the CFAA and the Computer Misuse Act. Always practice in your own lab environment or authorized testing platforms.

    WiFi security is an arms race between attackers and defenders. Understanding both attack techniques and defensive measures makes you a more effective security professional. Start by securing your own network, then expand your knowledge through structured practice.

    Frequently Asked Questions

    What is the difference between WPA2 and WPA3?

    WPA3 uses the Dragonfly handshake (SAE) instead of WPA2's four-way handshake, making it resistant to offline dictionary attacks. WPA3 also adds forward secrecy and Protected Management Frames (PMF) to prevent deauthentication attacks.

    Can WEP networks still be hacked?

    Yes, WEP is completely broken. Tools like [aircrack-ng](/tools/aircrack-ng) can crack WEP keys in minutes by capturing enough packets. WEP should never be used — switch to WPA2 or WPA3 immediately.

    What is an evil twin attack?

    An evil twin is a rogue access point that mimics a legitimate WiFi network by using the same SSID. Unsuspecting users connect to it, allowing the attacker to intercept traffic, steal credentials, or serve malicious content.

    What is a deauthentication attack?

    Deauthentication attacks send forged deauth frames to disconnect clients from an access point. Since WiFi management frames are unencrypted (even on WPA2), attackers can broadcast deauth packets to disrupt connectivity or force clients to connect to an evil twin.

    How do I secure my home WiFi network?

    Change the default admin password, use WPA2 or WPA3 encryption, disable WPS and UPnP, use a strong unique SSID, enable network segmentation with guest networks, and regularly check connected devices for unauthorized access.

    What is the KRACK attack?

    KRACK (Key Reinstallation Attack) exploits a vulnerability in the WPA2 four-way handshake by forcing clients to reinstall an encryption key, causing nonce reuse. Patching client devices is critical, and WPA3 completely eliminates this vulnerability.

    Why should I disable WPS?

    WiFi Protected Setup (WPS) uses an 8-digit PIN that is vulnerable to brute-force attacks. The PIN verification process reveals whether the first half is correct, reducing the search space from 10^8 to roughly 10^4 attempts. Tools like Reaver can crack WPS PINs in hours.

    What tools can I use to test WiFi security?

    The [aircrack-ng suite](/tools/aircrack-ng) includes airmon-ng for monitor mode, airodump-ng for packet capture, and aircrack-ng for password cracking. Kismet detects hidden networks and deauth attacks. Wifite automates multiple attack methods.

    Is public WiFi safe to use?

    Public WiFi is inherently risky because anyone on the network can intercept traffic. Always use a [VPN](/learn/vpn-guide) on public WiFi, verify HTTPS connections, and avoid accessing sensitive accounts. Consider using your mobile hotspot instead.

    What is the KRACK attack and how was it fixed?

    KRACK targets the WPA2 four-way handshake to force nonce reuse, allowing attackers to decrypt traffic. The vulnerability affects clients specifically, so patching devices is essential. WPA3's SAE handshake eliminates this vulnerability entirely.