Discover and identify: hosts, ports, services and versions
Unit 2 of 5 in Testing networks and hosts.
You will be able to run a repeatable discovery method on a network you own, read the six port states, and say what a service name or version string does and does not prove.
Lesson
Find what is alive before you look closely
The Nmap guide says one of the first steps of any network reconnaissance is to reduce a large set of address ranges to a list of active or interesting hosts, because scanning every port of every address is slow and usually unnecessary. What counts as interesting depends on the purpose: an administrator may only care about hosts running a certain service, while a security auditor may care about every device with an address.
NIST describes two ways to discover hosts. Passive discovery uses a sniffer to record the addresses of active hosts without sending a single probing packet; it takes longer, and hosts that send nothing during the watch may not be reported. Active discovery sends packets such as ICMP pings to get responses; it is quick, it can be run from a different network, and it tends to generate network noise. Whichever you choose, your scope decides which addresses you may touch, and your plan decides how much noise is acceptable.
Six port states, and what they actually say
Nmap divides ports into six states: open, closed, filtered, unfiltered, open|filtered and closed|filtered. An open port has an application actively accepting connections. A closed port is reachable and answers probes, but nothing is listening. A filtered port is one where packet filtering, from a firewall device, router rules or host firewall software, stops Nmap's probes reaching it, so Nmap cannot tell whether it is open.
The guide stresses that these states are not intrinsic properties of the port but describe how Nmap sees it. A scan from the same network might show a port open while a scan from across the internet shows it filtered. That is why a finding must say where the scan ran from. It also explains how the firewall lab works: the same port can be closed from one zone and filtered from another, and both are correct readings.
A port number is a guess; a version is a lead
NIST explains that many scanners use a services file that maps common port numbers to typical services, so an open port 80 is reported as a web server, but that additional steps are needed before this can be confirmed. Version scanning interrogates the port and compares its answers with a database; banner grabbing, which captures the text a service announces when a connection opens, is a well-known form. NIST says version scanning is not foolproof, because an administrator can alter banners, yet far more accurate than relying on the services file.
The Nmap guide agrees about the lookup: it is usually accurate, but you should not bet your security on it, because people do run services on strange ports. It adds why versions matter: an accurate version number helps dramatically in working out which known flaws a server may have. A version is therefore a lead. It tells you what to check, not what is wrong. The banner lab builds a table that records what a service claims, what a probe detected and what you verified on the machine, kept apart.
A scanner lists; you interpret
NIST is plain about the limits. Port scanners identify active hosts, operating systems, ports, services and applications, but they do not identify vulnerabilities; extra investigation is needed to confirm insecure protocols such as telnet, unauthorized applications and vulnerable services. It says the scanning is highly automated but the interpretation of the data is not. It also notes that devices that did not respond, because a firewall shields them or they are turned off, will not appear in the results, and that OS fingerprinting is not foolproof.
The same section suggests a practical habit: combining a tool's XML output, a little scripting and a database gives you a way to monitor for unauthorized services and machines. The inventory lab does exactly that with a short script, and the next unit builds on the list it produces.
Key points
- Find live hosts first; passive discovery is quiet and slow, active discovery is quick and noisy.
- Port states describe how the scanner sees a port from where it stands: say where you scanned from.
- A service name from a port number is a guess; a version is a lead; verify on the machine.
- A port scan does not find vulnerabilities and silent devices will be missing: interpretation is your job.
Sources
- NIST SP 800-115: Technical Guide to Information Security Testing and Assessment (full text)
- Nmap Reference Guide: Host Discovery
- Nmap Reference Guide: Port Scanning Basics
- Nmap Reference Guide: Service and Version Detection
Practice in the labs
Run the discovery steps in order on your own lab, keep the raw output, and turn it into an inventory.
- Discover what's running with Nmap — on your OWN lab machine: Your first scan of a machine you own: open, closed and filtered, and service and version detection.
- Master Nmap: choose the right scan for the job: You compare scan types, timing and when scripts help, so you pick a scan for a reason instead of running the biggest one.
- Build a repeatable enumeration methodology for your OWN lab — the same checklist every time, and the traces it leaves a defender: You write a checklist and a two-stage scan script (fast all ports, then identify only the open ones) and see your own scans from the defender's side.
- Turn Nmap XML into an asset inventory with a short Python script: A short script turns any number of Nmap XML files into a sorted CSV of open services with a note on cleartext ones.
- Check what a service banner claims against what is actually running: You record claimed, detected and verified separately for every service and rate your confidence in each identification.
Knowledge check
- A scan from inside your lab shows a port open. A scan from outside the router shows it filtered. What does that mean? Answer: Both are correct readings: port states describe how the scanner sees the port from where it is. Nmap's guide says port states are not intrinsic properties of the port but describe how Nmap sees them, so the viewpoint belongs in the finding.
- What does NIST say about a scanner that reports a web server because port 80 is open? Answer: It is a guess from a services file; additional steps are needed before it can be confirmed. NIST says scanners often use a file of common port numbers and that more steps are needed to confirm the service.
- Why is a version string a lead and not a finding? Answer: It tells you what to check; banners can be altered and a version alone does not prove a weakness is present. NIST says version scanning is not foolproof because administrators can alter banners, and that a scanner lists versions while confirming a weakness needs more.
- Which statement about passive network discovery matches NIST? Answer: It records active hosts without sending probing packets, but takes longer and may miss quiet hosts. NIST describes passive discovery with a sniffer as slower, silent and limited to hosts that send or receive traffic during the watch.
Back to the syllabus or see all classes.
Related
- Testing networks and hosts
- Discover what's running with Nmap — on your OWN lab machine
- Master Nmap: choose the right scan for the job
- Build a repeatable enumeration methodology for your OWN lab — the same checklist every time, and the traces it leaves a defender
- Turn Nmap XML into an asset inventory with a short Python script
- Check what a service banner claims against what is actually running
- All classes
- Free cyber labs