Introduction

For years, Wi-Fi Protected Setup (WPS) was marketed as a convenience feature. Instead of typing a long, complex password, users could press a physical button on the router or enter an 8-digit PIN to connect devices instantly.

However, security researchers quickly discovered that this “convenience” introduced a catastrophic vulnerability. This article explains the mathematical flaw in WPS and why automated tools like Wifite can retrieve a Wi-Fi password in a matter of hours (or minutes).


1. Why Is WPS Insecure?

The primary flaw lies in the WPS PIN authentication method. The PIN is 8 digits long. When a device tries to authenticate, the router validates the PIN in two separate halves.

The Math of the Break

  • Total possible PINs: (10^8 = 100,000,000)
  • How the router checks:
    • First, it checks the first 4 digits.
    • Then, it checks the last 4 digits (which include a checksum).

Because the router validates the first half before the second half, an attacker does not need to guess 100 million combinations. They need to guess:

  1. First half: (10^4 = 10,000) possibilities.
  2. Second half: (10^3 = 1,000) possibilities (the 8th digit is a checksum, so only 1,000 are valid).

Total maximum attempts: (10,000 + 1,000 = 11,000).

This is roughly 9,090 times faster than brute-forcing the full 8-digit PIN.

The Mermaid Diagram: WPS PIN Validation Flow

graph TD
    A[Client sends 8-digit WPS PIN] --> B{Router receives PIN}
    B --> C["Split PIN: Block A = digits 1-4, Block B = digits 5-7 + checksum"]
    C --> D{Validate Block A}
    D -- Incorrect --> E["Send EAP-NACK: Invalid PIN"]
    D -- Correct --> F{Validate Block B}
    F -- Incorrect --> G["Send EAP-NACK: Invalid PIN"]
    F -- Correct --> H[Grant Access and Send WiFi Password]
    
    style D fill:#b02a2a,stroke:#7a1c1c,stroke-width:2px,color:#ffffff
    style F fill:#b02a2a,stroke:#7a1c1c,stroke-width:2px,color:#ffffff
    style E fill:#8f2323,stroke:#7a1c1c,color:#ffffff
    style G fill:#8f2323,stroke:#7a1c1c,color:#ffffff

Key Insight: The router gives feedback after each half. An attacker can brute-force the first 4 digits (10,000 attempts) without touching the second half. Once the first half is cracked, they brute-force the last 3 digits (1,000 attempts).

Additional Flaws

  • No Lockout (Older Routers): Many older routers lacked a rate limit or lockout policy. An attacker could send thousands of PIN attempts per second without the router banning their MAC address.
  • WPS Hard-Coded: On many ISP-provided routers, WPS cannot be fully disabled. Disabling it in the GUI often leaves the service running in the background.

2. Why Wifite Successfully Retrieves the Password

Wifite is a Python-based automated wireless auditing tool. It doesn’t invent new attacks; it automates existing ones with surgical precision.

How Wifite Exploits WPS

  1. Scanning: Wifite listens for beacons from routers broadcasting “WPS Capable.”
  2. Targeting: It selects targets with WPS enabled.
  3. The Attack (Pixie Dust / Brute-Force):
    • Pixie Dust Attack: A vulnerability in random number generation on many routers. Instead of 11,000 attempts, this recovers the PIN in seconds.
    • Brute-Force Attack: If Pixie Dust fails, Wifite uses the 11,000-attempt sequence shown above, automatically avoiding rate limits by slowing down or randomizing MAC addresses.

Why It Is “Immediate”

“Immediate” (often under 2 minutes) happens for two reasons:

  1. The target router has the Pixie Dust vulnerability (real-time PIN calculation).
  2. The router has no delay between PIN attempts.

The Mermaid Diagram: Wifite WPS Attack Sequence

sequenceDiagram
    participant W as Wifite Attacker
    participant R as Target Router WPS Enabled
    
    Note over W: Step 1 - Scan for WPS beacons
    W->>R: Probe Request - WPS Info
    R-->>W: Probe Response - WPS Capable = True
    
    Note over W: Step 2 - Launch Pixie Dust Attack
    W->>R: M1 Enrollee Nonce E-S1
    R-->>W: M2 Registrar Nonce R-S1 + Public Key
    W->>W: Calculate PIN using static seed vulnerability
    
    alt Pixie Dust Succeeds
        W->>R: M3 Validated PIN
        R-->>W: M8 Wi-Fi Credentials SSID + Password
        Note over W: Password captured - under 60 sec
    else Pixie Dust Fails - Fallback
        loop 11000 attempts max
            W->>R: PIN Guess - First 4 digits
            R-->>W: ACK Correct Half
            W->>R: PIN Guess - Last 3 digits + Checksum
            R-->>W: M8 Wi-Fi Credentials
        end
    end

3. Real-World Comparison

Feature WPS (Secure Design?) Wifite Exploit
Authentication Time 2 seconds (legit user) 0.05 seconds (per guess)
Attempts Needed 1 11,000 (or 0 with Pixie)
Rate Limiting Rare on old routers Bypassed via MAC randomization
Success Rate N/A >90% on routers made before 2018

4. How to Protect Yourself

If you want to avoid being a victim of this attack:

  1. Disable WPS: Log into your router admin panel (usually 192.168.1.1 or 192.168.0.1). Go to Wireless > WPS > Disable.
  2. Update Firmware: Modern routers now implement:
    • Lockout after 3 failed PIN attempts.
    • Exponential backoff delays.
  3. Buy Modern Routers: Any router released after 2020 with the “WPA3” label likely has proper WPS security or has removed PIN-based WPS entirely.
  4. Check Your Router: Use a tool like wash (part of the Reaver suite) to see if your own router broadcasts “WPS Locked = No”.

Conclusion

WPS was designed with usability over security. The decision to split the 8-digit PIN into two separately validated halves reduced the attack complexity from 100 million to 11,000. Tools like Wifite automate this flaw, often retrieving the Wi-Fi password faster than a legitimate user can type the complex passphrase.

The golden rule of Wi-Fi security: If you see a button labeled “WPS,” turn it off immediately.