Host Listing
When DNS zone transfers are not available, hosts may still be discovered using a brute-force domain scan (Listing below). The technique simply iterates through all network addresses in a subnet. Each address that has a hostname (reverse lookup) can be readily discovered. A second search of the discovered hostnames can identify name aliases and additional DNS information.
Some DNS servers mitigate this attack by restricting the number of lookups that can be requested by any particular network address. For example, the host 10.1.2.3 may only be allowed to query a DNS server 100 times per hour. Attackers that use proxies or relay requests through a variety of DNS caches can overcome this type of restriction.
Code to List Hosts in a Domain
/************************************************** ListRange(): Scan a range of IP addresses. List any that resolve. **************************************************/ void ListRange (uint32_t Start, uint32_t Stop) { int i; char *S, AddrIP[100]; struct hostent *Hent; struct in_addr AddrIn; int Counter=0; /* process each IP address */ for( ; Start <= Stop ; Start++) { memset(AddrIP,0,sizeof(AddrIP)); AddrIn.s_addr = htonl(Start); strcpy(AddrIP,inet_ntoa(AddrIn)); sethostent(1); /* check for a hostname */ Hent = gethostbyaddr((char *)&AddrIn,sizeof(AddrIn),AF_INET); if (Hent) S = Hent->h_name; else S = NULL; if (S) { printf("%s %s\n",AddrIP,S); /* check every alias */ for(i=0; Hent->h_aliases[i]; i++) { S = Hent->h_aliases[i]; printf(" %s\n",S); fflush(stdout); } } } /* for() */ endhostent(); } /* ListRange() */
In this tutorial:
- Domain Name System (DNS)
- DNS Common Uses
- Hostname-to-Address Mapping
- Common Lookup Tools
- Naming Confusion Attack Vectors
- Dotted Names
- Name Formatting
- Exploited Anonymity
- Mail Servers
- Sender Policy Framework Overloading
- Domain Keys Overloading
- DNS Protocol
- Packet Information
- Simple DNS Server
- Distributed Architecture
- Top Level Domain Servers
- Generic Top Level Domain (gTLD)
- Secondary Level Domain (SLD)
- Primary and Secondary Servers
- Caching Servers
- DNS Management
- DNS Direct Risks
- DNS Performance versus Security
- DNS Cache Poisoning
- Corrupt DNS Packets
- DNS Domain Hijacking
- DNS Server Hijacking
- Dynamic DNS
- Similar Hostnames
- Domain Renewals
- Hostnames
- Zone Transfers
- Host Listing
- DNS Fields
- Mitgation Option
- Technical Threat Mitigation
- Social Threat Mitigation
- Defining Trusted Replies