Find a course

Module 2: Methodology, Reconnaissance and ScanningLesson 5 of 1016 min

Scanning, Enumeration and Known Vulnerabilities

Understand ports and the TCP handshake, how scanners find open services and versions, and how CVE identifiers and CVSS scores describe known flaws.

Step 1 of 11Learn

Knocking on doors

Once reconnaissance has produced a list of in-scope addresses, the tester needs to know what's actually running on them. That's scanning: sending carefully crafted network traffic and interpreting the responses.

Network services listen on ports, numbered 0 to 65,535 for each of the two main transport protocols, TCP and UDP. A port is like an apartment number in a building whose street address is the IP address. Ports 0–1023 are well-known ports, assigned to common services:

PortService
22SSH, remote command-line login
25SMTP, email between servers
53DNS
80HTTP, unencrypted web
443HTTPS
445SMB, Windows file sharing
3306MySQL database
3389RDP, Windows Remote Desktop

Every open port is a potential entry point, so the set of exposed services forms much of an organization's attack surface. A database port or a Remote Desktop port reachable from the whole internet is a frequent and serious finding; such services should usually sit behind a VPN or be restricted to specific addresses.

The best-known open-source scanner is Nmap, first released in 1997, used by both attackers and network administrators. Scanning is active reconnaissance: it's noisy, it's logged by firewalls and intrusion detection systems, and it requires authorization.

Step 2 of 11Practice · Match the pairs

Match each port to its usual service.

Tap an answer, then tap the place where it belongs (or drag it there).

  1. 22
  2. 443
  3. 3389
  4. 53
  5. 445

Step 3 of 11Learn

The TCP handshake and port states

Most services use TCP, which starts every connection with a three-way handshake:

  1. The client sends a SYN (synchronize) packet: I'd like to connect to port 443.
  2. If the port is open, the server replies SYN-ACK: OK, I acknowledge, here's my synchronize.
  3. The client sends ACK: Acknowledged. The connection is established.

If nothing listens on the port, the server typically replies with RST (reset): nobody here. If a firewall silently drops the packet, the client gets no reply at all.

Scanners use these behaviors to classify each port:

  • Open: a service is accepting connections (SYN-ACK received).
  • Closed: the host is reachable, but nothing listens on that port (RST received).
  • Filtered: no response or an error message, usually because a firewall is blocking the probe, so the scanner can't tell whether the port is open.

A SYN scan, sometimes called a half-open scan, sends a SYN, notes the response, and never completes the handshake, which is fast and was once less likely to be logged by applications. A connect scan completes the full handshake using the operating system's normal connection function.

UDP has no handshake, so UDP scanning is slower and less certain: an open UDP port often just doesn't answer, which looks the same as a filtered one.

TCP three-way handshake, and what a scanner learns from the replyClient / scannerServer port 4431. SYN: "I’d like to connect"2. SYN-ACK: port is OPEN3. ACK: connection establishedRST instead of SYN-ACK = closed. No reply at all = filtered (firewall drop).

Step 4 of 11Practice · Sort into groups

Classify the port state from each response to a SYN probe.

Tap an item, then tap its group (or drag it there).

Step 5 of 11Learn

Enumeration: what exactly is running?

Knowing that port 443 is open is a start. Knowing it runs a particular web server version on a particular operating system, with a login page for a specific product, is far more useful. That deeper probing is enumeration.

Techniques include:

  • Banner grabbing: many services announce themselves when you connect. An SSH or mail server's greeting often includes the software name and version.
  • Service and version detection: scanners send a series of probes and match responses against databases of known fingerprints.
  • Operating system fingerprinting: subtle differences in how systems implement TCP/IP reveal the likely OS.
  • Application-level enumeration: listing website directories, finding API endpoints, discovering shared folders, or querying directory services for user and group names when the rules allow it.

Scanning has costs that must be planned. Scanning every one of the 65,535 TCP ports on every host takes time, especially at polite speeds that don't overwhelm fragile devices. Many scans start with the most common ports, then expand.

All of this produces an inventory: hosts, ports, services and versions. The next question is whether any of those versions have known weaknesses.

Step 6 of 11Try the calculator

Scan time estimator

Estimate how long a scan takes at a steady probe rate. Polite scans of production networks often run far below maximum speed.

Total probes
256,000
Time (minutes)
8.5 min
Time (hours)
0.14 h

Step 7 of 11Practice · Work it out

A tester must scan all 65,535 TCP ports on 10 hosts at a polite 1,000 probes per second, one probe per port. Roughly how many minutes will this take? Round to the nearest minute.

Step 8 of 11Note

Step 9 of 11Learn

CVE and CVSS: naming and rating known flaws

Once you know a service's version, you can check whether it has publicly known vulnerabilities.

CVE (Common Vulnerabilities and Exposures), run by the MITRE Corporation with US government sponsorship, assigns each publicly disclosed vulnerability a unique ID in the form CVE-year-number, such as CVE-2017-0144, the Windows SMB flaw exploited by the WannaCry ransomware. A CVE ID lets vendors, scanners, researchers and defenders refer to exactly the same issue. Tens of thousands of new CVEs are published each year.

CVSS (Common Vulnerability Scoring System) rates a vulnerability's severity from 0.0 to 10.0 based on characteristics such as how it can be reached (over the network or only locally), how complex the attack is, whether privileges or user interaction are needed, and the impact on confidentiality, integrity and availability. Scores map to ratings:

ScoreRating
0.0None
0.1–3.9Low
4.0–6.9Medium
7.0–8.9High
9.0–10.0Critical

The US National Vulnerability Database (NVD) publishes CVEs with scores, and CISA's Known Exploited Vulnerabilities catalog lists flaws attackers are actively using, a powerful signal for what to patch first.

Vulnerability scanners automate the matching of discovered versions against these databases. Their results need human checking: scanners report false positives, for example when a vendor has backported a fix without changing the version number, and they miss flaws in custom applications entirely.

CVSS severity ratings on the 0–10 scaleLow0.1–3.9Medium4.0–6.9High7.0–8.9Critical9.0–10012345678910

Step 10 of 11Practice · Choose one

A vulnerability has a CVSS base score of 7.5. Which standard rating does it receive?

Step 11 of 11Practice · Choose one

A vulnerability scanner reports a critical flaw on a server based only on the version number in its banner. What should the tester do before reporting it as confirmed?