
This hands-on cybersecurity lab demonstratation shows attackers combine reconnaissance and exploitation techniques using Nmap
and Metasploit. The setup involves two machines: a Kali Linux attacker
system equipped with penetration testing tools and a vulnerable target host
(such as Metasploitable). The goal is to simulate a real-world penetration
test, starting from target discovery to successful exploitation and session
management.
The lab begins by verifying basic connectivity between both systems using ifconfig and ping commands. Once communication is confirmed, the attacker leverages Nmap to perform host discovery, identify open ports, and enumerate services running on the target. With detailed service information, potential vulnerabilities can be mapped to known exploits.
Next, the attacker launches Metasploit Framework (msfconsole) to load an exploit module corresponding to the vulnerable service discovered during scanning. Critical parameters such as the target IP address and service port are configured before executing the exploit. If successful, Metasploit establishes a session, often a Meterpreter shell, which allows the attacker to interact with and control the compromised system.
This exercise illustrates the importance of
proactive defense, patching, and monitoring, while providing learners with
practical exposure to offensive security methodologies in a safe, controlled
environment.
Lab Setup & Tools Used:
Attacker PC (Kali)
Metasploit
Tools Used
Nmap
Check Connectivity Ping From both sides.
Yes, Nmap 7.94 is an upgraded version. It was released with several significant improvements and new features, including a migration of Zenmap and Ndiff to Python 3, enhanced OS fingerprint matching, and various library upgrades. The latest version is actually Nmap 7.96, which further builds upon these enhancements with even more performance improvements and new scripts.
NMAP SCAN ENTIRE LOCAL NETWORK
Command used
To scan port 21 (commonly used for FTP - File Transfer Protocol) on a target system and detect the version of the service running on that port.
- The -sV
option enables service version detection, which goes beyond simply
identifying whether the port is open. It attempts to determine the exact
version of the service running, such as vsftpd 2.3.4.
- The -p 21 option instructs Nmap to scan only port 21/tcp instead of scanning a full port range. This makes the scan faster and more targeted. The IP 192.168.142.130 points to the vulnerable Metasploitable machine within the lab environment.
Detect open ports
By using the above command we can perform an aggressive
scan on the target machine (192.168.142.130, Metasploitable), focusing only
on port 21 (FTP).
-A → Enables aggressive scanning mode,
which combines multiple Nmap features:
- Service version detection (like -sV)
- Operating system detection
- Default Nmap NSE scripts for vulnerability and service probing
- Traceroute
information
-p 21 → Restricts the scan to port 21/tcp,
which is the default FTP service port.
When executed, this scan not only checks
whether FTP is open but also attempts to identify:
- The exact FTP
software and version (e.g., vsftpd 2.3.4).
- Potential security
warnings or misconfigurations.
- The operating
system running on the target host.
- Additional service details using built-in Nmap scripts
Perform an aggressive scan
NEXT STEP EXPLOITATION
So,
2- Ping for verification
3- Check nmap –version for verification
4- Up to date
5- Perform an aggressive scan
6- With the help of msfconsole
7- Exploited metasploitable Accessed shell
Conclusion: This lab illustrates the complete life cycleof a penetration test in a controlled environment using two widely adopted
tools: Nmap and Metasploit. The exercise begins with establishing
basic connectivity between the attacker machine (Kali Linux) and the vulnerable
target (Metasploitable), ensuring that the network setup is correct through IP
verification and ping testing.
Once communication is confirmed, the attacker
employs Nmap for reconnaissance. Nmap is first checked for availability,
then used to conduct an aggressive scan, revealing open ports, running
services, and system fingerprints. In this case, the scan identifies vulnerable
services such as FTP (vsftpd 2.3.4), which is known to contain a
backdoor vulnerability. This reconnaissance stage is crucial as it transforms
raw network data into actionable intelligence for exploitation.
The next phase involves launching MetasploitFramework (msfconsole), a powerful exploitation toolkit. By selecting the
appropriate exploit module (vsftpd_234_backdoor) and configuring target
details, the attacker successfully compromises the system. Metasploit
establishes a session, enabling the attacker to gain remote shell access.
From here, system-level commands such as whoami or uname -a can be executed,
confirming full control of the victim system.
0 Comments