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
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.