CTF Arsenal
Boot2Root/Information Gathering & Enumeration

Port & Service Scanning with Nmap

Concept

Nmap maps which ports are open on a host, which services/versions are bound to them, and (optionally) the OS and running NSE scripts can flag misconfigurations. It is almost always the first command run against a Boot2Root target because every later step depends on knowing the attack surface.

When to Use

  • Start of every engagement: you have an IP and nothing else.
  • After gaining a new pivot point and needing to re-scan from a new vantage.
  • When a walkthrough says 'enumerate thoroughly' — a full-port scan often reveals a service hidden above port 1024.

Workflow

  1. 1
    Quick top-1000 TCP scan

    Fast triage to see what's obviously open.

  2. 2
    Full TCP port sweep (1-65535)

    Catch non-standard ports a quick scan misses.

  3. 3
    Version/service detection on open ports

    -sV against the exact ports found, not a blind rescan.

  4. 4
    Targeted NSE scripts per service

    e.g. http-enum, smb-os-discovery once you know the service.

  5. 5
    UDP scan if TCP surface looks thin

    Common CTF services: SNMP (161), TFTP (69), DNS (53).

Commands

nmap -sC -sV -oN FILE_PATH TARGET_IP
nmap -sC -sV -oN initial.nmap 10.10.11.25

Default-script + version scan of the top 1000 TCP ports. Good first pass.

  • -sC — Run default NSE scripts (safe category) — banner grabbing, basic vuln checks.
  • -sV — Probe open ports to determine service/version.
  • -oN FILE_PATH — Save normal-format output to a file for later reference/grep.

When to use: Immediately after you have a target IP, before anything else.

Expected output:

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1
80/tcp open  http    Apache httpd 2.4.41

Look for: Unusual services, old version strings (search for known CVEs), odd ports (8080, 8443, 2049, 3306).

Next step: Run a full-port scan in parallel; begin manual enumeration of each service found here.

nmap -p- --min-rate=1000 -oN FILE_PATH TARGET_IP
nmap -p- --min-rate=1000 -oN full-tcp.nmap 10.10.11.25

Scans all 65535 TCP ports, sending packets fast, to avoid missing high ports.

  • -p- — Scan all ports 1-65535 instead of the default top 1000.
  • --min-rate=1000 — Send at least 1000 packets/sec; speeds up large scans. Lower it on unstable networks/VPNs.

When to use: Always run this in a CTF — many boxes hide a service above port 1024 deliberately.

Expected output:

A list of all open ports, potentially more than the top-1000 scan returned.

Look for: Any port not seen in the quick scan.

Next step: Re-run -sC -sV against exactly the new ports: nmap -p PORTS -sC -sV TARGET_IP.

sudo nmap -sU --top-ports 100 TARGET_IP
root
sudo nmap -sU --top-ports 100 10.10.11.25

Scans the top 100 UDP ports. UDP scanning is slow and often needs root for raw sockets.

  • -sU — UDP scan instead of TCP.
  • --top-ports 100 — Limit to the 100 most common UDP ports to keep scan time reasonable.

When to use: When TCP surface is sparse (e.g. only SSH) — UDP services like SNMP or TFTP are common CTF pivots.

Expected output:

161/udp open  snmp

Look for: open|filtered is ambiguous on UDP; open (confirmed) is the signal to investigate.

Next step: Enumerate the specific UDP service (e.g. snmpwalk for SNMP).

nmap --script=vuln -p PORTS TARGET_IP
nmap --script=vuln -p 80,443 10.10.11.25

Runs the NSE 'vuln' script category against specified ports to flag known vulnerability signatures.

  • --script=vuln — Loads all NSE scripts tagged 'vuln' (can be noisy/slow).

When to use: After initial recon, as a broad vulnerability-signature sweep — treat hits as leads, not proof.

Expected output:

| http-vuln-cve2017-5638: VULNERABLE

Look for: Any line marked VULNERABLE; verify manually before relying on it.

Next step: Research the specific CVE/finding and confirm manually (exploit-db, vendor advisory).

Tools

Nmap

Host/port/service discovery and scripted enumeration.

When to use: First tool against any new host or IP range.

nmap [scan type] [options] TARGET_IP
  • -A — Aggressive: OS detection, version detection, script scan, traceroute. Noisy.
  • -T4 — Faster timing template; fine on local CTF networks.

Example workflow: Quick scan -> full TCP sweep -> service-specific NSE scripts -> manual tool per service.

Findings & Interpretation

Interesting

  • Old software versions with public CVEs
  • Management ports (8080/8443/9090)
  • Ports typical of a specific CTF theme (e.g. 2049 NFS, 6379 Redis)

Suspicious

  • Service responding differently than its version banner suggests (possible honeypot/custom service)

False Positives

  • filtered/closed states on UDP can mean 'no response', not 'closed' — don't over-trust UDP results

How to Validate

  • Connect manually with netcat/curl to confirm the banner
  • Cross-check version against a CVE database before assuming exploitability

Next Step

  • For each open port, open the matching category (web, SMB, FTP, SSH) and run its enumeration workflow.
  • Keep a running notes file per host — every nmap result feeds the next step.

Troubleshooting

Nmap reports all ports filtered/closed.

Likely cause: Firewall dropping packets, wrong IP, or VPN/VPN routing issue.

Verify: ping TARGET_IP and check VPN connectivity (ip a, routing table).

Fix: Confirm you're on the lab VPN; try nmap -Pn TARGET_IP to skip host-discovery ping (hosts often block ICMP).

Recovery: Re-establish VPN, re-check target IP from the challenge portal.

Avoid repeating: Always add -Pn by default on CTF targets that may block ICMP.