πŸ›‘οΈ Methodology Checklist

  • Passive: query crt.sh, VirusTotal, SecurityTrails for subdomains
  • Active zone transfer attempt against all NS servers
  • Subdomain brute-force with wordlist: gobuster dns -d [DOMAIN] -w [WORDLIST]
  • Virtual host fuzzing: ffuf -w [WORDLIST] -H "Host: FUZZ.[DOMAIN]" -u http://[IP]
  • Check for wildcard DNS: nslookup DOESNOTEXIST.[DOMAIN]
  • Enumerate internal DNS names from TLS certs (SANs)
  • Add discovered vhosts to /etc/hosts for further testing

🎯 Operational Context

Think Dumber First: Passive first β€” query crt.sh, VirusTotal, and SecurityTrails before sending any requests to the target. These sources index subdomains found in historical scans and cert logs. After passive, move to active: DNS brute-force against the authoritative NS server using gobuster dns or dnsx with SecLists subdomains wordlist.

When you land here: Web target with a domain. Build subdomain list passively first. Resolve all discovered subdomains. Check each unique IP for vhost-based virtual hosting. Look for DNS wildcards before brute-forcing. Map subdomains to attack surface.


⚑ Tactical Cheatsheet

CommandTactical Outcome
dig [DOMAIN] ARetrieve IPv4 address
dig [DOMAIN] MXFind mail servers
dig [DOMAIN] NSIdentify authoritative nameservers
dig [DOMAIN] TXTRetrieve TXT records (SPF, DMARC, verifications)
dig [DOMAIN] CNAMERetrieve canonical name/alias records
dig [DOMAIN] SOARetrieve Start of Authority record
dig @1.1.1.1 [DOMAIN]Query specific nameserver
dig +trace [DOMAIN]Show full DNS resolution path
dig -x [IP]Reverse lookup β€” IP to hostname
dig +short [DOMAIN]Concise answer only
dig +noall +answer [DOMAIN]Strip metadata, show answer section only

πŸ”¬ Deep Dive & Workflow

How DNS Works (Resolution Chain)

  1. Computer checks local cache β†’ queries DNS Resolver (ISP)
  2. Resolver queries Root Name Server β†’ points to TLD server
  3. TLD Name Server β†’ points to Authoritative Name Server
  4. Authoritative Name Server β†’ returns actual IP

The Hosts File (Manual Override)

Bypasses DNS entirely for specific hostnames. Critical for HTB labs.

  • Linux/macOS: /etc/hosts
  • Windows: C:\Windows\System32\drivers\etc\hosts
  • Format: [IP] [hostname] [alias]
[TARGET_IP]   inlanefreight.htb
[TARGET_IP]   dev.inlanefreight.htb

DNS Record Types

TypeDescriptionRecon Value
AIPv4 addressDirect host discovery
AAAAIPv6 addressIPv6 attack surface
CNAMEAlias β†’ can point to cloud/external servicesSubdomain takeover potential
MXMail serversEmail infra, phishing paths
NSAuthoritative nameserversTarget for zone transfer
TXTArbitrary text (SPF, DMARC, verification)Tech stack, third-party services
SOAZone admin infoAdmin email (. = @)
SRVService hostname/portVoIP, LDAP, Kerberos discovery
PTRReverse DNS β€” IP to hostnameInternal host mapping

dig Output Sections

  1. Header: Status (NOERROR = success), flags (qr=response, rd=recursion)
  2. Question: The query made
  3. Answer: IP/data + TTL (cache duration)
  4. Footer: Query time, responding server

Reconnaissance Applications

  • CNAME records: Can reveal outdated dev/staging servers
  • NS records: Reveal hosting providers
  • New subdomains in TXT (vpn., payroll.) = new entry points or internal software
  • Change monitoring: New subdomains = new attack surface

πŸ› οΈ Troubleshooting & Edge Cases

ProblemCauseFix
gobuster dns returns wildcard false positivesDNS wildcard active (*.domain.com resolves)Test: dig randomgarbage123.[DOMAIN]; if resolves, filter by unique response content size in ffuf vhost mode
Passive sources return different subdomainsEach source has different historical dataTake union of all sources; use cat *.txt | sort -u > all_subs.txt to merge
Active brute-force DNS query rate limitedTarget DNS rate-limiting queriesReduce threads: gobuster dns -t 10 -r [TARGET_NS]; use internal DNS server as resolver
Subdomain resolves to CDN IP (Cloudflare/Akamai)Real origin IP hidden behind CDNCheck historical DNS records on SecurityTrails; look for direct origin IP in cert’s SAN list; check MX records
dnsx returns NXDOMAIN for all discovered subdomainsSubdomains were deleted or wrong nameserverQuery against authoritative NS: dnsx -r [AUTH_NS] -d [DOMAIN] -w wordlist.txt

πŸ“ Reporting Trigger

Finding Title: Subdomain Discovery Revealing Shadow IT / Unsecured Development Environments Impact: Discovered subdomains expose forgotten staging environments, admin panels, internal tools, or vulnerable legacy applications not included in regular security assessments. Root Cause: Subdomains created for development/testing without proper lifecycle management or security baseline. Recommendation: Maintain an authoritative DNS inventory. Implement a subdomain lifecycle policy. Ensure all subdomains are included in security scanning scope. Remove or protect orphaned subdomains.