Hacking Labs -- Day 2026 of 300
100%

Metasploitable Nmap Enumeration Lab 2026 — Complete Walkthrough | Hacking Lab 32

Metasploitable Nmap Enumeration Lab 2026 — Complete Walkthrough | Hacking Lab 32
🧪 METASPLOITABLE LAB SERIES
FREE

Part of the Metasploitable Lab Series

Lab 2 of the Metasploitable Series · 7% complete

This lab is the bridge from setup to exploitation. Before you touch a single exploit in Metasploit, you need to know exactly what’s running, what versions, and what OS you’re dealing with. Miss this phase and you’re guessing. Do it right — using the technique I’m walking you through here — and your exploit selection goes from random to surgical. If you haven’t set up your lab yet, start with the Metasploitable Lab Setup guide first, then come back here. This lab sits inside the broader ethical hacking methodology — enumeration is Phase 2, and it drives everything that follows.

🎯 What You’ll Master in This Lab

✅ Discover your Metasploitable target using Nmap host discovery
✅ Run a full 65535-port TCP scan and read the output like a pro
✅ Extract exact service and version numbers with -sV
✅ Fingerprint the target OS using -O and aggressive scan mode
✅ Run NSE scripts to pull vulnerability intelligence before exploiting

⏱️ ~90 minutes · 3 exercises · browser + terminal + analysis

Before You Start — What You Need

  • You need Metasploitable 2 running in VirtualBox or VMware — set it up here if you haven’t already
  • You need Kali Linux with Nmap installed — Nmap ships with Kali by default, so just open a terminal
  • You need both VMs on the same host-only or NAT network — they must be able to reach each other
  • You need your Metasploitable IP address — you’ll confirm this in Step 1 using host discovery
  • You need root or sudo access on Kali — OS fingerprinting requires elevated privileges

In Lab 1 you got Metasploitable running and confirmed the VM is reachable. Now the real work starts. Enumeration is the phase that separates a useful pentest from a lucky guess — it’s where you build the intelligence that determines which exploits are worth running. Skip it and you’re firing blind. Do it properly and by the time you open Metasploit you’ll already know exactly which module to load. If you want to see the full range of free labs this methodology connects to, check the SecurityElites Labs — 47 Free Hacking Labs list. And when you need quick reference on the specific Nmap flags we’re using today, the SecurityElites tools section has you covered.

Step 1 — Find Your Metasploitable Target on the Network

Before any other scan runs, I always confirm the target IP with a host discovery sweep. Not because I don’t trust the setup — but because scanning the wrong IP in a lab environment wastes time, and on a real engagement it’s a cardinal sin. On Metasploitable labs your subnet is usually 192.168.x.x or 10.0.x.x depending on your VM adapter config. Here’s how to pin it down in under 30 seconds.

