Commands / On the wire

On the wire

dnsrecon

Also dns enumeration, zone transfer, axfr, dns recon

Enumerates a domain through its name servers — tries a zone transfer, brute-forces host names, sweeps record types — and prints the result ready for a report.

dnsrecon automates the DNS questions a tester asks by hand with dig. Point it at a domain with -d and pick a test with -t: -t axfr resolves the zone's SOA and NS records, then tries a full zone transfer (AXFR) against each name server and dumps every record if one answers. A server that never set allow-transfer hands over the whole zone — internal hosts and all — and dnsrecon prints Zone Transfer was successful!!. When transfers are locked, -t brt brute-forces host names from a wordlist and keeps whatever resolves, and -t std sweeps the common record types. -n names the server to query, useful when you already know the authoritative server's address. The tool is a convenience over dig: knowing the dig AXFR underneath is what lets you read why a transfer was refused.

dnsrecon command usage

dnsrecon -d DOMAIN [-n NAMESERVER] -t {axfr | brt | std}

Options

-d halcyonmedia.test
the target domain to enumerate
-n 10.0.1.53
query this name server directly, instead of the system resolver
-t axfr
attempt a full zone transfer against each of the zone's name servers
-t brt
brute-force host names from a wordlist (for when transfers are locked)
-t std
sweep the standard record types (SOA, NS, MX, A, TXT, SRV)

dnsrecon examples

dnsrecon -n 10.0.1.53 -d halcyonmedia.test -t axfr
Tries a zone transfer against the named server and dumps every record if it succeeds.
dnsrecon -d halcyonmedia.test -t brt -D /usr/share/wordlists/dnsmap.txt
Brute-forces host names from a wordlist when a zone transfer is refused.

Reading the output

$ dnsrecon -n 10.0.1.53 -d halcyonmedia.test -t axfr
INFO Checking for Zone Transfer for halcyonmedia.test name servers
INFO Resolving SOA Record
INFO 	 SOA ns.halcyonmedia.test 10.0.1.53
INFO Trying NS server 10.0.1.53
INFO 10.0.1.53 Has port 53 TCP Open
INFO Zone Transfer was successful!!
INFO 	 A db-prod.halcyonmedia.test 10.10.0.50
INFO 	 A vpn.halcyonmedia.test 10.10.0.1
INFO 	 A ci.halcyonmedia.test 10.10.0.30
  • Zone Transfer was successful!! means the server answered an AXFR from an unauthorised client — a misconfiguration, not a vulnerability in the software.
  • The internal hosts (db-prod, vpn, ci) on a private range are the finding: names an attacker would never have guessed, handed over in one request.

Pitfalls

  • -t axfr only works when the server allows transfers; a locked server returns no records and you fall back to -t brt.
  • Brute force (-t brt) finds only names in the wordlist — it never sees an unguessable host that an open AXFR would have revealed.

Run it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab