Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to detect visitor DNS server?

Detecting visitor IP is easy. But how about detecting DNS server ips of a visitor ?

I found this PHP function, however it finds only domain names' DNS.

dns_get_record("website.com", DNS_ANY);

Is it possible to detect visitor DNS server ?

like image 459
user198989 Avatar asked May 23 '12 14:05

user198989


3 Answers

Yes, you can, like detecting page resolution of visitors.

You need own DNS server and force user to resolve unique dns name. If user tried to resolve it then they will leaks to your DNS server own DNS server address. Next to DNS server have to share information who asked about the unique dns name to your web apps.

like image 141
Adam Dobrawy Avatar answered Oct 06 '22 00:10

Adam Dobrawy


It's not easy, but it can be done. There's a demonstration of the approach suggested in a separate answer by Adam Dobrawy at http://ipleak.net/

To add a bit of detail, the way you can implement something like this is:

Part 1 - Set up your own DNS server on myspecialdomain.com

This DNS server needs to be custom written to log and store the incoming request and the source IP address. This storage only needs to be for a short period of time, so something like memcache might work nicely. The DNS response should be an NXDOMAIN.

Part 2 - Your client-side code

In your Javscript make and store a large random number. Make the browser lookup .myspecialdomain.com. Load this via a JS img tag with an error handler. In that error handler, now make a query to your server side code passing the random number.

Part 3 - Your web application (server side)

You need to implement some server side logic that takes the random string, looks it up in the datastore, and retrieves the IP address of the DNS server. Note the IP address here will be the IP Unicast address of the particular server, it won't be an IP Anycast address like 8.8.8.8. Here you can use GeoIP or Whois databases to determine the owner of that IP address (OpenDNS, Google etc). You can then generate a response to send to the client logic.

like image 44
Adam T Avatar answered Oct 06 '22 01:10

Adam T


DNS resolution is not part of the request itself which means there is no way for the receiver of the request to know which DNS was used by the client (browser).

like image 35
brezanac Avatar answered Oct 06 '22 00:10

brezanac