DNS Record Scanner and Enumerator - Metasploit


This page contains detailed information about how to use the auxiliary/gather/enum_dns metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: DNS Record Scanner and Enumerator
Module: auxiliary/gather/enum_dns
Source code: modules/auxiliary/gather/enum_dns.rb
Disclosure date: -
Last modification time: 2020-09-22 02:56:51 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: dns
Target network port(s): 53
List of CVEs: CVE-1999-0532

This module can be used to gather information about a domain from a given DNS server by performing various DNS queries such as zone transfers, reverse lookups, SRV record brute forcing, and other techniques.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


msf > use auxiliary/gather/enum_dns
msf auxiliary(enum_dns) > show targets
    ... a list of targets ...
msf auxiliary(enum_dns) > set TARGET target-id
msf auxiliary(enum_dns) > show options
    ... show and set options ...
msf auxiliary(enum_dns) > exploit

Required Options


  • DOMAIN: The target domain

Go back to menu.

Msfconsole Usage


Here is how the gather/enum_dns auxiliary module looks in the msfconsole:

msf6 > use auxiliary/gather/enum_dns

msf6 auxiliary(gather/enum_dns) > show info

       Name: DNS Record Scanner and Enumerator
     Module: auxiliary/gather/enum_dns
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  Carlos Perez <[email protected]>
  Nixawk

Check supported:
  No

Basic options:
  Name         Current Setting                                                           Required  Description
  ----         ---------------                                                           --------  -----------
  DOMAIN                                                                                 yes       The target domain
  ENUM_A       true                                                                      yes       Enumerate DNS A record
  ENUM_AXFR    true                                                                      yes       Initiate a zone transfer against each NS record
  ENUM_BRT     false                                                                     yes       Brute force subdomains and hostnames via the supplied wordlist
  ENUM_CNAME   true                                                                      yes       Enumerate DNS CNAME record
  ENUM_MX      true                                                                      yes       Enumerate DNS MX record
  ENUM_NS      true                                                                      yes       Enumerate DNS NS record
  ENUM_RVL     false                                                                     yes       Reverse lookup a range of IP addresses
  ENUM_SOA     true                                                                      yes       Enumerate DNS SOA record
  ENUM_SRV     true                                                                      yes       Enumerate the most common SRV records
  ENUM_TLD     false                                                                     yes       Perform a TLD expansion by replacing the TLD with the IANA TLD list
  ENUM_TXT     true                                                                      yes       Enumerate DNS TXT record
  IPRANGE                                                                                no        The target address range or CIDR identifier
  NS                                                                                     no        Specify the nameservers to use for queries, space separated
  Proxies                                                                                no        A proxy chain of format type:host:port[,type:host:port][...]
  RPORT        53                                                                        yes       The target port (TCP)
  SEARCHLIST                                                                             no        DNS domain search list, comma separated
  STOP_WLDCRD  false                                                                     yes       Stops bruteforce enumeration if wildcard resolution is detected
  THREADS      1                                                                         no        Threads for ENUM_BRT
  WORDLIST     /opt/metasploit-framework/embedded/framework/data/wordlists/namelist.txt  no        Wordlist of subdomains

Description:
  This module can be used to gather information about a domain from a 
  given DNS server by performing various DNS queries such as zone 
  transfers, reverse lookups, SRV record brute forcing, and other 
  techniques.

References:
  https://nvd.nist.gov/vuln/detail/CVE-1999-0532
  OSVDB (492)

Module Options


This is a complete list of options available in the gather/enum_dns auxiliary module:

msf6 auxiliary(gather/enum_dns) > show options

Module options (auxiliary/gather/enum_dns):

   Name         Current Setting                                                           Required  Description
   ----         ---------------                                                           --------  -----------
   DOMAIN                                                                                 yes       The target domain
   ENUM_A       true                                                                      yes       Enumerate DNS A record
   ENUM_AXFR    true                                                                      yes       Initiate a zone transfer against each NS record
   ENUM_BRT     false                                                                     yes       Brute force subdomains and hostnames via the supplied wordlist
   ENUM_CNAME   true                                                                      yes       Enumerate DNS CNAME record
   ENUM_MX      true                                                                      yes       Enumerate DNS MX record
   ENUM_NS      true                                                                      yes       Enumerate DNS NS record
   ENUM_RVL     false                                                                     yes       Reverse lookup a range of IP addresses
   ENUM_SOA     true                                                                      yes       Enumerate DNS SOA record
   ENUM_SRV     true                                                                      yes       Enumerate the most common SRV records
   ENUM_TLD     false                                                                     yes       Perform a TLD expansion by replacing the TLD with the IANA TLD list
   ENUM_TXT     true                                                                      yes       Enumerate DNS TXT record
   IPRANGE                                                                                no        The target address range or CIDR identifier
   NS                                                                                     no        Specify the nameservers to use for queries, space separated
   Proxies                                                                                no        A proxy chain of format type:host:port[,type:host:port][...]
   RPORT        53                                                                        yes       The target port (TCP)
   SEARCHLIST                                                                             no        DNS domain search list, comma separated
   STOP_WLDCRD  false                                                                     yes       Stops bruteforce enumeration if wildcard resolution is detected
   THREADS      1                                                                         no        Threads for ENUM_BRT
   WORDLIST     /opt/metasploit-framework/embedded/framework/data/wordlists/namelist.txt  no        Wordlist of subdomains

