How to Get a List of All Subdomains of a Domain?

Published July 07, 2024

Problem: Finding Subdomains of a Domain

Identifying all subdomains linked to a main domain can be difficult. Websites often use subdomains for different purposes, like hosting services or organizing content. However, these subdomains are not always easy to see or listed publicly. This lack of clarity can create problems for website owners, security professionals, and developers who need a full view of a domain's structure.

Methods to Find Subdomains of a Domain

DNS Zone Transfer

DNS zone transfer is a process where a DNS server shares its zone information with another server. This method can reveal subdomains if the target DNS server is not configured correctly. You can use tools like 'dig' or 'nslookup' on the command line to perform a zone transfer. However, this method has limits. Many DNS servers now restrict zone transfers, making it less reliable for subdomain discovery.

Online Subdomain Finder Tools

Online subdomain finder tools offer an easy way to discover subdomains. These tools use various techniques to find subdomains and show the results in a clear format. Some popular subdomain lookup services include Sublist3r, Findsubdomains, and Subfinder. The main benefit of using online tools is their ease of use, as they don't require software installation or technical knowledge.

Brute Force Subdomain Enumeration

Brute force subdomain enumeration involves trying different subdomain names to see if they exist. This method uses a list of common subdomain names and checks each one against the target domain. Tools like Subbrute and Amass can automate this process. While brute force can find hidden subdomains, it can take time and may generate a lot of network traffic.

Search Engine Queries

Search engines can help find subdomains. By using advanced search operators, you can ask search engines to show pages from a specific domain, including its subdomains. For example, you can use the query "site:example.com" in Google to find all indexed pages from example.com and its subdomains. However, this method is limited to subdomains that are public and indexed by search engines.

Advanced Techniques for Subdomain Discovery

Passive DNS Data Analysis

Passive DNS is a method to collect and analyze DNS data from various sources without directly querying the target domain. This technique involves monitoring DNS responses over time. To use passive DNS for subdomain enumeration, you can access historical DNS data through specialized services or databases. These services store DNS information, allowing you to search for subdomains associated with a domain. Passive DNS analysis is non-intrusive and can find subdomains that are no longer active or visible.

Reverse DNS Lookup

Reverse DNS lookup finds domain names associated with an IP address. This method queries the DNS system to get the domain name linked to a specific IP address. To use reverse DNS lookup for subdomain discovery, you start with the IP address range of the target domain and perform reverse lookups on each IP in that range. This can reveal subdomains that share the same IP address. This technique can find subdomains that might not be discovered through forward DNS lookups. However, it's limited by the accuracy of DNS records and may not work if reverse DNS is not set up for the IP addresses.

API-based Subdomain Enumeration

API-based subdomain finders use application programming interfaces provided by various services to gather subdomain information. These APIs often access large databases of DNS records, SSL/TLS certificate data, and other sources to compile lists of subdomains. Popular APIs for subdomain discovery include SecurityTrails, Censys, and Shodan. To use these APIs, you typically need to sign up for an account and get an API key. You can then make requests to the API with your target domain, and it will return a list of known subdomains. Using APIs allows you to quickly obtain up-to-date subdomain lists without manual searching or network scanning.