Detect Evil Twin in Elastic Security
Adversaries may host fraudulent Wi-Fi access points using the same SSID as a legitimate network to intercept traffic, steal credentials, or deliver malware. Evil Twin attacks exploit the 802.11 protocol's lack of mutual AP authentication — clients connect to whichever access point advertises the correct SSID with the strongest signal, without verifying the AP's identity. Attackers use tools such as hostapd, airbase-ng, create_ap, or Wi-Fi Pineapple devices to clone corporate or public SSIDs. Upon connection, victims are often directed to a fake captive portal for credential harvesting or subjected to man-in-the-middle attacks against unencrypted or SSL-stripped traffic. Attackers may also listen for 802.11 probe requests in which client devices broadcast previously connected network names (Preferred Network Lists), responding with matching SSIDs to automatically attract victim connections. APT28 (Fancy Bear / GRU) operationally deployed Wi-Fi Pineapple devices for Evil Twin attacks during intelligence collection operations against Organization for the Prohibition of Chemical Weapons (OPCW) and other targets, as documented in the October 2018 GRU indictment.
MITRE ATT&CK
- Tactic
- Credential Access Collection
- Technique
- T1557 Adversary-in-the-Middle
- Sub-technique
- T1557.004 Evil Twin
- Canonical reference
- https://attack.mitre.org/techniques/T1557/004/
Elastic Detection Query
sequence by host.name, winlog.event_data.SSID with maxspan=1h
[any where event.provider == "Microsoft-Windows-WLAN-AutoConfig" and
event.code == "8001" and
winlog.event_data.BSSID != null and
winlog.event_data.BSSID != "00:00:00:00:00:00" and
(winlog.event_data.SSID like "*corp*" or
winlog.event_data.SSID like "*office*" or
winlog.event_data.SSID like "*employee*" or
winlog.event_data.SSID like "*secure*" or
winlog.event_data.SSID like "*work*" or
winlog.event_data.SSID like "*hq*" or
winlog.event_data.SSID like "*internal*" or
winlog.event_data.SSID like "*guest*" or
winlog.event_data.SSID like "*wireless*")] as first_connect
[any where event.provider == "Microsoft-Windows-WLAN-AutoConfig" and
event.code == "8001" and
winlog.event_data.BSSID != null and
winlog.event_data.BSSID != "00:00:00:00:00:00" and
winlog.event_data.BSSID != first_connect.winlog.event_data.BSSID] Detects Evil Twin AP attacks using Elastic EQL sequence logic: flags any Windows endpoint that successfully connects (WLAN AutoConfig Event ID 8001) to the same corporate-pattern SSID via two different BSSIDs within a one-hour window. A legitimate roaming event will be followed by a reconnect to a different known AP BSSID; an Evil Twin introduces an unauthorized BSSID for the same SSID that was not previously observed. Data flows through Winlogbeat or the Elastic Agent Windows integration ingesting the Microsoft-Windows-WLAN-AutoConfig/Operational channel. For full fleet-wide BSSID cardinality aggregation across all hosts simultaneously, supplement this per-host sequence rule with an ES|QL threshold detection rule that groups by SSID and counts distinct BSSIDs.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate enterprise wireless infrastructure with multiple APs sharing the same SSID for seamless roaming — each physical AP has a unique BSSID, so a roaming laptop connecting to a closer AP after moving between floors or buildings fires this sequence rule; whitelist known authorized BSSIDs using an Elastic value list and add a NOT condition
- Wireless controller-managed networks using virtual BSSIDs or band-steering that present different BSSIDs per radio band (2.4 GHz vs 5 GHz vs 6 GHz) under the same SSID, causing sequential BSSID changes when a client is steered between bands on the same physical AP
- Access point firmware upgrades or hardware replacements that change the BSSID of an existing AP while retaining the same SSID, producing a one-time BSSID change event that matches the sequence pattern
Other platforms for T1557.004
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Evil Twin AP with hostapd and dnsmasq on Linux
Expected signal: On victim Windows devices connecting to the rogue AP: WLAN AutoConfig Event ID 8001 in Microsoft-Windows-WLAN-AutoConfig/Operational showing successful connection to 'TargetCorporateSSID' with the attacker NIC's MAC address as BSSID. DHCP lease assignment from 192.168.50.x range (distinct from corporate DHCP). MDE DeviceNetworkInfo records new BSSID and gateway 192.168.50.1 for the SSID. DNS queries from victim directed to 192.168.50.1.
- Test 2Karma / Evil Twin Probe Response Attack with airbase-ng
Expected signal: Victim devices send visible 802.11 probe requests (capture with: tcpdump -i wlan0mon -e 'wlan type mgt subtype probe-req' 2>/dev/null). airbase-ng probe responses visible in tcpdump (subtype probe-resp). Victim device connection generates WLAN AutoConfig Event 8001 with airbase-ng NIC MAC as BSSID. DeviceNetworkInfo in MDE captures at0 MAC as BSSID with SSID 'TargetCorporateSSID'. DHCP logs show 192.168.55.x lease assignment.
- Test 3Wi-Fi Pineapple PineAP SSID Broadcast Configuration
Expected signal: Victim devices: WLAN AutoConfig Event 8001 with Pineapple's BSSID (Hak5 LLC OUI: 02:13:37 or similar; or randomized MAC depending on firmware version). Default gateway assignment from Pineapple's DHCP (typically 172.16.42.x or configured range). DeviceNetworkInfo captures Pineapple MAC as BSSID. Captive portal HTTP POST requests to 172.16.42.1 visible in web proxy logs. EvilPortal logs on Pineapple at /pineapple/modules/EvilPortal/logs/ contain captured credentials.
- Test 4Windows Mobile Hotspot Rogue AP (No Special Hardware Required)
Expected signal: On the attacker device: Microsoft-Windows-WLAN-AutoConfig/Operational events related to hosted network state changes; System Event Log entries for the 'Microsoft Hosted Network Virtual Adapter' appearing. On victim devices that connect: WLAN AutoConfig Event 8001 with attacker device's virtual adapter MAC (Microsoft Virtual WiFi Miniport Adapter OUI) as BSSID. Default gateway 192.168.137.1 (Windows Mobile Hotspot default) appears in DeviceNetworkInfo — distinct from corporate gateway. DeviceNetworkInfo records new BSSID for the corporate-named SSID.
References (9)
- https://attack.mitre.org/techniques/T1557/004/
- https://usa.kaspersky.com/resource-center/preemptive-safety/evil-twin-attacks
- https://kavigihan.medium.com/wireless-security-evil-twin-attack-d3842f4aef59
- https://posts.specterops.io/modern-wireless-attacks-pt-i-basic-rogue-ap-theory-evil-twin-and-karma-attacks-35a8571550ee
- https://www.bleepingcomputer.com/news/security/australian-charged-for-evil-twin-wifi-attack-on-plane/
- https://www.justice.gov/opa/press-release/file/1098481/download
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicenetworkinfo-table
- https://learn.microsoft.com/en-us/windows/win32/nativewifi/wlan-profileschema-elements
- https://github.com/hak5/wifipineapple-modules
Unlock Pro Content
Get the full detection package for T1557.004 including response playbook, investigation guide, and atomic red team tests.