Advanced Options


Here is a complete list of advanced options supported by the gather/enum_dns auxiliary module:

msf6 auxiliary(gather/enum_dns) > show advanced

Module advanced options (auxiliary/gather/enum_dns):

   Name                      Current Setting  Required  Description
   ----                      ---------------  --------  -----------
   CHOST                                      no        The local client address
   CPORT                                      no        The local client port
   ConnectTimeout            10               yes       Maximum number of seconds to establish a TCP connection
   DnsClientDefaultNS        8.8.8.8 8.8.4.4  no        Specify the default to use for queries, space separated
   DnsClientRVLExistingOnly  true             no        Only perform lookups on hosts in DB
   DnsClientReportARecords   true             no        Add hosts found via BRT and RVL to DB
   DnsClientResolvconf       /dev/null        yes       Resolvconf formatted configuration file to use for Resolver
   DnsNote                   true             no        Save all DNS results as notes
   RETRY                     2                no        Number of times to try to resolve a record if no response is received
   RETRY_INTERVAL            2                no        Number of seconds to wait before doing a retry
   SSL                       false            no        Negotiate SSL/TLS for outgoing connections
   SSLCipher                                  no        String for SSL cipher - "DHE-RSA-AES256-SHA" or "ADH"
   SSLVerifyMode             PEER             no        SSL verification method (Accepted: CLIENT_ONCE, FAIL_IF_NO_PEER_CERT, NONE, PEER)
   SSLVersion                Auto             yes       Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
   TCP_DNS                   false            no        Run queries over TCP
   TIMEOUT                   8                no        DNS TIMEOUT
   VERBOSE                   false            no        Enable detailed status messages
   WORKSPACE                                  no        Specify the workspace for this module

Auxiliary Actions


This is a list of all auxiliary actions that the gather/enum_dns module can do:

msf6 auxiliary(gather/enum_dns) > show actions

Auxiliary actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the gather/enum_dns auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(gather/enum_dns) > show evasion

Module evasion options:

   Name                Current Setting  Required  Description
   ----                ---------------  --------  -----------
   TCP::max_send_size  0                no        Maxiumum tcp segment size.  (0 = disable)
   TCP::send_delay     0                no        Delays inserted before every send.  (0 = disable)

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

Resolver setup failed - exception: <E>


Here is a relevant code snippet related to the "Resolver setup failed - exception: <E>" error message:

62:	    datastore['DnsClientTcpDns'] = datastore['TCP_DNS']
63:	
64:	    begin
65:	      setup_resolver
66:	    rescue RuntimeError => e
67:	      fail_with(Failure::BadConfig, "Resolver setup failed - exception: #{e}")
68:	    end
69:	
70:	    domain = datastore['DOMAIN']
71:	    is_wildcard = dns_wildcard_enabled?(domain)
72:	

AXFR failed: <E>


Here is a relevant code snippet related to the "AXFR failed: <E>" error message:

73:	    # All exceptions should be being handled by the library
74:	    # but catching here as well, just in case.
75:	    begin
76:	      dns_axfr(domain) if datastore['ENUM_AXFR']
77:	    rescue => e
78:	      print_error("AXFR failed: #{e}")
79:	    end
80:	    dns_get_a(domain) if datastore['ENUM_A']
81:	    dns_get_cname(domain) if datastore['ENUM_CNAME']
82:	    dns_get_ns(domain) if datastore['ENUM_NS']
83:	    dns_get_mx(domain) if datastore['ENUM_MX']

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Carlos Perez <carlos_perez[at]darkoperator.com>
  • Nixawk

Version


This page has been produced using Metasploit Framework version 6.2.23-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.