skip to content

Nmap

Nmap is the default answer to 'what is running on that host?', so read its output past -sV. Expect questions on port states, scan-type choice and what a scan looks like to a defender.

on this pageshow

explore

questions

page 1 of 2

In Nmap 7.991, what does the -sn option do, and what does a host listed as up tell you?

level: juniorimportance: must knowfreq 48%

answer

  1. Stops after the first phase
  2. Older releases called it -sP
  3. Default probes still go out
  4. A verdict about the address
  5. Ports were never examined

basics

~20 s

-sn runs Nmap's host-discovery phase only and prints the hosts that answered a probe; no port scan follows. 'Up' means a discovery probe drew a reply. It says nothing about open ports, services or who owns the address.

solid answer

~40 s

`-sn` (called `-sP` in older releases) runs host discovery and stops: no port scan follows, and the output lists the hosts that answered a discovery probe. With no other discovery option it still sends the default probes, an ICMP echo request, a TCP SYN to port 443, a TCP ACK to port 80 and an ICMP timestamp request, and it uses ARP for targets on the local Ethernet segment. 'Up' is a host-discovery verdict, not a port result: a closed port's reset proves a host is there just as an open port does. A live host that drops every probe type you chose reads as down. Naming any probe-type option such as `-PS` or `-PE` replaces the default probes.

go deeper

for a junior

Recall that -sn is the host-discovery-only scan and that 'up' is not a port result. Be ready to say what it sends by default.

for a middle

Explain the default probe set and how an unprivileged run or a local segment changes it. Show that you read --reason rather than trusting the count.

for a senior

Treat up and down as inferences: name what a firewall, proxy ARP or a reset sent on behalf of an empty address does to them, and say what evidence you would add before correcting an inventory.

for a principal

Decide what a quarterly sweep may claim to the business: a list of answering addresses, with the probe set and vantage point recorded, never a complete asset list.

