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

Sources

Practice in the labs

Run the discovery steps in order on your own lab, keep the raw output, and turn it into an inventory.

Knowledge check

  1. 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.
  2. 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.
  3. 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.
  4. 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