#Why this matters
Every engagement and defensive audit starts by mapping what actually exists. Organisations often assume their perimeter consists of one website and a mail server, yet forgotten staging portals, old cloud buckets, and misconfigured DNS records expand the attack surface over time.
Good reconnaissance answers two questions before any exploit is considered: what assets belong to the target, and which ones are live and in scope. Defenders run the same workflow to catch shadow IT and leaked metadata before attackers do.
#Passive versus active reconnaissance
The core distinction is where your packets go. Passive techniques query public registries, search engines, and Certificate Transparency logs so target firewalls never see your traffic. Active techniques send DNS queries, ICMP echo requests, or TCP probes directly to target infrastructure.
| Aspect | Passive reconnaissance | Active reconnaissance |
|---|---|---|
| Target contact | None (third-party sources only) | Direct packets to target assets |
| Detection risk | Very low on target sensors | Logged by firewalls, DNS, and IDS |
| Data freshness | May include retired hosts | Reflects current live state |
| Typical sources | WHOIS/RDAP, CT logs, passive DNS | DNS queries, nmap -sn, HTTP probes |
Because passive records can be outdated, a practical workflow gathers passive leads first and then confirms live targets with controlled active checks.
- Check ScopeVerify domains and CIDRs in Rules of Engagement
- Passive OSINTQuery WHOIS, CT logs, subfinder, amass
- Resolve DNSConfirm active A, AAAA, CNAME, and TXT records
- Host DiscoveryRun targeted Nmap sweeps on in-scope IPs
#Passive OSINT and DNS discovery
Passive gathering begins with ownership records. Running whois (or querying RDAP) reveals registrar details, name servers, netblock ownership, and autonomous system numbers (ASNs). While privacy redaction hides personal contacts, name servers and IP allocations still point to hosting providers and adjacent ranges.
Subdomain discovery tools query dozens of public sources at once: Certificate Transparency (CT) logs, passive DNS databases, and code repositories. Every public TLS certificate is recorded in append-only CT logs, frequently exposing internal names such as staging-api or vpn. Both subfinder and amass automate this step cleanly.
$ subfinder -d example.test -silent
api.example.test
dev-portal.example.test
mail.example.test
$ amass enum -passive -d example.test
api.example.test
dev-portal.example.testDo not skip non-web DNS records. TXT records often reveal SPF (v=spf1) mail rules, SaaS verification tokens, and CIDR blocks owned by the organisation.
#Active probing and host discovery
With candidate hostnames collected, active verification separates retired entries from live systems. Start with dig to check whether a hostname resolves to an in-scope IP or points via CNAME to an external CDN.
$ dig +short A dev-portal.example.test
10.10.10.24
$ dig +short TXT example.test
"v=spf1 ip4:10.10.10.0/24 -all"
$ nmap -sn 10.10.10.0/24
Nmap scan report for gateway.lab.local (10.10.10.1)
Host is up (0.0012s latency).
Nmap scan report for dev-portal.lab.local (10.10.10.24)
Host is up (0.0018s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 2.41 secondsThe Nmap -sn flag runs host discovery without port scanning. On local subnets it sends ARP requests; across routed networks it sends ICMP echo, TCP SYN to port 443, TCP ACK to port 80, and ICMP timestamp probes.
Watch for virtual hosts during active checks. Multiple subdomains (app.lab.local, admin.lab.local) can share one IP address, with the web server routing requests using the HTTP Host header.
#Defending and common mistakes
Defenders reduce external exposure through continuous hygiene:
- Maintain an asset inventory: Retire staging domains promptly instead of leaving forgotten DNS entries active.
- Keep internal names private: Use a private internal CA for VPN-only services so internal hostnames do not appear in public CT logs.
- Clean up DNS and transfers: Remove dangling
CNAMErecords (to prevent subdomain takeover) and restrictAXFRzone transfers to authorised secondary name servers.
Common tester mistakes:
- Scanning third-party IPs: Probing an IP without checking
WHOISorCNAMEownership can hit a CDN or SaaS provider outside scope. - Skipping passive recon: Jumping straight into noisy scans misses historical subdomains and alerts the blue team immediately.
- Trusting unverified OSINT: Reporting passive findings without active DNS checks wastes time on dead hosts.
#Summary
- Passive reconnaissance gathers intelligence from WHOIS, CT logs,
subfinder, andamasswithout touching target systems. - Active reconnaissance queries DNS and probes hosts (such as
nmap -sn) to verify live assets, creating target-side logs. - Checking ownership and
CNAMErecords before probing prevents out-of-scope traffic to third-party providers. - Defenders shrink exposure by inventorying subdomains, keeping internal names out of public CT logs, and removing stale DNS records.