## What -sn does Nmap normally works in two phases. First it decides which targets are alive; then it port-scans only the ones it found. `-sn` keeps the first phase and drops the second, so the output is the list of hosts that answered a discovery probe and nothing about their ports. Older releases called the option `-sP`; Nmap 7.991 documents `-sn`. It is often called a ping scan or ping sweep, but it goes well beyond the `ping` tool, and traceroute or NSE host scripts can be requested alongside it. ## The probes it sends With no other discovery option, `-sn` uses the same defaults as a normal scan: - an ICMP echo request, a TCP SYN to port 443, a TCP ACK to port 80 and an ICMP timestamp request, for a privileged user and a routed IPv4 target - ARP (IPv4) or Neighbor Discovery (IPv6) for targets on the local Ethernet segment - a `connect()`-based SYN to ports 80 and 443 only, for an unprivileged Unix user - any explicit probe-type option (`-PE`, `-PS`, `-PA`, `-PU` and the like) replaces the default probes, although targets on the local segment are still found with ARP ## What 'up' tells you A host is listed as up when one probe drew an answer. Nmap does not mind which kind of answer: a reset from a closed port counts as much as a SYN/ACK from an open one. So: - **Up is not a port result.** No port was examined, and an up host may run no service at all. - **Up is not identity.** A router doing proxy ARP, or a firewall that sends resets for addresses it guards, can make empty addresses look occupied. - **Down is not empty.** It means none of the probes you chose was answered. For a single host Nmap prints a note suggesting `-Pn`. - **`--reason` names the evidence.** It shows the packet that decided each host, for example `echo-reply` or `arp-response`. ## Reading the output Each listed host gets a report block. With `--reason` the status line names the deciding packet and, for a reply that carries one, its TTL: ``` Nmap scan report for host1.example.internal (192.0.2.10) Host is up, received echo-reply ttl 63 (0.0021s latency). ``` Without `-v`, addresses that did not answer are simply not listed; with `-v` they appear marked `[host down]`. For an inventory, run with `-v` so that silent addresses are recorded as silent rather than absent, and keep the XML output so the run can be diffed against last quarter's. ## What it looks like to the receiving side Every address in the range receives the default probes in a short burst. A sweep is routine administration, but the recipient cannot tell an authorised sweep from an unauthorised one by the packets alone; the signed scope, the source address and the time window do that. The sweep is also one step more intrusive than a list scan, which is why it belongs inside the agreed scope and window. ## Beside its neighbours | Option | Sends packets to the targets? | Port scan afterwards? | |---|---|---| | `-sL` | No, only name lookups | No | | `-sn` | Yes, discovery probes | No | | no option | Yes, discovery probes | Yes, on hosts found up | | `-Pn` | No discovery probes (ARP still runs locally) | Yes, on every address | ## Using it in an audit 1. Put the range in the written scope first; a sweep sends packets to every address in it, so it needs the same authorisation as a port scan. 2. Run `-sn --reason` against the range and keep the XML output as the evidence. 3. Compare the result with the asset register, treating each difference as a question rather than an answer. 4. Chase gaps with different probe types or a different vantage point before reaching for `-Pn`. An administrator uses `-sn` to count live machines or watch server availability; the reference guide notes it is more reliable than pinging the broadcast address, because many hosts do not reply to broadcast queries. Everything it says is an inference from replies, so a clean count that matches the register proves less than it seems.

  • Why can the same -sn run report different hosts from the target's own LAN than from a routed network?
    On the local Ethernet segment Nmap finds hosts with ARP, which hosts do not filter the way they filter ICMP or TCP. From a routed network the ICMP and TCP probes cross firewalls and host filters, and any probe type they drop produces a 'down' for a live host.
  • Can -sn do more than list live hosts?
    Yes. The reference guide says traceroute and NSE host scripts can be requested with it, and any probe-type options can be combined with it. Without those it prints only the hosts that answered, with their reverse-DNS names when they have one.

  • -sn is passive and sends nothing to the targets
  • A host listed as up has open ports or services
  • Down means the address is unused or powered off
  • -sn is only an ICMP echo, the same as ping
  • -sn still port-scans the hosts it finds
open as a page

In Nmap 7.991, what does -sC run, and does using the default script set make a scan safe for production?

level: juniorimportance: must knowfreq 42%

basics

~20 s

-sC is shorthand for --script=default: every script filed under the default category runs. The authors chose that set for speed and low noise, but the reference guide still says not to run it against a network without permission.

open as a page

In Nmap 7.991, how does the -O option arrive at an operating-system guess, and why is the answer a guess and not a fact?

level: juniorimportance: must knowfreq 45%

basics

~20 s

Nmap -O sends crafted TCP, UDP and ICMP probes and compares how the target's IP stack answers with the reference fingerprints in nmap-os-db. That is an inference from behaviour, so the result is a hint with a confidence, not a fact.

open as a page

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%

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.

open as a page

In Nmap, what does a SYN scan (-sS) send, and how does it read open, closed and filtered answers from a firewalled test server?

level: juniorimportance: must knowfreq 52%

basics

~20 s

A SYN scan sends one TCP SYN per port and never completes the handshake. A SYN/ACK reply means open, a RST means closed, and silence or an ICMP unreachable error means filtered. It is Nmap's default for privileged users.

open as a page

In Nmap 7.991, what do the six -T timing templates from paranoid (-T0) to insane (-T5) change, and which one runs by default?

level: juniorimportance: must knowfreq 45%

basics

~20 s

Nmap's -T option takes 0 to 5 or a name: paranoid, sneaky, polite, normal, aggressive, insane. -T3 normal is the default. -T0 to -T2 serialise probes with a delay between them; -T4 and -T5 shorten timeouts and retries for speed.

open as a page

In Nmap 7.991 with no host discovery option given, which probes does Nmap send to each target, and when do they differ?

level: middleimportance: must knowfreq 34%

basics

~20 s

