Grant Cohoe

Cloud plumber, bit wrangler, solution engineer, hockey nut.

IP Over DNS Exploit

The Basics

First let’s review how your traffic gets to it’s destination. You open up your favorite web browser and punch in “”. Since your computer works with IP addresses, and not names (like people), you need to do a process of resolving the name. The Domain Name System (DNS) is the service that does this. Your ISP runs DNS servers, that are typically given to you in your DHCP lease. Your computer sends a query to this DNS server asking “what is the IP address of”. Since your ISP does not have control over the “” domain, the request is forwarded to another server. Eventually someone says “Hey! is at”. This response is sent back through the servers to your computer.

After resolving the name, your computer now creates a data packet that will be sent to the computer at The packet gets there by looking at your hosts route table and will hit your default gateway.

The Technology

IP over DNS is a method of encapsulating IP packets inside a DNS query. This essentially creates a VPN between a server and a client. In my case, I setup and configured the Iodine DNS server on my server located at RIT that I would use to route my traffic to the internet. Inside the tunnel exists the subnet of, with the server being at My client connected and received IP address

The Problem

Certain WLAN installations will include a guest SSID that non-controlled clients can associate to (In this scenario, I will use ExampleGuest, keeping the actual one I used anonymous). Often your traffic will get routed to a captive portal first, requiring you to enter credentials supplied by your organization. Until you do so, none of your traffic will reach it’s destination outside the LAN… UNLESS you discover a vulnerability, such as the one we are going to explore.

When I walked into the Example Corp site, I flipped open my trusty laptop and got to work. After associating with the ExampleGuest SSID, I was given the IP address with gateway I opened my web browser in attempt to get to “”, and was immediately directed to the captive portal asking me to log in. Obviously I do not have credentials to this network, so I am at a dead end at this time.

Next I whipped out a terminal session, and did a lookup on “”. Lo and behold the name was resolved to it’s external IP address. This means that DNS traffic was being allowed past the captive portal and out onto the network. If “” resolved to something like “” or an address in the space, I know that the captive portal is grabbing all of my traffic. This would be the end of this experiment. However as I saw, this was not the case. External DNS queries were still being answered. Time to do some hacks.

The Exploit

Step 1) I need my Iodine client to be able to “query” my remote name server. I added a static route to my laptop that forced traffic to my server through the gateway given to me by the DHCP server. (ip route add via

Step 2) I need to establish my IPoDNS tunnel. (iodine -P mypasswordwenthere A successful connection gave me the IP address I was then able to ping, which is the inside IP address of the tunnel).

Step 3) I need to change my default gateway to the server address inside the tunnel (ip route add default via

And with that, all of my traffic is going to be encapsulated over the IP over DNS tunnel and sent to my server as DNS queries, this giving me unrestricted internet access bypassing the captive portal.

The Defense

This entire experiment would grind to a halt if DNS queries were not being handled externally. The network administrator should enable features necessary to either drop DNS requests or answer them with the captive portal IP address.

The Conclusion

End result: Unrestricted internet access over a wireless network that I have no credentials to.

Difficulty of setting this up: HIGH Speed of tunneled internet: SLOW Worth it for practical use: NOT AT ALL Worth it for education: A LOT

This sort of trick can work on airplane and hotel wireless systems as well. Most sites do not think to have their captive portals capture DNS traffic in addition to regular IP traffic. As we can see here, it can be used against them.