Skip to content

Latest commit

Β 

History

History
134 lines (96 loc) Β· 4.92 KB

File metadata and controls

134 lines (96 loc) Β· 4.92 KB

🌐 DNS Enumeration β€” The Basics

DNS stands for Domain Name System. Before you can enumerate subdomains, understand zone transfers, or use any DNS tool effectively β€” you need to understand what DNS actually is and why it leaks so much useful information.


🧠 What is DNS β€” Plain English

DNS is the internet's phone book.

When you type google.com into your browser, your computer doesn't actually know where that is. It asks a DNS server β€” "hey, what's the IP address for google.com?" The DNS server looks it up and responds with something like 142.250.80.46. Your browser then connects to that IP address.

Without DNS, you'd have to memorize IP addresses for every website you visit. DNS translates human-readable names into machine-readable addresses.

Why this matters for enumeration: DNS records contain a map of a company's entire internet infrastructure. Mail servers, web servers, internal hostnames, third-party services β€” all of it is stored in DNS records. And a lot of it is publicly queryable.


πŸ“‹ DNS Record Types That Matter

Not all DNS records are created equal. These are the ones you'll encounter and actually care about:

Record Type What it does Why it matters
A Maps a hostname to an IPv4 address Primary record β€” tells you the IP of a host
AAAA Maps a hostname to an IPv6 address Same as A but for IPv6
CNAME Canonical Name β€” alias pointing to another hostname Reveals internal hostnames and third-party services
MX Mail Exchange β€” where email is routed Reveals email provider and mail server infrastructure
TXT Text record β€” stores arbitrary text Often contains SPF records, verification tokens, and sometimes sensitive info
NS Name Server β€” which servers handle DNS for this domain Critical for zone transfer attempts
PTR Reverse lookup β€” IP address to hostname Useful for mapping IP ranges back to hostnames
SOA Start of Authority β€” administrative info about the zone Contains primary nameserver and admin email
SRV Service record β€” location of specific services Reveals internal services like VoIP, LDAP, and more

πŸ” Why DNS Enumeration Reveals So Much

Companies don't always think carefully about what their DNS records expose. Here's what you commonly find:

Subdomains that reveal infrastructure:

mail.company.com        β†’ they use their own mail server
vpn.company.com         β†’ VPN portal β€” login page
dev.company.com         β†’ development environment β€” often less secure
staging.company.com     β†’ staging server β€” often running older software
jenkins.company.com     β†’ CI/CD server β€” often exposed
gitlab.company.com      β†’ internal git server
jira.company.com        β†’ project management β€” username enumeration

TXT records that reveal technology stack:

v=spf1 include:sendgrid.net     β†’ they use SendGrid for email
v=spf1 include:google.com       β†’ they use Google Workspace
MS=ms12345678                   β†’ Microsoft 365 tenant verification

CNAME records that reveal third-party services:

assets.company.com β†’ company.s3.amazonaws.com    β†’ AWS S3 bucket
cdn.company.com β†’ company.cloudfront.net          β†’ CloudFront CDN
help.company.com β†’ company.zendesk.com            β†’ Zendesk support

Each of these is a potential attack surface β€” a third-party service that might be misconfigured, a subdomain running old software, or an internal tool accidentally exposed.


πŸ› οΈ Basic DNS Queries β€” dig & nslookup

Before using advanced tools, know how to query DNS manually. These commands are available on all platforms.

dig (Linux/macOS β€” most powerful)

# Basic A record lookup
dig example.com

# Specific record type
dig example.com MX
dig example.com TXT
dig example.com NS
dig example.com AAAA

# Short output β€” just the answer
dig example.com +short

# Query a specific DNS server
dig @8.8.8.8 example.com

# Reverse lookup β€” IP to hostname
dig -x 10.10.10.1

nslookup (Windows/macOS/Linux β€” beginner friendly)

# Basic lookup
nslookup example.com

# Specific record type
nslookup -type=MX example.com
nslookup -type=TXT example.com
nslookup -type=NS example.com

# Query a specific DNS server
nslookup example.com 8.8.8.8

# Reverse lookup
nslookup 10.10.10.1

πŸ“Š What to Look For in DNS Output

When you run a DNS query, here's how to read what comes back:

$ dig example.com

;; ANSWER SECTION:
example.com.    300    IN    A    93.184.216.34
  • example.com. β€” the hostname queried
  • 300 β€” TTL (Time to Live) in seconds β€” how long this record is cached
  • IN β€” Internet class (always IN for normal DNS)
  • A β€” record type
  • 93.184.216.34 β€” the actual answer β€” the IP address

Low TTL values (under 300) sometimes indicate active infrastructure changes β€” worth noting.


by SudoChef Β· Part of the SudoCode Pentesting Methodology Guide