Finding v6 hosts by efficiently mapping ip6.arpa
The method is best explained using an example. This example uses the IPv6 Address Prefix Reserved for Documentation.
Let’s assume that within 2001:DB8::/32 there is 2001:DB8:80::/48
which has reverse DNS hosted in a zone called 0.8.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
Now, given the zone name (let’s call it X to be slightly easier
on the eyes), we can query 0.X, 1.X,
2.X etc. up to and including f.X. Most of these
queries will return an NXDOMAIN rcode; this means the name does not exist, but
very importantly, this can usually be construed to mean that no longer name
exists either. Suppose that in this case, two of the names (0.X
and f.X) do not return NXDOMAIN – instead they return NOERROR.
This means the nameserver has a reason to not deny existence, and
in this case, that reason is that a longer name exists.
We tested 16 prefixes of X and have rejected 14 due to NXDOMAIN;
by that, we have reduced our search space from a full /48 to 1/8th of a /52 –
a 128-fold reduction with just 16 queries. This trend continues at every step.
Note that whether this works depends on how a nameserver handles requests for these shortened names (the technical term is ‘empty non-terminals’). BIND and NSD return NOERROR and NXDOMAIN as described above; tinydns and PowerDNS in most setups will not.
As said above, I could not find any previous work applying this feature of DNS to the mapping of reverse zones. If you do know of anything, let me know and I will update this post.
I believe that one may be able to extend this by examining the time for different responses.
Comment by John Washington — Mar 29, 2012 12:25:01 PM | # - re
Hi John, could you elaborate?
Comment by peter — Mar 30, 2012 6:29:19 AM | # - re
Thanks for a great article! I just implemented a Nmap script that uses the technique you describe and was very impressed by the results. You can check out the script here: https://svn.nmap.org/nmap/scripts/dns-ip6-arpa-scan.nse
Comment by Patrik Karlsson — Apr 1, 2012 1:08:28 PM | # - re
[…] used in my recent IPv6 security testing webcast If you have any specific questions, please open a Discussion thread. Finding v6 hosts by efficiently mapping ip6.arpa – 7bits.nl […]
Pingback by Week 13 in Review – 2012 | Infosec Events — Apr 2, 2012 10:59:53 AM | # - re
[…] When I posted the idea from my previous blogpost to the ipv6hackers mailing list and my Twitter account, I was expecting to hear that this had been done before and I had […]
Pingback by ip6.arpa, prior art and results — inside Habbie's mind — Apr 8, 2012 10:24:46 PM | # - re