Passive reconnaissance: what the internet already knows about a company
Passive reconnaissance gathers data from public sources and sends the target no request at all. Sources: DNS, WHOIS/RDAP, Certificate Transparency logs, search engines, public repositories, scan databases such as Shodan. It goes first because it leaves no trace in the target's logs and shows what to check actively. Data goes stale, so every name is verified, and a found key is never used.
Pentest · Recon
How many of a company’s sites can you find without sending it a single packet?
The scope before a test lists one domain, shop.example. In an hour a pentester writes out more than two dozen subdomains, finds a forgotten staging-old, learns that the front end is React and the back end is Java, and sees a contractor’s repository with a config. They sent no request to the company’s servers. This lesson is about passive reconnaissance: where this information comes from, what it is good for and where its limits are.
How it works and why.Passive reconnaissance collects data from public sources and does not interact with the target’s systems directly. Active reconnaissance (the next lesson) sends packets and requests to the target. Passive goes first because it costs nothing, leaves no traces in the target’s logs and shows what is worth checking actively and within which scope. Typical sources:
DNS and WHOIS/RDAP: domain records, mail servers, the registrar, related domains;
Certificate Transparency logs: every issued TLS certificate is recorded publicly, so subdomains show up, forgotten ones too;
Search engines and archives: search operators, the Wayback Machine, caches;
Public repositories and packages: code, configs, keys, internal host names;
Scan databases (Shodan, Censys): they have already scanned the internet, you only read their results;
Job posts, blogs, documents: the technology stack, system names, file metadata.
From sources to an asset list
Figure 1. Passive reconnaissance reads other people’s data about the target and does not ask the target itself.
Example: subdomains from Certificate Transparency. The crt.sh service lets you search certificates by a name pattern. The query goes to crt.sh, not to the company:
The host staging-old is not linked anywhere in the interface but appeared in certificates. It is a candidate for an active check (whether it is alive and in scope). The logs also keep expired certificates, so the list may contain names that no longer exist: each name is checked, not taken as proof.
A real case. In October 2022 Toyota reported that a subcontractor who developed the T-Connect website had put part of the code in a public GitHub repository, and the code contained an access key to a data server. According to the company, the repository was open from December 2017 to 15 September 2022 and the key was replaced on 17 September. 296,019 email addresses were at risk; names, phone numbers and cards were not involved, and the company could not confirm third-party access. For reconnaissance the conclusion is: public code of contractors and former employees is part of the attack surface and is looked at first. If a working key is found it is not used to log in (that is access, not reconnaissance) and the contact person is told.
Limits and alternatives. Passive data goes stale: a service may be gone, an IP changed. It is incomplete and does not show what is open now, so it is complemented with active reconnaissance within scope. “Passive” does not mean “without rules”: collecting data about employees (social networks, personal accounts) is allowed only if the rules of engagement provide for it, and personal data laws always apply. Some tools (for example amass) have both passive and active modes: the agreement says which is allowed.
Common mistakes.
Treating passive reconnaissance as not limited by scope: data about other companies and people must not be collected.
Trusting a list of subdomains without checking: some names have long been gone or belong to another owner.
Using a found key “just to check”: that is unauthorized access.
Not recording the source of a finding: the report needs references to reproduce it.
Check yourself
Why is searching for subdomains in Certificate Transparency logs considered passive reconnaissance even though it shows a company’s real hosts?
Answer
The query goes to a public log (for example crt.sh), not to the company’s systems, so no packet is sent to the target. The data exists because certificate issuers publish certificates themselves.
An access key to the company’s storage is found in a contractor’s public repository. What next?
Answer
Do not use the key: logging in with it is access that is not permitted. Record where it was found and notify the contact person immediately so the key is revoked, because it is considered compromised from the moment of publication.
Related lessons: “Authorization, scope and rules of engagement: testing legally”, “Active reconnaissance: ports, services, version fingerprints”, “Pentest phases, methodologies and where QA fits”.
In an interview.Junior: “Passive reconnaissance collects public information without requests to the target: DNS, certificate logs, search, public code. It goes first and helps plan active checks within scope”. Middle/Senior: I add: verifying every name, leaks in contractors’ code (the Toyota 2022 example), the limits set by the rules of engagement for data about people, and how to handle found keys.
Active reconnaissance: ports, services, version fingerprints
Active reconnaissance sends packets and requests to the target to find out what is alive. The scanner nmap determines port states and, with -sV, the program and version of a service; technology is also recognised from fingerprints (banner, headers, cookie names). A version gives only a CVE candidate to confirm: a banner can be altered and fixes are backported. It is done within scope, with permission and at a moderate rate.
Pentest · Recon
The server’s response shows its software version. Is that already a vulnerability?
After passive reconnaissance the tester has a list of names. Now they need to learn which of them are alive, which ports are open, what runs on them and in what version. This is active reconnaissance: packets are sent to the target, so it needs permission, a scope and an agreed time. This lesson covers what ports and fingerprints give, how to draw conclusions from them and where not to.
How it works and why. A port scanner (nmap) sends packets to ports and from the replies determines the state: most often open, closed or filtered (nmap distinguishes six states in total). With -sV it additionally sends probes typical for services and infers the program and version from the reply. A fingerprint is any sign by which a technology is recognized: a banner, the Server header, X-Powered-By, cookie names (PHPSESSID, JSESSIONID), the text of error pages, the path structure, a favicon hash.
nmap -sV -p 22,80,443,8800 10.0.0.5
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.9p1
80/tcp open http Apache httpd 2.4.49
443/tcp open ssl/http Apache httpd 2.4.49
8800/tcp open http nginx
This is a made-up output. Ports are given either as a list (-p 22,80) or all of them (-p-); the --top-ports 100 mode checks only the most common ones, so it will miss a service on an unusual port. The speed is limited (for example with -T or --max-rate) so as not to overload a weak system.
From a version to a verified conclusion
Figure 2. A version only gives a hypothesis; a separate check within the rules of engagement confirms it.
Example: what a banner does and does not tell you. The server’s response to an ordinary request to the home page:
HTTP/1.1 200 OK
Server: Apache/2.4.49 (Unix)
X-Powered-By: PHP/7.4.3
Set-Cookie: PHPSESSID=...
The conclusion “this is Apache 2.4.49, so it is vulnerable” is premature. The right move: record the version, look it up in a vulnerability database: NVD (the US database of CVEs, identifiers of known vulnerabilities) and the CISA KEV catalogue (vulnerabilities already exploited in attacks) and get a candidate: for Apache 2.4.49 that is CVE-2021-41773 (path traversal): the fix in 2.4.50 turned out incomplete (CVE-2021-42013), the full fix came in 2.4.51, and the consequences depend on the server configuration (whether directories are closed with “Require all denied”, whether CGI is enabled). Then verify that the behaviour really shows up (with a safe, non-destructive request, if the rules allow it) instead of assuming. A banner can be changed or removed, and distributions often move a fix into an old version under the same number (a backport), so a version string can be both true and a false signal.
A real case. In 2017 attackers got in through Equifax’s online dispute portal, which ran on a vulnerable Apache Struts (CVE-2017-5638). According to the report of the US House committee, the security team sent a patch alert on 9 March 2017 with a 48-hour deadline, but a scan to find vulnerable systems did not find the component: as the company explained, it checked the root directory and not the subdirectory where the component sat. The attack started on 13 May and lasted 76 days, and the data of about 147 million people was affected according to the FTC. The lesson: a scan result is no better than the inventory and coverage behind it, and a test that has to find such components must check actual paths and versions, not only the home page.
Limits and caution. Active reconnaissance is noisy: an IDS and a WAF see it, and aggressive scanning can slow down or take down a weak service, so the pace and time are agreed. Only hosts within scope are scanned, and a company’s IP range does not mean that every address in it is theirs (cloud, CDN, shared hosting). A UDP scan is slow and often incomplete. Tools (nmap, whatweb, Wappalyzer) give hypotheses, not facts.
Common mistakes.
Writing “vulnerable because the version is old” in a report without confirming it: a false finding undermines trust in the rest.
Scanning only the most common ports and missing an admin panel on a non-standard one.
Running a full aggressive scan at peak time without agreement.
Scanning addresses that do not belong to the customer (a CDN, a neighbouring tenant).
Check yourself
nmap with --top-ports 100 showed only 80 and 443, but the application has an admin panel on port 8800. Why was it not found and what should change?
Answer
The mode takes only the hundred most common ports and 8800 is not one of them. Scan all ports (-p-) or an explicit list within scope, agreeing the pace.
The header Server: nginx without a version. Does that mean there are no fingerprints?
Answer
No. The technology shows from other signs too: cookie names, error format, paths, behaviour on unusual requests, the favicon. Removing the version from the header is useful, but it only makes things harder and is not protection.
Related lessons: “Passive reconnaissance: what the internet already knows about a company”, “The application map: crawling, hidden paths, attack surface”, “CVSS 4.0, risk and prioritisation: EPSS and KEV”.
In an interview.Junior: “Active reconnaissance sends requests to the target: nmap finds open ports and service versions. It is done only within scope and with permission”. Middle/Senior: I add: a version gives only a CVE candidate that must be confirmed; backports, WAFs and hidden banners; the scan pace; the Equifax example where a scan did not cover the right directory.
The application map: crawling, hidden paths, attack surface
The attack surface is every place where an outside party can interact with a system. Examples: domains, ports, pages, API endpoints, parameters, forms, integrations and roles. The map is built by crawling, robots.txt, JavaScript files, OpenAPI and path discovery, separately for each role. What is not in the menu is often protected worse. The result is an inventory in which every item has an owner and a "checked" mark.
Pentest · Recon
The interface shows ten pages. How many addresses does the server actually serve?
A tester goes through scenarios from the menu and thinks they know the application. A pentester builds a map: all addresses, parameters, roles and APIs, including those that no link points to. What is not shown in the interface is often protected worse, because developers did not expect anyone to go there. This lesson covers how that map is built and the concept of the attack surface.
How it works and why. The attack surface is every place where an outside party can interact with a system: domains and hosts, open ports, pages, API endpoints, parameters, forms, file uploads, integrations with third-party services, user roles. The more such places there are, the more has to be checked, so reconnaissance ends in an inventory where each item has an owner and a “checked” mark.
Layers of the map
Figure 3. The map is built top to bottom, and the width of each layer depends on what was found above.
The main sources for the third and fourth layers:
Source
What it gives
Crawling (ZAP, Burp)
pages, forms, parameters
robots.txt, sitemap.xml
paths the owner mentioned
JavaScript files
API paths missing from the menu
OpenAPI / Swagger
a full list of endpoints
Wordlist guessing (ffuf)
addresses with no links
Proxy history
real requests and roles
Example: a map from three findings. First, robots.txt protects nothing: it asks search bots not to come in, and to an attacker it lists interesting paths.
Second, the file app.js contains a string with an address that is not in the menu (a made-up example):
fetch('/api/internal/v1/users?role=admin')
This is a new endpoint to check: does it require authentication, does it return other people’s data, does it tell roles apart. Third, wordlist guessing:
The -rate 20 parameter limits requests per second and -mc keeps the needed codes. If a site answers any address with 200 and a page of the same size (a so-called soft 404), every word will appear in the results. Then a filter by size is added, for example -fs 1532. The finding backup.zip of 48 KB is not opened or examined further than needed as proof: the report gets the fact of public access and the content is masked.
Forgotten and third-party assets. A separate class of findings is dangling DNS records. If the subdomain old.shop.example points by CNAME to a service where the application was long deleted, anyone can register that name at the service and show their own content under the company’s domain (subdomain takeover). The fix is to remove the record. Third-party components are checked too: analytics panels, widgets, payment forms (their owner is another party, so testing is only within scope).
A real case. In 2021 UpGuard researchers reported that more than 40 organizations, including government bodies, had exposed about 38 million records through Microsoft Power Apps portals: an OData-based API returned list data without authentication because of a default setting. At first Microsoft, according to the UpGuard report, called the behaviour by design, and later changed the settings so that new portals have table permissions enabled by default. This is not a penetration test but an example of how an attack surface (API addresses missing from the interface) stays open until someone walks through it. A tester who builds a map of an application with an API finds such endpoints before an attacker does.
Limits. A crawler will not get through where a login, complex JavaScript or a sequence of actions is required, so for each role the map is built separately with its session. A wordlist finds only what it contains. An automatic crawl may submit forms and change data (create hundreds of records), so in production it is limited or run on a test environment.
Common mistakes.
Treating robots.txt as protection: it is only a request to bots.
Building the map from the interface and one account only: endpoints of other roles stay invisible.
Not filtering soft 404 and bringing hundreds of “findings” to the report.
Taking a found archive or dump into work: it is enough to record the fact of access.
Check yourself
ffuf returned 200 for all 5000 words of the wordlist, the response size is the same (1532 bytes). What does this mean and what to do?
Answer
The site returns a stub page with code 200 for any address (soft 404). Filter the results by size (-fs 1532) or word count and only then look at the responses that differ.
Why is the finding “old.shop.example points by CNAME to a service where the application was deleted” considered serious?
Answer
Anyone can create an application with that name at the service and serve their own content on the company’s subdomain: phishing, theft of cookies scoped to the parent domain. It is fixed by removing the DNS record.
Related lessons: “Passive reconnaissance: what the internet already knows about a company”, “Active reconnaissance: ports, services, version fingerprints”, “Request and response through an attacker’s eyes: what the client controls”.
In an interview.Junior: “The attack surface is every point where an outside party can interact with a system. I build a map: crawling, JS files, API documentation, path guessing, and check each item”. Middle/Senior: I add: a map for every role, filtering soft 404 and a rate limit, forgotten assets and subdomain takeover, the Power Apps 2021 example where an open API lived outside the interface.