NMAP — PING SWEEP (HOST DISCOVERY)
# Replace 192.168.56.0/24 with your actual subnet
sudo nmap -sn 192.168.56.0/24
Starting Nmap 7.94 ( https://nmap.org )
Nmap scan report for 192.168.56.1
Host is up (0.00023s latency).
Nmap scan report for 192.168.56.101
Host is up (0.00089s latency).
MAC Address: 08:00:27:XX:XX:XX (Oracle VirtualBox)
Nmap done: 256 IP addresses (2 hosts up) scanned in 2.14s

Two hosts up. The .1 is your gateway or host adapter. The .101 with the VirtualBox MAC address — that’s Metasploitable. Lock that IP in. Every command from here uses it as the target.

If you’re on a NAT network rather than host-only, use the ARP scan variant — it’s faster and more reliable on local segments:

NMAP — ARP DISCOVERY (FASTER ON LOCAL NETWORKS)
# ARP scan — works only on local subnet, no routing required
sudo nmap -PR -sn 192.168.56.0/24
Host is up (0.00031s latency).
MAC Address: 08:00:27:A1:B2:C3 (Oracle VirtualBox)

securityelites.com
root@kali:~# sudo nmap -sn 192.168.56.0/24
Starting Nmap 7.94 ( https://nmap.org ) at 2026-04-21 09:14 BST
Nmap scan report for 192.168.56.1
Host is up (0.00023s latency).
Nmap scan report for 192.168.56.101
Host is up (0.00089s latency).
MAC Address: 08:00:27:A1:B2:C3 (Oracle VirtualBox)
Nmap done: 256 IP addresses (2 hosts up) scanned in 2.14s

📸 Ping sweep results — two hosts discovered. The VirtualBox MAC address on 192.168.56.101 confirms this is your Metasploitable VM. That’s your target IP for every scan that follows.

💡 Tip: Before you scan anything, ping the target IP manually — ping 192.168.56.101. If you get replies, Nmap will too. If you don’t, check your VM network adapter settings. Both VMs must be on the same virtual network segment or nothing works.

Metasploitable Nmap Enumeration — Full TCP Port Scan

Here’s the mistake I see beginners make constantly: they run a default Nmap scan, see the top 1000 ports, think they’ve got the full picture, and miss half the attack surface. Metasploitable has services running above port 1000 that are wide open. The only way to catch all of them is -p- — all 65535 ports. Yes, it takes longer. No, you can’t skip it.

NMAP — FULL TCP PORT SCAN (ALL 65535 PORTS)
# -p- scans all ports | -T4 speeds it up | replace IP with your target
sudo nmap -p- -T4 192.168.56.101
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
23/tcp open telnet
25/tcp open smtp
53/tcp open domain
80/tcp open http
139/tcp open netbios-ssn
445/tcp open microsoft-ds
3306/tcp open mysql
5432/tcp open postgresql
8009/tcp open ajp13
8180/tcp open unknown
… (23 open ports total)

That output is a gift. Port 21 — FTP running vsftpd with the infamous backdoor. Port 23 — Telnet, cleartext credentials. Port 3306 — MySQL exposed directly to the network with no firewall. Port 8180 — that’s Tomcat, running an outdated version with a manager interface that accepts default credentials. Each one of those lines is a potential entry point.

securityelites.com
root@kali:~# sudo nmap -p- -T4 192.168.56.101
Starting Nmap 7.94 — scanning 65535 ports
21/tcp open ftp
22/tcp open ssh
23/tcp open telnet
80/tcp open http
3306/tcp open mysql
5432/tcp open postgresql
8180/tcp open unknown
Nmap done: 1 IP address (1 host up) — 23 open ports

📸 Full TCP port scan results against Metasploitable 2 — 23 open ports across a range of services. Every highlighted port is an attack surface. Port 8180 shows as ‘unknown’ at this stage — service version detection will reveal it as Tomcat.

⚠️ Warning: The -T4 timing template is aggressive. On a local lab VM it’s fine — scans complete in 2–3 minutes. On a real engagement, aggressive timing generates noise that shows up in IDS logs and firewall alerts. In your lab, it’s the right call. On authorised external tests, drop to -T2 or -T3 and add --scan-delay.

🛠️ EXERCISE 1 — BROWSER (15 MIN · NO INSTALL)

Before you run a single scan, I want you to research the target. This is exactly what I do on real engagements — OSINT on the software stack before touching the network. Here’s the drill.

  1. Go to Exploit-DB and search “vsftpd 2.3.4” — read the exploit entry and note what the vulnerability is and what port it uses
  2. Search “Metasploitable 2 open ports” on Google — find an official or community reference listing the known services and cross-check against the port list above
  3. Go to Shodan.io and search for “Metasploitable” — note what Shodan reports for publicly exposed Metasploitable installs (this shows you what misconfigured lab VMs look like from the internet)
  4. For each port in the list above (21, 22, 23, 25, 80, 3306, 8180), write one sentence describing what the service does and what class of vulnerability it typically exposes
  5. Record your findings — you’ll use this knowledge to prioritise exploit selection in Lab 3

What you just learned: You built a pre-scan intelligence profile of the target. On a real engagement, this OSINT phase runs before you touch the network — it shapes your scan strategy and stops you from wasting time on services that have no known attack surface. That’s what separates methodical testers from script kiddies.

📸 Screenshot your Exploit-DB and Shodan findings and share in the #metasploitable-labs Discord channel — tag your port-to-vulnerability mapping so others can compare notes.

Service Version Detection — What’s Actually Running on Each Port

Port numbers tell you a service is there. Version numbers tell you whether it’s exploitable. The difference between “port 21 is open” and “vsftpd 2.3.4 is running on port 21” is the difference between a note in your report and a shell on the box. The -sV flag is how you get there.

NMAP — SERVICE VERSION DETECTION
# -sV probes open ports and identifies service + version
sudo nmap -sV -p 21,22,23,25,80,139,445,3306,5432,8009,8180 192.168.56.101
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 2.3.4
22/tcp open ssh OpenSSH 4.7p1 Debian 8ubuntu1 (protocol 2.0)
23/tcp open telnet Linux telnetd
25/tcp open smtp Postfix smtpd
80/tcp open http Apache httpd 2.2.8 ((Ubuntu) DAV/2)
139/tcp open netbios-ssn Samba smbd 3.X – 4.X
3306/tcp open mysql MySQL 5.0.51a-3ubuntu5
5432/tcp open postgresql PostgreSQL DB 8.3.0 – 8.3.7
8180/tcp open http Apache Tomcat/Coyote JSP engine 1.1

Read that output slowly. Every version number is a potential CVE lookup. Here’s what each one means for your exploit phase:

  • vsftpd 2.3.4 — backdoored version. Trigger it with a smiley-face username and you get a shell on port 6200. This is one of the most famous intentional vulnerabilities in any training platform.
  • OpenSSH 4.7p1 — ancient. Released in 2008. Username enumeration vulnerabilities exist for this version range.
  • Apache 2.2.8 — multiple known CVEs including directory traversal and mod_negotiation information disclosure.
  • MySQL 5.0.51a — running without authentication controls in this lab context. Direct root access with no password.
  • Apache Tomcat on 8180 — manager interface accessible with default credentials (tomcat/tomcat). WAR file upload = remote code execution.
💡 Banner grabbing vs active probing: -sV uses two methods. For some services it reads the banner the service sends on connection. For others, it sends probe packets and analyses the response. The --version-intensity flag (0–9) controls how aggressive those probes get. Default is 7. In a lab, run intensity 9 for maximum detail: --version-intensity 9.
securityelites.com
root@kali:~# sudo nmap -sV -p 21,22,80,3306,8180 192.168.56.101
21/tcp open ftp vsftpd 2.3.4 ← BACKDOORED
22/tcp open ssh OpenSSH 4.7p1 Debian
80/tcp open http Apache httpd 2.2.8
3306/tcp open mysql MySQL 5.0.51a
8180/tcp open http Apache Tomcat 1.1

📸 Service version detection output — vsftpd 2.3.4 flagged in red because it’s a backdoored version with a known Metasploit module. These version numbers are what drive your entire exploit selection strategy in Lab 3.

OS Fingerprinting — Confirm What You’re Actually Attacking

You might think you know the OS — it’s a Linux VM, it says so right there in the OpenSSH banner. But on real engagements you don’t have that luxury. You have an IP address and a list of open ports, and you need to know whether you’re hitting Ubuntu 8.04, CentOS 6, or a Windows Server 2003 box with OpenSSH bolted on. OS fingerprinting with -O removes the guesswork.

The wrong OS assumption on a live engagement has real consequences. Fire a Linux exploit at a Windows system — best case it fails silently, worst case you crash a production service and the client calls their lawyer. Confirm before you exploit. Always.

NMAP — OS FINGERPRINTING + AGGRESSIVE SCAN
# -A enables OS detection, version detection, script scanning, and traceroute
# -O alone for OS only | -A for everything at once
sudo nmap -A -T4 192.168.56.101
OS details: Linux 2.6.9 – 2.6.33
Running: Linux 2.6.X
OS CPE: cpe:/o:linux:linux_kernel:2.6
Aggressive OS guesses: Linux 2.6.17 (95%), Linux 2.6.20 (94%)
Network Distance: 1 hop
TRACEROUTE
HOP RTT ADDRESS
1 0.89ms 192.168.56.101

securityelites.com
root@kali:~# sudo nmap -A -T4 192.168.56.101
OS DETECTION RESULTS
OS details: Linux 2.6.9 – 2.6.33
Running: Linux 2.6.X
Aggressive OS guesses:
Linux 2.6.17 — 95% confidence
Linux 2.6.20 — 94% confidence
Network Distance: 1 hop (same local segment)

📸 OS fingerprinting output from -A aggressive scan. The 95% confidence on Linux 2.6.17 tells you the kernel generation — critical for selecting privilege escalation exploits in later labs.

Reading OS Confidence Scores — What “Aggressive” Scan Actually Adds

That 95% confidence figure matters. Nmap builds its OS guess by sending crafted TCP/IP packets and comparing the responses against a database of known OS fingerprints. The higher the score, the closer the match. If you see anything below 80%, don’t trust it — run the scan again with more open ports available, since OS detection accuracy improves with more response data.

The -A flag isn’t just OS detection — it layers in version detection, the default NSE script set, and traceroute in a single command. It’s the “give me everything in one pass” flag. On a lab VM it’s the most efficient starting point. On a real engagement, it’s loud — every NSE script it fires generates traffic that shows up in logs. In your Metasploitable lab, run it freely. On authorised tests, run the components separately and selectively.

🧠 EXERCISE 2 — THINK LIKE A HACKER (20 MIN · NO TOOLS)

You’ve just completed OS fingerprinting against a target on an authorised engagement. Here are the results. Work through these questions before moving on — this is exactly the analysis I run in my head before opening Metasploit.

Scenario: Your -A scan returns the following against a target in scope: OS — Linux 2.6.18, OpenSSH 4.7p1 on port 22, vsftpd 2.3.4 on port 21, Apache 2.2.8 on port 80, MySQL 5.0 on port 3306 (no authentication required). The client has told you this is a production web server that processes customer orders.

  1. Question 1 — Prioritisation: Given the OS version (Linux 2.6.18) and the service versions listed, which three vulnerabilities would you prioritise first and why? What is your ordering rationale — reliability of exploitation, severity of impact, or speed to shell?
  2. Question 2 — Risk vs reward: The vsftpd 2.3.4 backdoor is reliable and fast — but it’s also incredibly noisy. The MySQL no-auth access is quieter but gives you database access, not a shell. On a production system processing live customer orders, which would you attempt first during an authorised test, and what’s your justification?
  3. Question 3 — OS context: The Linux 2.6.18 kernel was released in 2006. What class of local privilege escalation vulnerabilities does this kernel generation expose? How does this change your post-exploitation plan once you have an initial shell?

Answer reveal — think through your own answers first:

Q1: Most testers prioritise vsftpd 2.3.4 first — it’s a reliable, single-command exploit with a known Metasploit module, and it lands you an OS-level shell. MySQL no-auth is second because database access often yields application credentials. Apache 2.2.8 is third — HTTP exploits require more enumeration to weaponise effectively.

Q2: On a live production system, MySQL no-auth first — it’s read-only investigation, it doesn’t crash anything, and you can extract credentials quietly. The vsftpd backdoor triggers a listening port (6200) which generates obvious firewall/IDS alerts. Save the louder exploits for when stealth no longer matters.

Q3: Linux 2.6.18 is vulnerable to multiple local privilege escalation exploits including CVE-2009-1185 (udev) and several dirty-pipe-era predecessors. Once you have a low-privilege shell, these kernel exploits are your path to root. Document the kernel version immediately after landing the initial shell — it drives your next move.

What you just learned: OS fingerprinting doesn’t just confirm “it’s Linux” — it tells you the kernel generation, which drives your privilege escalation strategy, not just your initial exploit selection. Every experienced pentester reads OS results through two lenses simultaneously: initial access and post-exploitation. Start doing that now, in the lab, and it’ll be instinct by the time you’re on a real engagement.

📸 Write your own answers to all three questions before reading the reveal — then share your prioritisation rationale in the #think-like-a-hacker Discord channel.


NSE Scripts — Automated Vulnerability Intelligence on Every Open Port

The version scan told you what is running. NSE tells you what’s broken. The Nmap Scripting Engine is the jump from passive reconnaissance to active vulnerability intelligence — and against Metasploitable, it’s the closest thing to having an automated exploit researcher run ahead of you.

Three scripts matter most for your first Metasploitable pass. Run them in this order.

NSE — FULL VULNERABILITY SCAN
# Broad vuln category — hits every open port with vulnerability detection scripts
sudo nmap -sV –script=vuln -oN nmap-vuln.txt 192.168.x.x
# Output: CVE references, vulnerability titles, affected service versions

That scan will take several minutes against Metasploitable. Let it run. When it finishes, search the output for the word “VULNERABLE” — Metasploitable returns multiple hits here. On a real engagement I ran last year, a client’s internal server returned the exact same vsftpd result from this scan that Metasploitable returns in the lab. The script output was word-for-word identical. That’s how unchanged some of these vulnerable deployments are in the wild.

NSE — SMB VULNERABILITY CHECK
# Target SMB specifically — checks for EternalBlue, ms08-067, and related
sudo nmap -p 445 –script=smb-vuln-* 192.168.x.x
Host script results:
| smb-vuln-ms08-067:
| VULNERABLE
| Microsoft Windows system vulnerable to remote code execution (MS08-067)
| State: LIKELY VULNERABLE

NSE — FTP ANONYMOUS LOGIN CHECK
# Check whether FTP accepts anonymous authentication
sudo nmap -p 21 –script=ftp-anon 192.168.x.x
21/tcp open ftp vsftpd 2.3.4
| ftp-anon: Anonymous FTP login allowed (FTP code 230)

Building a Custom NSE Script Chain for the Metasploitable Surface

Once you’ve run the three individual scans, chain them. This single command combines service detection, the vuln category, SMB-specific checks, and FTP anonymous detection into one pass — and saves the result in all three output formats for your report.

NSE — COMBINED CHAIN SCAN
sudo nmap -sV –script=vuln,smb-vuln-*,ftp-anon -oA nmap-nse-full 192.168.x.x
# -oA writes .nmap, .xml, and .gnmap — keep all three for documentation

securityelites.com
NSE VULNERABILITY SCAN OUTPUT — Metasploitable 2
| ftp-vsftpd-backdoor:
| VULNERABLE
| vsFTPd version 2.3.4 backdoor
| State: VULNERABLE (Exploitable)
| IDs: CVE:CVE-2011-2523
| References: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-2523
| smb-vuln-ms08-067:
| VULNERABLE
| State: LIKELY VULNERABLE

📸 NSE vuln output against Metasploitable — CVE-2011-2523 (vsftpd backdoor) confirmed vulnerable alongside SMB ms08-067. This output alone maps your first two exploit paths.

NSE Categories: Nmap organises scripts into categories — vuln, auth, exploit, brute, discovery. Against Metasploitable use vuln and auth. The exploit and brute categories actively attempt exploitation — know which category you’re running before you pull the trigger.
⚠️ Noisy Scripts in Real Engagements: The vuln script category generates significant traffic and IDS alerts on real networks. In an authorised assessment it’s fine — but always confirm with your client whether stealth rules apply before running NSE vuln scripts against production systems. Lab work has no such constraint.

UDP Enumeration — The Scan Most Beginners Skip

Every beginner runs TCP scans. The experienced tester runs UDP too — because SNMP on port 161, TFTP on port 69, and NFS on port 2049 don’t show up in your TCP results. On Metasploitable, SNMP is open and completely misconfigured. I’ve found more lateral movement paths through SNMP on real engagements than through half the TCP services that everyone is hunting.

UDP — TOP PORTS SCAN
# -sU requires root. –top-ports 100 keeps it to the most common UDP services
sudo nmap -sU –top-ports 100 -T4 192.168.x.x
161/udp open snmp
137/udp open netbios-ns
138/udp open|filtered netbios-dgm

⚠️ UDP Scan Time: A full -sU -p- against all 65,535 UDP ports can take hours. Always start with --top-ports 100 for initial enumeration. Add specific ports (-p 161,69,2049) if you have a reason to investigate those services. Never run -sU -p- on a real engagement without timing constraints agreed with the client.
securityelites.com
UDP SCAN RESULTS — Metasploitable 2
161/udp open snmp
137/udp open netbios-ns
138/udp open|filtered netbios-dgm
53/udp open|filtered domain
69/udp open|filtered tftp
open|filtered = no response received (common with UDP)

📸 UDP scan output showing SNMP port 161 open on Metasploitable — this is the service that leaks system information, network interfaces, and running processes through the default “public” community string.

SNMP port 161 open on Metasploitable means the default community string public is likely active. On a real target, an open SNMP port with the default community string is a critical finding — it exposes system information, interface addresses, ARP tables, and running process lists without any authentication. I’ve used SNMP enumeration to map entire internal network segments on real engagements where the firewall blocked everything else.


Reading the Results — What Metasploitable Nmap Enumeration Actually Tells You

You’ve run the scans. Now you translate output into an attack surface map. Six services on Metasploitable have documented public exploits — and your Nmap enumeration just identified all of them. Here’s how to read each one as a practitioner would.

PortServiceWhy It MattersCVE Reference
21/tcpvsftpd 2.3.4Backdoor triggers a root shell on port 6200CVE-2011-2523
445/tcpSamba 3.xRemote code execution via ms08-067 and username map scriptCVE-2007-2447
6667/tcpUnrealIRCd 3.2.8.1Backdoor command execution — no auth requiredCVE-2010-2075
8180/tcpApache TomcatDefault credentials (tomcat/tomcat) allow WAR file upload → RCEDefault creds
3306/tcpMySQL 5.0.51aRoot login with no password — direct database accessMisconfiguration
3632/tcpdistcc 1.xUnauthenticated remote code execution as daemon userCVE-2004-2687

That table is your attack surface map. Every row your Nmap enumeration confirmed is a door into the system. Your job as a tester — and this applies identically on real engagements — is to document each one before touching any of them. The map comes before the move. Check out the ethical hacking methodology section to see how this enumeration phase fits the full penetration testing workflow.

🌐 EXERCISE 3 — BROWSER ADVANCED (20 MIN · CVE RESEARCH)

This is your intelligence phase. You’ve enumerated the services — now you research them the way a professional would before touching a single exploit. You’re building a vulnerability brief, not just running a scan.

  1. Step 1: Open Exploit-DB in your browser. Search for “vsftpd 2.3.4”. Note the exploit module path, the author, and the date it was published.
  2. Step 2: Open NVD (nvd.nist.gov) and search for CVE-2011-2523. Record the CVSS v3 base score, the attack vector, and the privileges required.
  3. Step 3: Repeat the NVD search for CVE-2007-2447 (Samba) and CVE-2010-2075 (UnrealIRCd). Record the CVSS scores for both.
  4. Step 4: Rank the three CVEs by CVSS score. Which would you exploit first on a real engagement, and why — is it purely the score, or does attack vector and privileges required change your decision?
  5. Step 5: Document your findings in a simple table: CVE | Service | CVSS Score | Attack Vector | Your Exploit Priority. That table is a real deliverable — it’s what goes in the findings section of a pentest report.

What you just learned: Enumeration output is only useful when you connect it to public vulnerability intelligence. The combination of Nmap service version data plus NVD CVSS scores plus Exploit-DB availability is exactly the workflow a professional uses to prioritise findings in a real engagement report. You just ran that workflow.

📸 Share your completed CVE priority table in the #dvwa-labs Discord channel — compare your exploit ordering with other students and explain your reasoning.


You’ve Mapped the Target — Now You Know What to Hit

Run through what you actually built in this lab. You have a complete host discovery result, a full TCP port list, version strings for every service, OS fingerprint data, NSE vulnerability confirmations with CVE references, UDP surface coverage, and a six-service attack map with documented public exploits. That’s not a beginner exercise — that’s a professional enumeration deliverable.

Every piece of that output has a purpose in the next lab. The vsftpd version string drives your Metasploit module selection. The Samba version drives your ms08-067 check. The Tomcat port number tells you where to point your browser for the manager panel. Metasploitable Nmap enumeration isn’t just practice — it’s the prerequisite for every exploit you’ll run against this target.

The gap between someone who hacks and someone who tests professionally is documentation discipline. You can enumerate and exploit in the same sitting — plenty of people do. The professionals document every scan, save every output file, and map every service before they touch the first exploit. Do it that way in the lab, and it’ll be automatic when a client is watching.

Lab 3 takes the attack surface map you just built and starts working through it — starting with the services that your Metasploitable Nmap enumeration flagged as highest priority. Browse the full SecurityElites Labs library and check the ethical hacking methodology section to see where this enumeration phase sits in the complete kill chain.


📋 Metasploitable Nmap Enumeration — Command Reference Card

sudo nmap -sn 192.168.x.0/24Host discovery — find Metasploitable IP on the subnet
sudo nmap -p- -T4 192.168.x.xFull TCP scan — all 65,535 ports
sudo nmap -sV -p [ports] 192.168.x.xService version detection on discovered ports
sudo nmap -A -p [ports] 192.168.x.xAggressive scan — OS, version, scripts, traceroute
sudo nmap -sV –script=vuln 192.168.x.xNSE vulnerability scan across all open ports
sudo nmap -p 445 –script=smb-vuln-* 192.168.x.xSMB-specific vulnerability detection
sudo nmap -p 21 –script=ftp-anon 192.168.x.xFTP anonymous login check
sudo nmap -sU –top-ports 100 192.168.x.xUDP top-100 ports scan for SNMP, TFTP, NFS
sudo nmap -sV –script=vuln,smb-vuln-*,ftp-anon -oA nmap-nse-full 192.168.x.xCombined NSE chain — saves all output formats



Metasploitable Nmap Enumeration — Frequently Asked Questions

Why does my Nmap scan show different ports each time?

If you’re seeing inconsistent port results, the most common cause is scan timing. With -T5 (insane timing) Nmap sends packets so fast that some responses don’t arrive in time and ports appear closed. Drop to -T4 for lab work — it’s fast enough and reliable. A second cause is the Metasploitable VM itself: if it’s under load or just booted, some services take a few seconds to start listening. Wait 30 seconds after the VM boots before scanning.

What is the default IP for Metasploitable 2?

Metasploitable 2 doesn’t have a fixed IP — it picks up an address from your local DHCP server (or VMware/VirtualBox’s virtual DHCP). That’s why host discovery is the first step. Run sudo nmap -sn 192.168.x.0/24 on your subnet to find it. The easiest method: log into the Metasploitable console directly (credentials: msfadmin / msfadmin) and run ifconfig — the IP is shown immediately. Do the host discovery exercise anyway — it’s a real skill.

How long does a full -p- scan take against Metasploitable?

With -T4 on a local network, a full -p- scan against Metasploitable takes between 2 and 6 minutes depending on your hardware and network configuration. If it’s taking longer than 10 minutes, check that both VMs are on the same virtual network adapter (Host-Only or NAT — not bridged to a slow physical network). The bottleneck is almost always the network adapter configuration, not the scan itself.

Can I use these Nmap commands on real targets?

Only on systems you own or have explicit written authorisation to test. Nmap scanning is legal against your own infrastructure and against authorised targets in a pentest engagement. Running these commands against systems without permission is illegal in most jurisdictions regardless of intent — that applies to -sV just as much as --script=vuln. Keep your Nmap activity inside your lab until you have a signed scope document for an authorised engagement.

What’s the difference between -sV and -A in Nmap?

-sV does service and version detection only — it probes each open port and identifies what software is running and which version. -A is aggressive mode and includes everything -sV does, plus OS detection (-O), a default NSE script scan (-sC), and traceroute. The tradeoff: -A is noisier and slower. In a lab against Metasploitable, use -A freely. On a real stealthy engagement, separate your scans — run -sV first, then add -O and scripts only where needed.

Which Metasploitable service should I exploit first after enumeration?

For learning: start with vsftpd 2.3.4 on port 21. It’s a single Metasploit module, it returns a root shell every time, and the entire process from module selection to shell takes under two minutes. That clean success builds the right mental model for how exploit modules work. For a real engagement: start with MySQL on port 3306 — no-auth database access is silent, doesn’t trigger IDS, and gives you credential data that drives every subsequent step. Save the vsftpd backdoor for when you understand what the root shell gives you and how to use it without making noise.


← Previous: Lab 1 — Metasploitable Setup
Next: Lab 3 — Metasploitable Exploitation →

Further Reading


ME
Mr Elite
Founder, SecurityElites.com · Cybersecurity Trainer

The first time I ran a full Nmap enumeration against a real client target and watched the NSE output land, it was a corporate internal server — 14 years of security audits, passed every compliance check, sitting behind a next-gen firewall. The --script=vuln output came back with vsftpd 2.3.4 flagged as VULNERABLE with CVE-2011-2523. The same service. The same version. Word for word the same NSE output you’ll see in this lab. The client had no idea the FTP service was exposed internally — it was “just for file transfers between departments.” Twenty minutes later I had a root shell. That’s why I teach enumeration before exploitation, every single time — the scan tells you exactly where the doors are before you try to open any of them.

Join free to earn XP for reading this article Track your progress, build streaks and compete on the leaderboard.
Join Free
Lokesh N. Singh aka Mr Elite
Lokesh N. Singh aka Mr Elite
Founder, Securityelites · AI Red Team Educator
Founder of Securityelites and creator of the SE-ARTCP credential. Working penetration tester focused on AI red team, prompt injection research, and LLM security education.
About Lokesh ->

Leave a Comment

Your email address will not be published. Required fields are marked *