A privileged run against a routed IPv4 target sends an ICMP echo request, a TCP SYN to 443, a TCP ACK to 80 and an ICMP timestamp request. Local Ethernet targets use ARP; an unprivileged user sends connect() SYNs to 80 and 443.

open as a page

Why does Nmap 7.991 OS detection want one open and one closed TCP port, and what does --osscan-limit do when a host lacks them?

level: middleimportance: must knowfreq 33%

basics

~20 s

Some probe sets need a listening TCP port and others a closed one, so without both Nmap has fewer tests to compare. It still runs and warns that results may be unreliable; with --osscan-limit it skips that host instead.

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

Why would an assessor choose Nmap's SYN scan over the TCP connect scan, and what changes in privilege, packets and target logs?

level: middleimportance: must knowfreq 46%

basics

~20 s

-sS sends raw SYN packets, needs raw-packet privilege and never completes the handshake. -sT asks the operating system to connect(), needs no privilege, but completes connections to open ports, so it is slower and more likely to be logged.

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

What parts make up an NSE script file, and how do prerule, hostrule, portrule and postrule decide when its action runs?

level: middleimportance: should knowfreq 18%

basics

~20 s

An NSE script is a Lua file with descriptive fields such as description and categories, at least one rule function and an action. The action runs only when a rule returns true: prerule before scanning, hostrule per host, portrule per port, postrule at the end.

open as a page

In Nmap, how do you preview which scripts a --script expression such as "safe and not http-*" would select, and how do arguments reach them?

level: middleimportance: should knowfreq 24%

basics

~10 s

--script-help takes the same specification as --script and prints each matching script's name, categories and description, without scanning. Arguments go in through --script-args name=value,... or --script-args-file, and a command-line value supersedes the file.

open as a page

An Nmap 7.991 -O run prints 'No exact OS matches' with no candidate list; what does that mean, and what does --osscan-guess add?

level: middleimportance: should knowfreq 28%

basics

~20 s

'No exact OS matches' means no reference fingerprint fitted every measured test. --osscan-guess (alias --fuzzy) makes Nmap list near-matches as 'Aggressive OS guesses', each with a percentage that is a similarity score, not a probability.

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

Why do filtered ports dominate an Nmap scan's duration, and what do --max-retries and --host-timeout give up to shorten it?

level: middleimportance: should knowfreq 24%

basics

~20 s

A port that never answers makes Nmap wait out a timeout and retransmit, up to ten times by default. --max-retries cuts the retries and risks missed ports; --host-timeout abandons a slow host entirely, with no port table, OS or version results for it.

open as a page

Why can -T5 or a high --min-rate cost accuracy in Nmap 7.991, and what do you do when two scan runs disagree?

level: middleimportance: should knowfreq 33%

basics

~20 s

-T5 shortens round-trip timeouts to 300 ms and allows only two retransmissions, so slow or lost replies are read as silence. A high --min-rate can do the same through congestion. Treat disagreeing ports as unproven and rescan them at default timing.

open as a page

An authorised Nmap sweep of a /22 finds far fewer hosts than the asset register lists; how do you use --reason and the discovery options to find out why?

level: seniorimportance: should knowfreq 22%

basics

~20 s

'Down' only means no probe was answered. Re-run with --reason, check known-live hosts to see which probe types get through, then add suitable probe types or scan from inside the segment before reaching for -Pn.

open as a page

What does Nmap's -Pn option change in a scan of a /22, and why is it an expensive fix for hosts that read as down?

level: seniorimportance: should knowfreq 27%

basics

~20 s

-Pn skips host discovery and treats every address as up, so the requested scans run against all 1,024 addresses of a /22, empty ones included. It costs time and noise and fills the report with phantom hosts; fix the probe set first.

open as a page

A change board asks which NSE script categories may run against production hosts in an authorised audit; what do you allow, and what does the safe label not promise?

level: seniorimportance: should knowfreq 33%

basics

~20 s

