Skip to content
Tutorials Center
My learning

Topics

Lesson 20 of 31 ยท Wireless and Network Defense

Wireless Security Concepts

Understand how Wi-Fi security works: WEP, WPA2 and WPA3, handshakes, rogue access points, monitor mode and practical steps to defend a wireless network, with a Python rating stand-in.

Wi-Fi turns a network cable into radio waves, and radio waves reach everyone nearby: the neighbor, the person in the street, the visitor in the lobby. That single fact is the root of every wireless security idea. If a wired attacker must plug in, a wireless one only needs to be in range. So Wi-Fi security has two jobs: make sure only the right devices join, and make sure what they send is unreadable to anyone listening.

This lesson explains the protocols (WEP, WPA2, WPA3), what a handshake is, how rogue access points work, what monitor mode means, and how to defend a network you own or are authorized to assess. It follows TCP/IP Essentials for Security and needs the legal basics from Law, Ethics and Authorization: listening to or interfering with networks you do not own can be a crime. Real wireless tools are described but not run here; the Python stand-in rates sample configurations.

Two jobs for Wi-Fi security

Authentication Only approved devices may join.
Encryption Eavesdroppers see only noise.
Management Admin pages and firmware stay safe.

A strong password alone covers just the first job.

1 / 2

How Wi-Fi security evolved

WEP (Wired Equivalent Privacy, 1997) was the first attempt. Its design had fundamental flaws in how it used the RC4 cipher and a tiny initialization vector, so enough captured traffic reveals the key in minutes. Nothing about WEP can be configured to be safe. If a device only supports WEP, replace it.

WPA was a rushed patch for old hardware. It is also obsolete.

WPA2 (2004) uses the AES cipher in a mode called CCMP and is still very widely deployed. It comes in two flavors:

  • WPA2-Personal (PSK): everyone shares one passphrase. Simple, and safe when the passphrase is long and random.
  • WPA2-Enterprise (802.1X): each user signs in with their own credentials checked by a RADIUS server, so removing one person does not mean changing a password for everyone.

WPA3 (2018) improves on WPA2 in ways that matter in practice:

  • Personal mode replaces the pre-shared-key exchange with SAE ("Simultaneous Authentication of Equals"). An attacker who records the join process can no longer test password guesses offline at their leisure; each guess requires talking to the access point.
  • It gives each client forward secrecy: recording traffic today and learning the password next year does not unlock the old recordings.
  • Open networks can use Enhanced Open (OWE), which encrypts traffic even with no password.
  • Enterprise mode has a stricter, higher-grade suite.

A network that offers WPA2 and WPA3 together ("transition mode") lets older devices connect, but it also keeps WPA2's weaknesses available. Turn on WPA3-only if every device allows it.

The four-way handshake

When a device joins a WPA2-Personal network, the access point and the device must prove to each other that they know the passphrase without sending it. They do this in a four-message exchange called the handshake, which also produces fresh session keys for the connection.

sequenceDiagram
    participant C as Client
    participant A as Access point
    A->>C: Message 1: random value from AP
    C->>A: Message 2: random value from client + proof
    A->>C: Message 3: group key, proof from AP
    C->>A: Message 4: confirmation

The passphrase is never sent; both sides derive keys from it plus the two random values.

Why does this matter for defenders? Because the handshake travels over the air, anyone in range can record it. The recording does not contain the passphrase, but it contains enough to test guesses offline: a person with a copy tries one candidate passphrase after another and checks whether it reproduces the proof. That is why a short or common passphrase is the real weakness of WPA2-Personal. The math of guessing is covered in Password Strength, Entropy and Cracking Resistance. A random passphrase of 20 or more characters makes the offline test hopeless, and WPA3's SAE removes the recording shortcut entirely.

Authorized testers do check this on their own networks, to learn whether the passphrase would survive. That work happens only on networks the tester owns or has written permission to assess.

Monitor mode, in concept

A normal Wi-Fi adapter listens only to traffic addressed to it and hides everything else. Monitor mode switches the adapter to hand the software every frame it hears on a channel, including network names, which devices are talking and whether management frames are being sent. A packet analyzer (Packet Capture and Analysis) then displays them.

Defenders use the same view to survey their space: which access points exist, on which channels, with which security, and whether any of them should not be there. The commands on Kali look like this (read-only here; never run them against networks you do not control):

Terminal
# List wireless interfaces
iw dev

# Put an adapter into monitor mode (the interface name varies)
sudo ip link set wlan0 down
sudo iw dev wlan0 set type monitor
sudo ip link set wlan0 up

