skip to content

Port & Service Detection

Nmap reports six port states, and the gap between closed and filtered is an inference about a firewall, not a fact. It also covers -sV, where you explain how Nmap pins a port to an nginx version.

on this pageshow

questions

6

In an Nmap report with 443 open, 22 filtered, 8080 closed and 53 open|filtered, what does each state imply about the firewall?

level: juniorimportance: must knowfreq 52%

answer

  1. more than open and closed
  2. states describe Nmap's view
  3. closed answered, filtered stayed silent
  4. some states need particular scans

basics

~20 s

Nmap reports six states: open, closed, filtered, unfiltered, open|filtered and closed|filtered. Closed means the host answered and nothing listens; filtered means a filter hid the answer. Each describes what Nmap saw, not the port itself.

solid answer

~40 s

Nmap recognises **six** port states. `open` means an application accepts connections or datagrams. `closed` means the port is reachable and answers, but nothing listens. `filtered` means packet filtering stopped the probes, so open versus closed is unknown. `open|filtered` is silence, typical of UDP and the FIN, NULL and Xmas scans. `unfiltered` comes only from the ACK scan and `closed|filtered` only from the idle scan. In the report, 443 is served, 8080 is reachable with no listener, 22 sits behind a filter and 53 is undecided. Each state is a view from one vantage point, so the same host can read differently from another network.

code

bash · 3 lines
bash
# Authorised audit of one server named in the signed scope.
# TCP and UDP ports in one run: -sS for TCP, -sU for UDP.
nmap -sS -sU -p T:22,443,8080,U:53 --reason web01.example.internal

go deeper

for a junior

Recall all six states by name and say in one line what open, closed and filtered each mean.

for a middle

Explain how closed and filtered differ on the wire, why filtered ports slow a scan, and which states only particular scans produce.

for a senior

Show that you treat every state as a result seen from one vantage point, and name the second view or log you would compare it with.

for a principal

Describe how a scanning programme records vantage point, options and date so port states stay comparable between quarters and teams.

## The six states and what each claims Nmap's reference guide lists exactly six port states. The first thing to remember is that they are **not intrinsic properties of the port**: they describe how Nmap sees it, from one place, at one moment. A scan from the same network as a server may show port 135/tcp as open while a scan at the same time from across the Internet shows it as filtered. | State | What Nmap saw | What it implies | |---|---|---| | `open` | An application accepts TCP connections, UDP datagrams or SCTP associations | A service is reachable from this vantage point | | `closed` | The port answered the probe, but nothing is listening | Reachable, no listener; also shows the host is up | | `filtered` | Packet filtering stopped the probes reaching the port | Open or closed is unknown; a router, firewall or host firewall is in the way | | `unfiltered` | Reachable, but Nmap cannot say open or closed | Only the ACK scan classifies ports this way | | `open\|filtered` | No response, in a scan type where open ports give none | UDP, IP-protocol, FIN, NULL and Xmas scans end here | | `closed\|filtered` | Nmap cannot tell closed from filtered | Used only by the IP ID idle scan | The last three states come from particular scan techniques, and which answer each technique can produce is a separate subject. Here you need the vocabulary and what it commits you to. ## Reading the four ports in the report - **443 open**: something answers. A version scan can say what it is, and the owner should confirm the service is meant to be public. - **8080 closed**: the probe was answered and no application listens. Either the host itself answered or something acting for it did (see the section on inference below). The reference guide notes that an administrator who wants such ports to give less away can block them, after which they would read as filtered. - **22 filtered**: no usable answer arrived. Most filters simply drop the probe; some reply with an ICMP destination-unreachable (type 3, code 13, communication administratively prohibited). A drop looks like packet loss, so Nmap retries, which is why filtered ports slow a scan dramatically. - **53 open|filtered**: this appears where an open port stays silent, so Nmap cannot separate "an open service that did not answer" from "a filter swallowed the probe or its reply". It is not a half-open port; it is a gap in the evidence. ## How the report presents them A default report does not list every port. Nmap collapses the most common state into a line such as "Not shown: 995 closed ports" and prints rows only for the exceptions. The `--open` option goes further: it keeps only hosts and ports in the open, `open|filtered` or `unfiltered` states and hides closed and filtered ports entirely. That is convenient for an inventory and wrong for evidence about a firewall, because a report that omits the filtered ports cannot show which ports were protected. An assessor proving a rule set keeps the full table. ## Why this is an inference about the firewall Closed against filtered is the most useful split in a report and the most over-read. A firewall that answers with a TCP reset can make a port read as `closed`, and a host-based filter can make a port read as `filtered` while the network path is wide open. The state tells you what happened to Nmap's packets, not where a rule lives or what it says. 1. Record the vantage point (the scanner's address and network) beside every report. 2. Treat `filtered` as "no evidence about the port", never as "secure". 3. Compare with the host's own list of listening sockets and with the rule set the owner supplies. 4. If a result matters, repeat from a second authorised vantage point so the difference between two network paths is visible. ## Common mistakes - Reading `filtered` as `closed`, or as proof that a firewall exists on that exact host. - Reading `open|filtered` as "probably open". - Assuming one scan covered TCP and UDP; each protocol has its own ports and its own states. - Reading the report as a property of the host rather than of the path between scanner and host. - Forgetting that the default scan probes only the 1,000 most common ports per protocol, so an unlisted port may simply not have been probed. An assessor holding a signed scope reports the states together with the scanner's address, the options used and the date, so a reviewer can reproduce the view instead of arguing about the port.

  • Why does a filtered port slow an Nmap scan down?
    A filter that silently drops probes gives Nmap nothing to react to, and a dropped probe looks like congestion. Nmap therefore retransmits several times before it gives up, and the reference guide says this slows the scan dramatically.
  • Does closed mean there is no firewall in front of the host?
    No. Closed means the probe was answered and no application listens. A firewall that answers with a reset produces the same result as a host with no listener. The firewall's own rules and logs are the evidence for what it does.
  • Why is open|filtered so common in a UDP result?
    A UDP service often sends nothing to a bare probe, and a filter also sends nothing, so silence cannot separate the two and Nmap reports open|filtered. A UDP reply marks the port open; the reference guide lists UDP among the scans that classify ports this way.

  • Filtered means closed, so the port is safe.
  • Closed ports prove no firewall exists.
  • Open|filtered means probably open.
  • Port states are permanent facts about the host.
  • Nmap has only open and closed, or five states.
