Skip to content
Tutorials Center
My learning

Topics

Lesson 10 of 31 ยท Scanning and Enumeration Concepts

Service and Version Enumeration

Learn how banners and version detection identify services, what Nmap scripts add, how versions map to known issues, and how to harden exposed services.

A port scan tells you that something listens on port 8080. It does not tell you what. Service enumeration answers the follow-up questions: which program, which version, which configuration. That matters because vulnerabilities belong to specific versions, and because the same port can host anything. For a defender it is the step that turns "port 22 is open" into "this is an OpenSSH release that is two years behind". For an assessor it is the bridge to vulnerability assessment.

As always: only enumerate systems you are authorized to test. The commands below are read-only on this site; the runnable examples use invented banners and a made-up advisory list.

Banners

Many services announce themselves as soon as you connect, or in their first reply. This text is the banner.

TEXT
SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13
220 mail.example.test ESMTP Postfix (Ubuntu)
HTTP/1.1 200 OK
Server: nginx/1.24.0

Banners are cheap to read and often precise, but they are self-reported. An administrator can change or remove them, and some products lie. Distribution packages also complicate things: a "patched" Debian or Ubuntu package keeps the upstream version number while back-porting the fix, so a banner showing an older number does not prove the system is vulnerable. Treat a banner as a clue.

Version detection with Nmap

nmap -sV connects to each open port, sends a series of probes from a built-in database and matches the replies against known signatures.

Terminal
nmap -sV -p 22,80,443 192.0.2.10
TEXT
PORT    STATE SERVICE  VERSION
22/tcp  open  ssh      OpenSSH 9.6p1 Ubuntu 3ubuntu13 (Ubuntu Linux; protocol 2.0)
80/tcp  open  http     nginx 1.24.0
443/tcp open  ssl/http nginx 1.24.0
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

The ssl/http entry shows that Nmap noticed a TLS layer on top of HTTP. The CPE string is a standardized name for a product, which makes it easy to look the product up in a vulnerability database. --version-intensity 0-9 controls how many probes Nmap tries: higher is slower but identifies more.

Note the difference from the previous lesson: the SERVICE column of a plain scan comes from a port-number table, but the VERSION column comes from actually talking to the service.

Scripts: more detail, handle with care

The Nmap Scripting Engine (NSE) runs small Lua scripts grouped in categories. -sC runs the default set. Examples of what scripts report: the TLS certificate and supported protocol versions, HTTP page titles and methods, SSH host key fingerprints, SMB protocol dialects. Some categories (intrusive, brute, dos, exploit) can disrupt services or guess credentials. Run them only when your authorization explicitly covers it, and never in the default sweep of someone else's production system.

Other tools in the same job: curl -I for HTTP headers, openssl s_client for TLS details, and nc (netcat) for reading a raw banner. The idea is always the same: talk the protocol, read what comes back.

Mapping services to known issues

Once you have product and version, you compare against public information:

From version to risk

Identify Product, version, CPE name.
Look up Advisories and CVE entries.
Verify Is the vulnerable code reachable?
Fix Patch, configure or remove.

A version match is a lead, not proof.

1 / 2

The risk of skipping the verify step is false positives: the package may be patched, the vulnerable feature may be disabled, or the service may not be reachable by an attacker. The reverse also happens: a hidden banner does not mean a service is safe.

Stand-in: match banners to an advisory list

The first TryIt extracts product and version from invented banners with regular expressions. This is the same kind of parsing real tools do when they identify a service.

Python Extract product and version from banners

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The second TryIt compares those results with a small, invented advisory list. The entries are fictional ranges, not real CVE data; a real workflow would query a maintained database.

Python Match services to a sample advisory list

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Two honest limits of the stand-in: it only compares numbers, so it ignores back-ported fixes, and it trusts the banner completely. A real tool has the same weaknesses, which is why results need a human to check them.

Hardening exposed services

  • Reduce what is exposed. Disable unused services; bind internal ones to localhost or a private interface.
  • Patch from your distribution's supported channel, and track end-of-life versions.
  • Trim banners where useful, such as ServerTokens Prod for Apache or server_tokens off; for nginx. This is minor hygiene, not protection. Never rely on it.
  • Disable weak protocols (old TLS versions, SSHv1, anonymous FTP) and prefer key-based SSH with root login disabled.
  • Monitor for new open ports and changed versions, so unexpected exposure shows up as a diff.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Where does the VERSION column of 'nmap -sV' come from?

    Version detection talks to the service. The plain SERVICE column of a basic scan only looks up the port number.
  2. 2. A server shows an old version number in its banner, but the package is from a distribution that back-ports fixes. What should you do?

    Back-ported fixes keep the upstream version string, so a banner match is a lead that needs checking.
  3. 3. Why should NSE categories such as brute or intrusive need explicit authorization?

    These scripts act on the target in ways that can cause outages or lockouts, so they must be covered by the rules of engagement.
  4. 4. Hiding the version in a banner makes a service:

    Changing banners is hygiene. The vulnerability is still there, and scanners can often identify the product from its behavior.

Summary

  • Service enumeration finds out what runs behind an open port: product, version and configuration.
  • Banners are quick but self-reported; nmap -sV probes and matches signatures.
  • NSE scripts add detail, but some categories are intrusive and need explicit authorization.
  • Mapping version to advisory gives leads, which must be verified for back-ports and reachability.
  • Harden by removing, patching and monitoring; trimming banners is only hygiene.
  • The Python examples use invented banners and advisories as stand-ins.

Next: Packet Capture and Analysis