DNS

Hosts File

Description here

/etc/hosts

example here

DNS Enumeration

DNS offers a variety of information about public (and sometimes private!) organization servers, such as IP addresses, server names, and server functionality.

zonetransfer.me

zonetransfer.me (https://digi.ninja/projects/zonetransferme.php)

A public training site for testing and learning about DNS. Uses the following two name servers:

  • nsztm1.digi.ninja

  • nsztm2.digi.ninja

You can test everything from simple dig queries to DNS zone transfers.

Interacting with a DNS Server

  • Also you can use nslookup

  • dig also can be used

Automating lookups

we have some initial data from the zonetransfer.me domain, we can continue to use additional DNS queries to discover more host names and IP addresses belonging to megacorpone.com.

Forward Lookup Brute Force

Taking the previous concept a step further, we can automate the Forward DNS Lookup of common host names using the host command and a Bash script.

Reverse Lookup Brute Force

If the DNS administrator of megacorpone.com configured PTR records for the domain, we might find out some more domain names that were missed during the forward lookup brute-force phase.

DNS Zone Transfers

  • A zone transfer is similar to a database replication act between related DNS servers.

  • This process includes the copying of the zone file from a master DNS server to a slave server.

  • The zone file contains a list of all the DNS names configured for that zone. Zone transfers should usually be limited to authorized slave DNS servers.

  • Now Lets automate the process:

    • To get the name servers for a given domain in a clean format, we can issue the following command.

    • Taking this a step further, we could write the following simple Bash script to automate the procedure of discovering and attempting a zone transfer on each DNS server found.

      Running this script on zonetransfer.me should automatically identify both name servers and attempt a zone transfer on each of them

Tools

DNSRecon

DNSEnum

fierce

NOTE: the one included in Kali is outdated and may not work, so try using the new version from fierce

DIG

DNSEnum

DNS reverse lookup

Using powershell

Using dnsrecon:

Misc

DNS zone transfer: dig axfr <hostname> @<ip> or host -l <domain> <nameserver>

add DNS server - Linux: /etc/resolv.conf {nameserver <ip>}

Network mapping of attack surfaces and external asset discovery using open source information gathering and active reconnaissance techniques: https://github.com/OWASP/Amass

  • NMAP DNS Hostnames Lookup

  • Host Lookup

  • Reverse Lookup Brute Force - find domains in the same range

  • Perform DNS IP Lookup

  • Perform MX Record Lookup

  • Perform Zone Transfer with DIG

DNS Zone Transfers

  • Windows DNS zone transfer

  • Linux DNS zone transfer

  • Dnsrecon DNS Brute Force

  • Dnsrecon DNS List of megacorp

  • DNSEnum

If you like this content and would like to see more, please consider buying me a coffee!

Last updated