skip to content

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%

answer

  1. the packet that decided the state
  2. reset, syn-ack, no-response
  3. same answer from two causes
  4. firewall rules are the real evidence

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.

solid answer

~30 s

`--reason` adds a column naming the packet that decided each state: `syn-ack` for open, `reset` for closed, `no-response` for a probe that went unanswered, or `admin-prohibited` when an ICMP type 3, code 13 error came back. That separates a silent drop from an explicit refusal. What it cannot prove is **who** answered: a firewall that returns a reset gives the same `reset` as a host with no listener, and `no-response` can be a drop or loss. Use it as evidence, then confirm with the firewall rule set, its logs and the host's own list of listening sockets.

code

bash · 2 lines
bash
# Audit of one host named in the signed scope; keep the scan from a recorded source address.
nmap -sS -p 22,443,8080 --reason -oX web01-ports.xml web01.example.internal

go deeper

for a junior

Know that --reason prints why each port got its state, and recall reset, syn-ack and no-response.

for a middle

Explain how reasons separate a drop from an explicit ICMP refusal, and why connect-scan reasons are thinner.

for a senior

Show you will not read a reason as the identity of the device that answered, and you reconcile it with firewall rules, logs and host sockets.

for a principal

Define the evidence an audit report must carry for a port state so reviewers can reproduce it, and who owns missing firewall logging.

## What --reason does By default an Nmap port table lists a port, a state and a service. `--reason` adds why: the type of packet that determined each port's state and each host's up or down verdict. It is switched on automatically by the debug option `-d`, and the reasons are stored in the XML output even when the option was not given. With `--reason`, the collapsed "Not shown" line gains the reason in parentheses, for example "59 closed tcp ports (reset)". How detailed the reason is depends on the scan. The SYN scan (`-sS`) and the SYN ping are very detailed. The TCP connect scan (`-sT`) is limited by what the operating system's `connect` call reports back, so its reasons are coarser. ## Reasons you meet on a SYN scan | Reason | State it usually sets | Meaning on the wire | |---|---|---| | `syn-ack` | open | The target answered the SYN with SYN/ACK | | `reset` | closed | The target (or something answering for it) sent a RST | | `no-response` | filtered | Nothing came back after the retries | | `admin-prohibited` | filtered | An ICMP destination-unreachable, code 13 (administratively prohibited) arrived | A second `filtered` row with a different reason is the useful discovery: the same state can come from a silent drop or from an explicit ICMP refusal, and those point at different rule actions on the device in front of the host. ## A worked reading ``` PORT STATE SERVICE REASON 22/tcp filtered ssh no-response 443/tcp open https syn-ack 8080/tcp closed http-proxy reset ``` Port 22 drew no packet at all after the retries, so something dropped the probe, or the reply, or the network lost it. Port 443 answered with SYN/ACK. Port 8080 drew a RST: the probe reached something that refused it. The table does not say whether that something was the host or a device acting for it, which is exactly the question the firewall's rule set and the host's socket list settle. ## What the reason does not prove A reason names the packet Nmap received. It does not name the device that sent it. - **A reset is not proof of a listener-free host.** A firewall configured to reject can answer with a reset on behalf of the host. The port then reads `closed` with reason `reset` while a firewall is in fact deciding the answer. - **No response is not proof of a drop.** Congestion, a rate limit, a mis-routed return path and a stateful device that lost state all produce the same silence. - **An ICMP error may come from a router.** `admin-prohibited` tells you something along the path refused; it does not say it was the host's own firewall. - **One vantage point is one view.** A reason seen from the office network says nothing about the same port seen from outside. ## A short verification routine 1. Run the scan from a recorded vantage point with `--reason`, inside the signed scope. 2. Group ports by state and then by reason, so mixed causes inside `filtered` are visible. 3. Ask the owner for the firewall rule set and match the log entries (if logging is on) against the probe times. 4. Compare with the host's own listing of listening sockets for every `open` and `closed` port. 5. Record the disagreements, not just the table. ## Defender's side An engineer comparing a report with a firewall log wants the reason column. A port that read `no-response` should line up with a drop entry or with no entry at all; a port that read `admin-prohibited` should line up with a reject entry. If the log shows nothing for either, the filtering device may not log, or the device that answered is not the one that was audited. Either way the next step is a documented change to logging or to the audit scope, not a guess about which device is at fault. ## Common mistakes - Taking `reset` as proof that no filter exists. - Taking `no-response` as proof of a deliberate drop. - Reading the reason as the identity of the responding device. - Discarding the XML output, which holds the reasons even when `--reason` was not typed.

  • Why are --reason results thinner on a TCP connect scan?
    The connect scan asks the operating system to complete a connection and sees only what the connect call reports, such as success or refusal. A SYN scan reads raw replies, so it can name SYN/ACK, RST or an ICMP error. The reference guide says the reason detail depends on the scan type.
  • What two causes can sit behind a filtered port, and how does --reason separate them?
    A device may drop the probe, giving no-response, or refuse it with an ICMP error, giving a reason such as admin-prohibited. The reason shows which happened, so you can ask the firewall owner whether the rule is a drop or a reject.
  • You see closed with reason reset on a port the firewall owner says is blocked. What now?
    Treat the mismatch as a finding, not as an error in the scan. Check whether the rule rejects with a reset, whether the rule applies on this path, and what the host's own socket list says. Report the vantage point with the result.

A closed port is like a returned letter stamped 'no such addressee': it proves somebody answered, not whether the building's mailroom or the building itself wrote the stamp. A filtered port is a letter that never comes back, which could be a bin or a lost van.

  • A reset proves nothing sits in front of the host.
  • No-response always means a deliberate firewall drop.
  • --reason names the device that answered.
  • --reason must be typed or XML has no reasons.
  • Connect and SYN scans give identical reason detail.