How to detect MITM on DNS?

I have reason to believe that my isp is intercepting all traffic on 53/udp and sending it to their servers, regardless of which one I choose.

I don’t need a solution, I already have DoH configured.

I am looking for a way to detect this (without dnssec, I am user-side this time). I hope this is somewhat related to the new multiperspective validation, and you have something to share on it.

My main worry it that when I do

dig @some_authoritative_nameserver

what I get is not a proper answer but just rubbish.


I was going to say that conceptually there is no way to detect this except by seeing whether or not the replies are different from the truth as seen from elsewhere on the Internet (e.g. via DoH).

But then I remembered other cases of network interference and how we identified them, and I realized that there is a way:

Get a VPS server somewhere out on the Internet and install some kind of DNS server there (like BIND). Then connect to it from your ISP (sending it a DNS query) and see whether the VPS server actually receives your connection or not.

There are various ways to check that and various levels on which you could experiment. For example, you could make BIND or similar log queries and then see if your lookups generate a log entry or not (if you think the ISP might be outright blocking the connection and not attempting to proxy it). Or you could create a weird made-up zone that the server thinks it’s authoritative for and then query it directly for that zone, and see if you get the same records back. Or you could just have some other service listening on port 53 and see if the ISP allows you to connect to it (in the very simplest case, sudo nc -l 53 and nc myvps 53 and see if you can type back and forth between the two machines!).


This should be interesting. I’ll try.

There are some authoritative DNS services that will return information about the resolver used to contact them. They can help prove interception. (But they can’t prove a negative with complete certainty, since an improbably clever interceptor could lie!)

They can return:

  • The resolver’s IP address.
  • The optional EDNS Client Subnet extension sent by some resolvers to some authoritative servers, which normally identifies the subnet the resolver received the query from.

Note that large resolvers will use different IP addresses to contact authoritative servers, not the resolver’s public IP address. (They can also use a different IP version.) For example, will use IPs assigned to Cloudflare. lists the ranges they use in their FAQ. will usually, but not always, use IP addresses assigned to PCH.

For example, Akamai runs this:

$ dig txt

If you run, say, dig txt @" and it reports that it got the query from somewhere outside Google’s published ranges, or without an ECS extension, it was likely intercepted.

Google runs PowerDNS runs several things. I run

You can also sometimes detect more subtle differences between different implementations. (Mostly obviously whether DNSSEC is used or not.)

Edit: You can also try to query the authoritative servers for those zones directly.



% dig txt @ +short
"ns" ""

yeah, not good:

% whois
% This is the RIPE Database query service.
% The objects are in RPSL format.
% The RIPE Database is subject to Terms and Conditions.
% See

% Note: this output has been filtered.
%       To receive output for a database update, use the "-B" flag.

% Information related to ' -'

% Abuse contact for ' -' is ''

inetnum: -
netname:        WIND
descr:          Rete di servizio per il DNS di WIND
status:         LEGACY
remarks:        NEW DNS IPV4 ADDRESSES

There are some devices and networks that unwisely intercepted dating to before it was in use. It’s possible they’re still doing that inadvertently instead of intentionally intercepting all (major) DNS resolvers.

1 Like

I’d say that’s not the case, it’s a very big isp with tens of millions of users, and:

% dig @ txt +short

and their reason… is probably this:

% dig @ +short

Funny thing about my network operator: they only interfere with 53/udp – 53/tcp works fine:

% dig +tcp +short @ txt
"ip" ""
"ecs" ""
"ns" "2a00:1450:4025::104"

% dig +tcp +short @

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.