HTB Academy - Web Enumeration
Passive Information Gathering
WHOIS
whois allows us to gather information on a specific domain. This includes information like:
- IANA ID number
- Registrant details
- Admin details
- DNS servers
DNS
DNS look ups can be done using dig or nslookup.
Arecords provide mappings of host names to IP addresses (dig a ...).NSrecords provide details on the DNS servers.PTRrecords provide mappings of IP addresses to host names (“reverse” ofArecords -dig -x ...).CNAMErecords show alias host names for a provided host name.MXrecords provide details on mail exchange servers.
ANY requests (dig any ...) might not provide any information, due to RFC8482.
TXT records can be queried to get domain information (stored as text).
Passive subdomain enumeration
VirusTotal can be used to enumerate subdomains, since it maintains results from DNS queries.
crt.sh allows us to enumerate subdomains as well, from the issued TLS/SSL certificates.
Automated tool - TheHarvester, can take in multiple data sources like Baidu, crt.sh, RapidDNS etc.
Passive infrastructure enumeration
Useful tools: Netcraft, Internet Archive (WaybackMachine)
Active Information Gathering
Active infrastructure identification
Using cURL header requests (curl -I ...), we can determine information about the backend (Web server version, language, cookies, etc.)
Whatweb can be used to determine web technologies being used (CMS, blogging platforms, JS libraries, web servers etc.).
- Specify scan aggression level using
-aoption, and show verbose output with-v.
To check if a WAF is implemented, a tool like WafW00f can be used.
If there is a need to actively enumerate many subdomains and get an overview of HTTP attack surfaces, Aquatone can be used.
Active subdomain enumeration
Check Zone Transfers - use online tools like https://hackertarget.com/zone-transfer/ or dig. For the manual dig method:
- Enumerate DNS servers -
dig ns <hostname> - Test for AXFR zone transfers -
dig axfr <hostname> @<dns servername>
Alternatively, we can use tools like dnsenum to enumerate subdomains from a provided word list.
Gobuster:
- Brute-force directory enumeration with
diroption; use a word list in/usr/share/dirb/wordlists/. - Enumerate subdomains using
dnsoption; use a word list from the SecLists repository. A pattern can be loaded toGobusterif we are certain that subdomains all follow a specific pattern.
vHosts
We can fuzz and enumerate vHosts using ffuf and a vHost word list (available from SecLists repository):
ffuf -w ./vhosts -u <hostname/ip address> -H "HOST: FUZZ.<fuzz domain>" -fs <default response size>
- Default response size can be determined through trial and error using
cURLrequests, where we note theContent-Lengthheader for invalid requests.
Misc
Note that ffuf and Gobuster can both be used for directory fuzzing/enumeration.
For banner grabbing, use curl with -IL option.
robots.txt is always a low-hanging fruit that we can check.