Notes
The method
The method has four steps, from broad to deep. One: host discovery, to see which addresses are alive. Two: a port scan of all sixty five thousand TCP ports, plus the most common UDP ports. Three: service and version detection on the open ports. Four: enumerate each service with tools made for it. Write everything down. And repeat the whole process whenever you gain new access, because an internal position reveals services the outside never saw.
- 1. host discovery: which addresses are alive
- 2. port scan: all 65,535 TCP ports, plus top UDP
- 3. service and version detection on open ports
- 4. enumerate each service with its own tools
- write everything down repeat when you gain access
Step 1: live hosts
Step one is host discovery. The dash s n option tells Nmap to find live hosts without scanning ports. On a local network it uses ARP, which is fast and reliable. Across the internet, many hosts block ping, so a host that looks down may be up; the dash capital P n option skips discovery and scans anyway. This step turns a range of two hundred and fifty four addresses into a short list worth scanning.
nmap -sn 10.10.10.0/24 # Nmap scan report for 10.10.10.5 # Host is up (0.0004s latency). # Nmap scan report for 10.10.10.20 # Host is up (0.0006s latency). # -sn: discovery only, no port scan # local network: ARP, very reliable # internet: hosts may block ping; # use -Pn to scan anyway
Step 2: every port
Step two: scan every port. By default Nmap checks the thousand most common, and administrators often move services to unusual ports. Dash p dash scans all of them. Then run a second, slower scan with version detection and default scripts on only the open ports, which is much quicker than doing everything at once. Always save the output with dash o capital A. On this lab host we found four ports, including one on eighty eighty one that a default scan would miss.
nmap -p- --min-rate 1000 -oA full \ 10.10.10.20 # 22/tcp open # 80/tcp open # 445/tcp open # 8081/tcp open nmap -sV -sC -p 22,80,445,8081 \ -oA detail 10.10.10.20
Step 3: versions
Step three turns ports into leads. Version detection reports the product and exact version, and the default scripts add detail: page titles, the operating system, supported options. On this lab host we see an old OpenSSH, an old Apache, a Samba file server from twenty sixteen, and an administration console on the unusual port. Exact versions can be matched against known vulnerabilities, and an administration console is always worth a closer look.
22/tcp open ssh OpenSSH 7.2p2 80/tcp open http Apache 2.4.18 |_http-title: Welcome to the shop 445/tcp open smb Samba 4.3.11 | smb-os-discovery: Ubuntu 16.04 8081/tcp open http Jetty 9.2 |_http-title: Admin console # old versions and an admin console: # both go to the top of the list
Step 4: web services
Step four is service by service, starting with web, the largest surface. Identify the server, framework and content system. Read the robots file, the sitemap, the page source and the JavaScript, which often list endpoints. Search for hidden paths with a content discovery tool such as ffuf or gobuster, which tries a wordlist of names. Check for other virtual hosts on the same address, API documentation left exposed, login pages with default credentials, and the TLS configuration.
- identify: server, framework, CMS (whatweb, wappalyzer)
- read: robots.txt, sitemap, page source, JS files
- find hidden paths: ffuf, gobuster, feroxbuster
- virtual hosts on the same IP
- API docs: /swagger, /openapi
- login pages and default credentials
- TLS configuration
File sharing and remote
File sharing and remote access services come next. For SMB, the Windows file sharing protocol: which shares exist, can they be listed without a password, which user names does it reveal, and is signing required. For SSH: the version and whether passwords are accepted. For remote desktop: is network level authentication required. FTP: is anonymous login allowed. NFS: which folders are exported, and to whom. The first question for every service is the same: does it need a login at all?
- SMB 445: shares, users, signing, anonymous access (smbclient, enum4linux-ng, netexec)
- SSH 22: version, auth methods
- RDP 3389: NLA required?
- FTP 21: anonymous login?
- NFS 2049: exported folders
- LDAP 389: anonymous bind?
- for each: is a login needed at all?
Infrastructure services
Then the infrastructure services, which are quiet but generous. DNS may allow a zone transfer or reveal internal names. SNMP, the device management protocol, with the default community string public, can expose a device's entire configuration, and it runs on UDP, which many people forget to scan. Mail servers may confirm which user names exist. And databases and caches such as MongoDB or Redis are, far too often, reachable from the network with no password at all.
- DNS 53: zone transfer, version, internal names
- SNMP 161/udp: community "public" exposes the whole device configuration
- SMTP 25: user checks, open relay
- databases: MySQL, Postgres, MongoDB, Redis reachable without a password?
- do not forget UDP
Notes
Note-taking is a professional skill, not an afterthought. Keep one folder per host, with the raw output of every tool. Maintain a table: host, port, service, version, notes and next step. Record the time and your source address for every action, so the client can match it to their logs. Keep a running list of every user name, share and path found, because they become inputs for later phases. The report is written from these notes.
- one folder per host; raw tool output saved (-oA)
- a table: host, port, service, version, notes, next step
- timestamps and source IP for every action
- user names, shares, paths found: one running list
- screenshots as evidence
- the report is written from these notes
The defender view
For defenders, scanning is the loudest phase of an attack. The firewall shows one source touching many ports or many hosts. An intrusion detection system such as Suricata or Zeek flags port scans and Nmap's script probes. Web logs show bursts of not found errors and paths from well-known wordlists. File servers log anonymous session attempts. Internet scanning is constant background noise. A scan that starts from inside your network is different: it usually means someone has a foothold.
- firewall: one source, many ports or many hosts, denied
- IDS (Suricata, Zeek): "port scan", Nmap script probes
- web: bursts of 404s, a tool User-Agent, wordlist paths
- SMB and LDAP: anonymous session attempts
- auth logs: logins from an unusual internal host
- internal scans matter most
Shrink what scans find
The defense is to give a scan less to find. Close or firewall everything that is not needed. Put administration interfaces behind a VPN or keep them internal. Remove anonymous access from file shares, directories, device management and databases. Change default settings. Segment the network, so a foothold on one machine sees few others. Scan yourself every week and compare with last week. And alert on scanning that starts inside the network.
- close or firewall everything that is not needed
- admin interfaces: VPN or internal only no anonymous access: SMB, FTP, LDAP, SNMP, databases
- SNMPv3; change defaults
- segment the network: a foothold should see little
- scan yourself first, weekly
- alert on internal scanning
Common mistakes
Mistakes. Scanning only the top thousand ports. Forgetting UDP. Trusting a single scan and never rescanning after gaining access. Running aggressive scans against fragile systems such as printers, medical devices or industrial equipment, which can crash. Keeping no notes and no saved output. On the defender side: dismissing internal scanning alerts as noise, and leaving exact version banners on every service.
- scanning only the top 1,000 ports
- forgetting UDP
- trusting one scan; no rescan after access
- aggressive scans on fragile systems (printers, OT)
- no notes, no saved output
- defenders: ignoring internal scan alerts as "noise"
- banners that reveal versions
Say it like this
In the interview: I run a full TCP port scan and the top UDP ports, then version detection and default scripts on what is open. Then I enumerate per service: for web, technologies, hidden content and virtual hosts; for SMB, shares, users and signing; SSH authentication methods; DNS, SNMP and databases, always checking whether anonymous access works. I save all output with timestamps, and after any new access I repeat the process from that position.
- "Full TCP port scan plus top
- UDP, then version detection
- and default scripts on open
- ports. Then per service: web
- content and vhosts, SMB
- shares and users, SSH auth, DNS, SNMP, databases, always
- checking anonymous access. I
- log everything with times."