Guide
Nmap Network Security Assessment Lab
This guide documents a practical network security assessment workflow using Nmap. The purpose of the lab is to identify exposed services, understand what is running on a target system, review possible risks, and document remediation actions.
The lab focuses on common services such as FTP, SSH, Telnet, and SMB. These services are useful for learning because they are often seen in real environments and can create security risk if they are outdated, exposed, or misconfigured.
Nmap should only be used against systems, networks, or lab environments where scanning has been authorised.
Step 1
Define the Assessment Scope
Before running any scan, the target scope should be clearly defined. This prevents accidental scanning of systems that are not part of the lab or assessment.
A small list of approved targets can be saved as an environment variable:
export TARGETS="192.168.1.1 192.168.1.2 192.168.1.3"
For a controlled lab subnet, the scope can also be written like this:
export TARGETS="192.168.1.0/24"
Keeping the target list clear makes the assessment easier to repeat and document.
Step 2
Install and Verify Nmap
Nmap can be installed on most Linux systems using the package manager. After installation, the version should be checked to confirm that the tool is working correctly.
sudo apt update
sudo apt install nmap
nmap --version
This confirms that Nmap is ready for port scanning, service detection, and script-based security checks.
Step 3
Run an Initial Port Scan
The first scan checks whether key services are exposed. This lab focuses on FTP, SSH, Telnet, and SMB because they are common services that can introduce risk if not managed properly.
nmap -p 21,22,23,445 $TARGETS
Port 21: FTP file transfer service.
Port 22: SSH remote administration service.
Port 23: Telnet remote access service.
Port 445: SMB file sharing service.
Step 4
Identify Service Versions
After finding open ports, service version detection helps identify what software is running behind each port. This is useful because older versions may have known security weaknesses.
nmap -p 21,22,23,445 -sV -T4 $TARGETS
-sV: Attempts to detect service names and versions.
-T4: Uses faster timing for a controlled lab or approved assessment.
The output should be reviewed for service names, version numbers, and anything that suggests outdated or unnecessary services.
Step 5
Run Vulnerability Script Checks
Nmap includes the Nmap Scripting Engine, which can run checks against services to help identify known issues or risky configurations.
nmap --script vuln -p 21,22,23,445 $TARGETS
SMB can also be checked using SMB-specific vulnerability scripts:
nmap --script smb-vuln* -p 445 $TARGETS
Script results should not be accepted blindly. They should be reviewed, validated, and compared with the system configuration before being treated as confirmed vulnerabilities.
Step 6
Run a More Detailed Scan
A more detailed scan can collect additional information such as operating system guesses, service details, script output, and traceroute information.
nmap -A -T4 $TARGETS
-A: Enables OS detection, version detection, script scanning, and traceroute.
-T4: Increases scan speed in a controlled lab environment.
This type of scan is more active than a simple port scan, so it should only be used where it is appropriate and authorised.
Step 7
Review Common Service Risks
Once scan results are collected, the findings can be grouped by service. This makes it easier to understand the risk and decide what should be fixed first.
FTP
FTP can expose files if anonymous access is enabled or permissions are configured incorrectly. Plain FTP also does not provide strong protection for credentials.
SSH
SSH is normally preferred for remote administration, but weak configuration, outdated versions, or poor authentication controls can still create risk.
Telnet
Telnet is high risk because it sends traffic in clear text. It should normally be disabled and replaced with SSH.
SMB
SMB should be reviewed carefully because legacy versions such as SMBv1 can expose systems to known vulnerabilities and unnecessary file-sharing risk.
Step 8
Document Remediation Actions
A scan becomes more useful when the results are translated into clear actions. Each finding should include the affected service, risk, evidence, and recommended fix.
FTP: Disable anonymous access, restrict permissions, and use secure transfer methods where possible.
SSH: Keep SSH updated, disable weak ciphers, use strong authentication, and limit access to trusted users or networks.
Telnet: Disable Telnet and replace it with SSH for encrypted remote administration.
SMB: Disable SMBv1, use SMBv2 or SMBv3, apply security updates, and restrict file-sharing access.
Step 9
Record Evidence and Notes
Good documentation makes the assessment easier to review later. Useful notes include the scan date, target scope, commands used, open ports, service versions, risk rating, and remediation status.
Service: SMB
Port: 445
Risk: Medium
Finding: SMB service exposed and requires version review
Action: Confirm SMB version, disable SMBv1 if present, restrict access where possible
Status: To review
This structure keeps findings clear and makes remediation easier to track.
Detection
How a Scan Looks to a Defender
Running the scan is only half the lesson. The same activity is noisy on the target side, and knowing where it shows up is what turns recon knowledge into detection.
Host firewall and connection logs: a single source IP reaching many ports in a short window is the port-scan pattern. With Windows Filtering Platform auditing on, this appears as a burst of Event ID 5156 and 5157 (allowed and blocked connections) from one address.
Network IDS: Suricata and Snort ship rules for Nmap behaviour, and
Zeek's conn.log shows the fan-out of one host touching many services.
A version scan (-sV) or script scan is louder than a plain SYN scan
because it completes connections and sends probes, so it is easier to catch.
Detection logic: the core rule is a threshold: one source reaching more than N distinct destination ports within T seconds raises an alert. Tune N and T to the environment so routine health checks do not trip it.
Segmentation makes this stronger. On a VLAN-segmented network, a scanner on an untrusted segment is blocked from reaching other segments and the attempts are logged at the firewall, so the scan is both contained and visible, the same design as my home network build.
Summary
Commands Covered
nmap --version
nmap -p 21,22,23,445 $TARGETS
nmap -p 21,22,23,445 -sV -T4 $TARGETS
nmap --script vuln -p 21,22,23,445 $TARGETS
nmap --script smb-vuln* -p 445 $TARGETS
nmap -A -T4 $TARGETS
These commands cover installation verification, focused port scanning, service version detection, vulnerability script checks, SMB-specific checks, and more detailed assessment scanning.
Why It Matters
Why This Is Useful
Nmap is useful because it helps identify what services are exposed on a network. This supports troubleshooting, network visibility, vulnerability management, and security review.
This lab shows how scan results can be turned into practical actions such as disabling insecure services, removing legacy protocols, strengthening configuration, and reducing the attack surface.
It also demonstrates a simple workflow for moving from discovery to analysis, then from analysis to remediation notes.