Notes
Passive vs active
There are two kinds of reconnaissance. Passive recon uses only third-party sources: search engines, public records and archives. The target's systems are never contacted, so it sees nothing and can detect nothing. Active recon contacts the target: queries to its DNS servers, requests to its websites, scans. That can be logged. A careful tester starts passive and stays passive as long as possible. For defenders, the lesson is uncomfortable: you cannot alert on passive recon.
- passive: third-party sources only; search engines, public records, archives the target sees nothing
- active: you contact the target; DNS queries to its servers, web requests, scans it can be logged
- start passive, stay passive as long as you can
Domains and DNS
The map starts with names. Registration records show the registrar and dates. DNS records show mail servers and name servers, and the text records are surprisingly revealing: verification entries show which email, marketing and collaboration services the company uses. Certificate transparency logs list every hostname that ever received a public certificate, including that forgotten staging site. And network registries show which address ranges the organisation owns.
- WHOIS / RDAP: registrar, dates, sometimes contacts
- DNS records: A, MX, TXT, NS
- MX and TXT show the mail provider and SaaS in use (verification records)
- certificate transparency: every hostname that ever got a public certificate
- ASN lookups: IP ranges owned
Search engines
Search engines index far more than companies intend. Search operators narrow a query to one site, one file type or one word in the address. With them you find exposed documents, login and administration pages, open directory listings and forgotten subdomains. This is often called Google dorking. Run these against your own domain today. Finding a spreadsheet of customer data in a search result is unpleasant, but much better than an attacker finding it first.
site:example.com filetype:pdf site:example.com inurl:admin site:example.com intitle:"index of" site:example.com -www "@example.com" password # known as "Google dorking" # finds: exposed documents, login # pages, directory listings, # forgotten subdomains
Shodan and Censys
Shodan and Censys are search engines for devices. They continuously scan every public address and index the open ports, the service banners and the certificates. You can search by organisation, domain, product or version. They reveal exposed databases, remote desktop services, administration panels and outdated software. And it is still passive: you are reading their data, not contacting the target. Attackers use these to find victims for a new vulnerability within hours.
- they scan every public IP and index open ports, banners and certificates
- search by organisation, domain, product or version
- finds: exposed databases, remote desktops, cameras, admin panels, old software
- still passive: you query their data, not the target
Code and secrets
Public code is one of the richest sources. Commits contain API keys, tokens and passwords, and deleting them later does not remove them from history. Code reveals internal hostnames and addresses. Employees push work code to personal accounts. The same applies to public container images, package registries, paste sites and shared API collections. Scanners such as gitleaks and TruffleHog find secrets automatically, and attackers run them against public repositories all day.
- API keys, tokens, passwords in commits and history
- internal hostnames and URLs
- config files, .env files
- personal repos of employees with work code in them
- public Docker images, package registries, paste sites, Postman collections
- tools: gitleaks, TruffleHog
People
People are a source too. Professional profiles give names and roles, who joined last week and who administers what. From a few addresses you learn the email format, and can then build a list for the whole company. Job adverts list the exact technology stack, down to product versions. Engineers describe their architecture in talks and ask about it on forums. Photos show badges, screens and whiteboards. All of this feeds phishing and password guessing.
- professional profiles: names, roles, who is new, who is an administrator
- email format: first.last@
- job adverts: the exact technology stack in use
- conference talks, blog posts, forum questions
- photos: badges, screens, whiteboards
Breach data
Then there is breach data. Billions of email and password pairs from past breaches circulate, and people reuse passwords between personal sites and work. More recently, malware called infostealers collects saved passwords and session cookies from infected home computers, and those logs are sold. This is how many large incidents now begin. As a defender, check your domain's exposure through a legitimate service, block known-breached passwords, and require multi-factor authentication.
- billions of email and password pairs from past breaches are in circulation
- people reuse passwords between personal and work
- infostealer malware logs: fresh passwords and session cookies
- defenders: check exposure (Have I Been Pwned domain search), enforce MFA
Tools
The collection is automated. TheHarvester gathers emails and hostnames. Amass and Subfinder list subdomains. The site c r t dot s h searches certificate logs. Shodan and Censys show exposure. SpiderFoot and Maltego collect from many sources and link the results. The Wayback Machine shows old pages and endpoints that may still work. Gitleaks and TruffleHog find secrets. The tools produce lists. Deciding which items matter is the skill.
- theHarvester: emails, hosts
- Amass, Subfinder: subdomains
- crt.sh: certificate logs
- Shodan, Censys: exposure
- SpiderFoot, Maltego: collect and link everything
- Wayback Machine: old pages and old endpoints
- gitleaks, TruffleHog: secrets
- whois, dig: the basics
The output
Good reconnaissance ends with a map, not a pile of data. An asset list: domains, hosts, address ranges, cloud accounts. The technologies and versions in use. The entry points: login pages, VPNs, APIs, mail. A list of people and roles. Often some findings already, such as exposed files or leaked keys. And priorities: experienced testers look for what is old, forgotten or unusual, because that is where the weaknesses usually are.
- asset list: domains, hosts, IP ranges, cloud accounts
- technologies and versions
- entry points: logins, VPNs, APIs, mail
- people: email list, roles
- findings already: exposed files, leaked keys
- priorities: what looks old, forgotten or unusual
Defend: recon yourself
The defense is to run this on yourself, continuously. Inventory your assets and remove forgotten hosts and DNS records. Monitor certificate logs for your domains. Scan every repository for secrets, and rotate anything that leaked. Check device search engines for your address ranges. Limit the technical detail in job adverts and public documents. Require multi-factor authentication and block breached passwords. This discipline has a name: attack surface management.
- inventory and remove forgotten hosts and DNS records
- monitor certificate logs for your domains
- secret scanning on all repos, and rotate what leaked
- check Shodan for your ranges
- limit detail in job adverts and public documents
- MFA, breached-password checks
- staff awareness of oversharing
Common mistakes
Mistakes. Skipping reconnaissance and going straight to scanning, which misses the forgotten assets where the real problems are. Actively probing a host found in recon before confirming it is in scope; a similar name may belong to another company. Handling breach data in ways the engagement does not allow. Trusting stale results. And on the defender side: having no asset inventory, and removing a leaked key from a repository without rotating it.
- skipping recon and going straight to scanning
- active probing of hosts not confirmed in scope
- using stolen data in ways the engagement forbids
- trusting stale results
- defenders: no asset inventory at all
- deleting a leaked key from git without rotating it
Say it like this
In the interview: I start passively, with DNS and registration records, certificate transparency logs, search operators, device search engines, public code repositories and breach exposure, to build a list of domains, hosts, technologies and people. I confirm everything against the scope before any active probing. And as a defender I run the same process continuously against our own organisation, as attack surface management, so we find forgotten assets and leaked secrets first.
- "Passive first: DNS, WHOIS, certificate transparency, search operators, Shodan, public code and breach data, to list domains, hosts, tech
- and people. Then confirm
- scope before active checks.
- As a defender I run this
- continuously on ourselves."