Allow only previewed scripts in the safe category, and require separate written authorisation for intrusive, brute, dos, exploit and fuzzer. Safe is the author's own label, not a guarantee, and it says nothing about scripts that send data to third parties.

open as a page

An Nmap vuln script prints State: LIKELY VULNERABLE under a VULNERABLE: heading on one host and nothing on another; what does each result actually prove?

level: seniorimportance: should knowfreq 29%

basics

~20 s

LIKELY VULNERABLE means the script found indirect evidence, such as a version or uptime comparison, not a confirmed flaw, and the VULNERABLE: heading also covers it. Silence proves nothing: scripts normally report only positives and may not have run.

open as a page

An Nmap -O scan of an unidentified appliance's address returns a firewall's OS match; why might something else sit behind it, and how do you record the entry?

level: seniorimportance: should knowfreq 20%

basics

~20 s

Each probe is answered by whichever device holds the address, so a firewall, proxy or load balancer can be fingerprinted instead of the host behind it. Record the result as an observed hint with its confidence and source, then verify it another way.

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

What does an authorised Nmap ACK scan (-sA) of a firewalled test server map when it reports ports unfiltered and filtered, and why can it never report open?

level: seniorimportance: should knowfreq 20%

basics

~20 s

An ACK scan sends bare ACK segments. A reset, from open and closed ports alike, means unfiltered; silence or an ICMP unreachable error means filtered. It maps what the rule set lets through, never which ports are open.

open as a page

Why is an authorised Nmap UDP scan (-sU) of a firewalled test server so slow, and why does it list most ports as open|filtered?

level: seniorimportance: should knowfreq 26%

basics

~20 s

A UDP scan sends a datagram per port, and only a UDP reply (open) or an ICMP port unreachable (closed) is conclusive. Silence is reported open|filtered, and retransmissions plus rate-limited ICMP errors make the scan slow.

open as a page

An assessor with a signed scope must run an Nmap scan of a fragile production /24 without disturbing it. Which pacing options and scan choices do you set, and how do you confirm the limit held?

level: seniorimportance: should knowfreq 28%

basics

~20 s

Run the lightest scan that answers the question: no version detection or scripts, a canary first. Cap the global rate with --max-rate, space probes to fragile hosts, bound the run with --max-retries and --host-timeout, then check the observed rate.

open as a page

What does Nmap's list scan -sL send to the targets, and why run it before an authorised sweep?

level: middleimportance: nice to knowfreq 15%

basics

~20 s

-sL sends no packets to the target hosts: it expands the target specification and, by default, reverse-resolves each address through DNS. The names and the total let you confirm the scope is the intended network before any probe is sent.

open as a page

In a web server's access log, what does the Nmap Scripting Engine's default User-Agent tell the owner, and what can it not prove?

level: middleimportance: nice to knowfreq 12%

basics

~20 s

Scripts that use Nmap's HTTP library send the User-Agent Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/book/nse.html) by default, a good hint of an NSE web script. It is a client-chosen header, so match source and time to the scan ticket and never read its absence as proof.

open as a page

Why do Nmap's FIN, NULL and Xmas scans (-sF, -sN, -sX) report a Linux host mostly open|filtered but a Windows host all closed?

level: middleimportance: nice to knowfreq 14%

basics

~20 s

NULL, FIN and Xmas probes carry no SYN, RST or ACK bit. An RFC 793-compliant stack resets them on closed ports and drops them on open ones: reset means closed, silence means open|filtered. Stacks that always reset make every port look closed.

open as a page

Which Nmap discovery run sends each address an ICMP echo, a TCP SYN to 443, a TCP ACK to 80 and an ICMP timestamp request, and what can a firewall admin conclude from it?

level: seniorimportance: nice to knowfreq 17%

basics

~20 s

A privileged Nmap run with no discovery option, or -sn, equal to -PE -PS443 -PA80 -PP. The admin can conclude a host-discovery sweep came from that source, not who ran it, whether it was authorised or what follows.

open as a page

showing 1–30 of 34