An idea from Sandman: Include "Evil Twin" attack in Wifite. This page tracks the requirements for such a feature. Evil Twin ========= [Fluxion](https://github.com/FluxionNetwork/fluxion) is a popular example of this attack. The attack requires multiple wireless cards: 1. Hosts the twin. 2. Deauthenticates clients. As clients connect to the Evil Twin, they are redirected to a fake router login page. Clients enter the password to the target AP. The Evil Twin then: 1. Captures the Wifi password, 2. Verifies Wifi password against the target AP, 3. If valid, all clients are deauthed from Evil Twin so they re-join the target AP. 4. Otherwise, tell the user the password is invalid and to "try again". GOTO step #1. Below are all of the requirements/components that Wifite would need for this feature. DHCP ==== We need to auto-assign IP addresses to clients as they connect (via DHCP?). DNS Redirects ============= All DNS requests need to redirect to the webserver: 1. So we clients are encouraged to login. 2. So we can intercept health-checks by Apple/Google Rogue AP, Server IP Address, etc ================================ Probably a few ways to do this in Linux; should use the most reliable & supported method. Mainly we need to: 1. Spin up the Webserver on some port (8000) 2. Start the Rogue AP 3. Assign localhost on port 8000 to some subnet IP (192.168.1.254) 4. Start DNS-redirecting all hostnames to 192.168.1.254. 5. Start DHCP to auto-assign IPs to incoming clients. 6. Start deauthing clients of the real AP. I think steps 3-5 can be applied to a specific wireless card (interface). * TODO: More details on how to start the fake AP, assign IPs, DHCP, DNS, etc. * Fluxion using `hostapd`: [code](https://github.com/FluxionNetwork/fluxion/blob/16965ec192eb87ae40c211d18bf11bb37951b155/lib/ap/hostapd.sh#L59-L64) * Kali "Evil Wireless AP" (uses `hostapd`): [article](https://www.offensive-security.com/kali-linux/kali-linux-evil-wireless-access-point/) * Fluxion using `airbase-ng`: [code](https://github.com/FluxionNetwork/fluxion/blob/16965ec192eb87ae40c211d18bf11bb37951b155/lib/ap/airbase-ng.sh#L76-L77) * TODO: Should the Evil Twin spoof the real AP's hardware MAC address? * Yes, looks like that's what Fluxion does ([code](https://github.com/FluxionNetwork/fluxion/blob/16965ec192eb87ae40c211d18bf11bb37951b155/lib/ap/hostapd.sh#L66-L74)). ROGUE AP ======== Gleaned this info from: * ["Setting up wireless access point in Kali"](https://www.psattack.com/articles/20160410/setting-up-a-wireless-access-point-in-kali/) by PSAttack * ["Kali Linux Evil Wireless Access Point"](https://www.offensive-security.com/kali-linux/kali-linux-evil-wireless-access-point/) by OffensiveSecurity * ["SniffAir" hostapd script](https://github.com/Tylous/SniffAir/blob/master/module/hostapd.py) HOSTAPD ------- * Starts access point. * Not included in Kali by-default. * Installable via `apt-get install hostapd`. * [Docs](https://wireless.wiki.kernel.org/en/users/documentation/hostapd) Config file format (e.g. `~/hostapd.conf`): ``` driver=nl80211 # 'nl80211' appears in all hostapd tutorials I've found. ssid=$EVIL_SSID # SSID/name of Evil Twin (should match target's) hw_mode=$BAND # Wifi Band, e.g. "g" or "g+n" channel=$CHANNEL # Numeric, e.g. "6' ``` Run: ``` hostapd ~/hostapd.conf -i wlan0 ``` DNSMASQ ------- * Included in Kali. * Installable via `apt-get install dnsmasq` * Handles DNS and DHCP. * [Install & Overview](http://www.thekelleys.org.uk/dnsmasq/doc.html), [Manpage](http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html) Config file format (e.g. `~/dnsmasq.conf`): ``` interface=wlan0 dhcp-range=10.0.0.10,10.0.0.250,12h dhcp-option=3,10.0.0.1 dhcp-option=6,10.0.0.1 #no-resolv server=8.8.8.8 log-queries log-dhcp # Redirect all requests (# is wildcard) to IP of evil web server: # TODO: We should rely on iptables, right? Otherwise this redirects traffic from all ports... #address=/#/192.168.1.254 ``` "DNS Entries" file format (`~/dns_entries`): ``` [DNS Name] [IP Address] # TODO: Are wildcards are supported? * 192.168.1.254 # IP of web server ``` Run: ``` dnsmasq -C ~/dnsmasq.conf -H ~/dns_entries ``` IPTABLES -------- From [this thread on raspberrypi.org](https://www.raspberrypi.org/forums/viewtopic.php?p=288263&sid=b6dd830c0c241a15ac0fe6930a4726c9#p288263) > *Use iptables to redirect all traffic directed at port 80 to the http server on the Pi* > `sudo iptables -t nat -A PREROUTING -d 0/0 -p tcp –dport 80 -j DNAT –to 192.168.1.254:80` And from Andreas Wiese on [UnixExchange](https://unix.stackexchange.com/a/125300) > *You could get this with a small set of iptables rules redirecting all traffic to port 80 and 443 your AP's address:* > `# iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination localhost:80` > `# iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination localhost:80` TODO: * What about HTTPS traffic (port 443)? * We want to avoid browser warnings (scary in Chrome & Firefox). * Don't think we can send a 302 redirect to port 80 without triggering the invalid certificate issue. * sslstrip may get around this... DEAUTHING ========= While hosting the Evil Twin + Web Server, we need to deauthenticate clients from the target AP so they join the Evil Twin. Listening --------- We need to listen for more clients and automatically start deauthing new clients as they appear. This might be supported by existing tools... MDK --- Deauthing & DoS is easy to do using [MDK](https://tools.kali.org/wireless-attacks/mdk3) or `aireplay-ng`. I think MDK is a better tool for this job, but Wifite already requires the `aircrack` suite, so we should support both. TODO: Require MDK if it is miles-ahead of `aireplay-ng` TODO: Figure out MDK commands for persistent deauths; if we can provide a list of client MAC addresses & BSSIDs. Website ======= Router Login Pages ------------------ These are different for every vendor. Fluxion has a repo with fake login pages for a lot of popular router vendors ([FluxionNetwork/sites](https://github.com/FluxionNetwork/sites)). That repo includes sites in various languages. We need just the base router page HTML (Title/logo) and CSS (colors/font) for popular vendors. We also need a "generic" login page in case we don't have the page for a vendor. 1. Web server to host HTML, images, fonts, and CSS that the vendor uses. 3. Javascript to send the password to the webserver Language Support ---------------- Note: Users should choose the language to host; they know better than any script detection. Each router page will have a warning message telling the client they need to enter the Wifi password: * "Password is required after a router firmware update" The Login page content (HTML/images/css) could be reduced to just the logo and warning message. No navbars/sidebars/links to anything else. Then only the warning message needs to be templatized by-language (we only need one sentence per language). That would avoid the need for separate "sites" for each Vendor *and* language. But we probably need other labels to be translated as well: * Title of page ("Router Login Page") * "Password:" * "Re-enter Password:" * "Reconnect" or "Login" ...So 5 sentences per language. Not bad. The web server could send a Javascript file containing the language variable values: ```javascript document.title = 'Router Login'; document.querySelector('#warn').textContent('You need to login after router firmware upgrade.'); document.querySelector('#pass').textContent('Password:'); // ... ``` One HTML File ------------- We can compact everything into a single HTML file: 1. Inline CSS 2. Inline images (base64 image/jpg) 3. Some placeholders for the warning message, password label, login button. This would avoid the "lots of folders" problem; one folder for all .html files. E.g. `ASUS.html` can be chosen when the target MAC vendor contains `ASUS`. AJAX Password Submission ------------------------ The website needs to send the password to the webserver, likely through some endpoint (e.g. `./login.cgi?password1=...&password2=...`). Easy to do in Javascript (via a simple `