Not every adapter or driver supports monitor mode, and in a virtual machine you need a USB adapter passed through to the VM (Building a Safe Lab).

Rogue and look-alike access points

A rogue access point is any access point on your network that you did not approve. A well-meaning employee plugging a cheap router into a wall socket creates one, and so does an intruder. It bypasses your firewall and your encryption policy.

An evil twin is a more deliberate trick: an access point advertising the same name as a legitimate network, hoping devices connect to it. Whoever runs the twin can see the unencrypted traffic that passes through. A device cannot tell two same-named open networks apart, which is why:

  • Open networks (cafes, airports, hotels) are the place where twins are most effective;
  • Enterprise networks check a certificate from the authentication server, so a twin without the right certificate gets rejected, provided devices are configured to verify it;
  • Using HTTPS and a VPN protects your data even if the network itself is hostile.

Defenders look for rogue and twin devices with periodic site surveys, controller features that flag unknown access points, and by comparing the list of seen names and hardware addresses against an approved inventory.

A related annoyance is the deauthentication attack: management frames on older networks were unauthenticated, so anyone could send a forged "disconnect" message. The 802.11w standard (Protected Management Frames) is required by WPA3 and fixes this; enable it on WPA2 networks that support it.

Defending a Wi-Fi network

A practical checklist for a home or small office:

  1. Use WPA3 if every device supports it; otherwise WPA2 with AES (CCMP) only. Never WEP, never WPA/TKIP.
  2. Pick a long random passphrase (20 or more characters), or use enterprise authentication for organizations.
  3. Disable WPS. The push-button and PIN setup features have known weaknesses and give little benefit.
  4. Change the router's admin password, disable remote administration, and turn on automatic firmware updates (or check regularly).
  5. Put visitors and smart-home gadgets on a separate guest network so they cannot reach your computers.
  6. Enable Protected Management Frames where available.
  7. Hiding the network name (SSID) is not security: it still appears in frames sent by your devices.
  8. Review the list of connected devices occasionally.

For businesses add: 802.1X authentication, certificate validation on clients, wireless intrusion detection, and regular surveys.

A stand-in: rate sample configurations

A real audit reads settings from a router or a survey tool. This stand-in rates invented configurations with simple rules, to show how a checklist becomes code. It does not talk to any network.

Python Rate sample Wi-Fi configurations

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The scoring numbers are arbitrary teaching values, not an industry standard. What carries over is the pattern: encode each rule once, and run it against every network in your inventory.

A stand-in: spot unapproved access points

A site survey produces a list of what is on the air. The defender compares it to an approved inventory, matching the network name and the hardware address (BSSID).

Python Compare a survey against an approved list

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A hardware address can be copied, so a match is not proof either. Enterprise tools combine this check with signal strength, channel and the security settings advertised.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Which Wi-Fi protection can be broken by collecting enough traffic, regardless of how the owner configures it?

    WEP's design is flawed, so the key can be recovered from captured traffic. The only fix is to stop using it.
  2. 2. What is the main weakness of WPA2-Personal that WPA3's SAE addresses?

    WPA2-Personal's handshake lets someone who recorded it try candidate passphrases offline. SAE requires interaction with the access point for each guess and adds forward secrecy.
  3. 3. Which statement about hiding the SSID is correct?

    A hidden name is easy to discover from normal traffic. Encryption, a strong passphrase and updated firmware are what protect a network.
  4. 4. What is an evil twin?

    An evil twin imitates a real network's name so devices join it. Certificate checks on enterprise networks, HTTPS and VPNs reduce the damage.
  5. 5. Why is monitor mode used by defenders?

    Monitor mode passes every frame heard on a channel to software, which is how site surveys and rogue-device detection see the whole picture.

Summary

  • Wi-Fi security must control who joins and keep traffic unreadable to listeners nearby.
  • WEP is broken; WPA2 with AES and a long passphrase is solid; WPA3 adds SAE, forward secrecy and Protected Management Frames.
  • The handshake never sends the passphrase, but a recording allows offline guessing, so passphrase strength is the key factor for WPA2-Personal.
  • Monitor mode shows every frame on a channel and supports surveys; use it only on networks you own or may test.
  • Rogue and evil-twin access points are found by comparing surveys with an approved inventory; HTTPS, a VPN and certificate checks limit the damage.
  • Turn off WPS, update firmware, separate guests, and do not rely on hiding the SSID.
  • The Python examples are stand-ins with invented data; the radio tools described are real but not run on this site.

Next: Firewalls, IDS and Log Monitoring.