open as a page

In Nmap 7.991, how does -sV pin an open port to a specific nginx version, and what do --version-intensity and softmatch change?

level: middleimportance: must knowfreq 38%

basics

~20 s

After the port scan, -sV listens for a banner on each open port, tries probes registered to that port, then others up to the chosen rarity. A match line in nmap-service-probes extracts product and version. Default intensity is 7.

open as a page

Which ports does an Nmap scan cover when no -p option is given, and how do -p-, -F, --top-ports and -p U:53,T:80 change that?

level: juniorimportance: should knowfreq 33%

basics

~20 s

With no -p option Nmap scans the 1,000 most common ports per protocol, ranked by nmap-services frequency. -p- covers 1-65535, -F cuts to 100, --top-ports n picks the n most common, and T: or U: prefixes choose TCP or UDP ports.

open as a page

In an Nmap SYN scan, what does --reason add to a closed or filtered port, and what does it still not prove?

level: middleimportance: should knowfreq 28%

basics

~20 s

--reason prints the packet type that set each port's state, such as reset for closed or no-response for a silent drop. It shows what Nmap received, not who sent it, so a firewall reject and a genuinely closed port can look identical.

open as a page

An Nmap -sV report shows nginx 1.18.0 on 443, tcpwrapped on 8443 and http-proxy? on 8080; how far do you trust each result?

level: seniorimportance: should knowfreq 21%

basics

~20 s

Trust them differently. The nginx version is what the answering service reported. tcpwrapped means the handshake completed and the peer closed without sending data. The trailing question mark marks a name guessed from the port number, not a probed answer.

open as a page

Your web tier's Server header exposes nginx/1.18.0 to Nmap -sV; why is trimming the version a weak control, and what do you do instead?

level: seniorimportance: nice to knowfreq 14%

basics

~20 s

Trimming removes a label, not the exposure: Nmap's database still recognises a bare nginx header, other responses may carry the version, and the flaw stays. Patch, limit exposure, and use your own authorised -sV scans to check the inventory.

open as a page