Penetration Testing Exploitation CTF 3
Overview¶
This lab focuses on identifying and exploiting vulnerabilities across two target machines (target1.ine.local and target2.ine.local). By uncovering weaknesses in services and configurations, we retrieve flags from various locations. Tasks include:
- Flag 1: Exploit a vulnerable service on
target1to retrieve a flag from the root directory. - Flag 2: Interact with a local network service on
target1using a hint from Flag 1. - Flag 3: Exploit a misconfigured service on
target2to gain access and retrieve a flag. - Flag 4: Escalate privileges to root on
target2and read the flag from/root.
Flag 1: Exploiting ProFTPD 1.3.5 on target1¶
Step 1: Enumeration¶
- Nmap Scan reveals:
- FTP (21): ProFTPD 1.3.5 (vulnerable to
mod_copyRCE). - HTTP (80): Apache 2.4.41 (Ubuntu).
Step 2: Exploitation¶
- Searchsploit confirms
ProFTPD 1.3.5is exploitable viamod_copy: - Metasploit Module:
- Upgrade to Meterpreter:
Step 3: Retrieve Flag¶
- Navigate to
/and readflag1.txt:
Flag 1
d783277df68b4b6ab274beed476496f7
Flag 2: Local Service Interaction on target1¶
Step 1: Analyze Hint¶
- Flag 1’s hint:
"Remember, the magical word is 'letmein'"
Step 2: Discover Local Service¶
- Check listening ports:
- Port 8888 is open locally.
Step 3: Interact with Service¶
- Use
netcatto connect and provide the passphrase (letmein): - Enter
letmeinto receive Flag 2.
Flag 2
e2c598d0f53242ec86d6482db68e325b
Flag 3: Exploiting Samba Misconfiguration on target2¶
Step 1: Enumeration¶
- Nmap Scan reveals:
- HTTP (80): Apache 2.4.41.
- SMB (139/445): Samba 4.6.2.
- SMB Shares:
- Accessible share:
site-uploads(anonymous write allowed).
Step 2: Upload PHP Shell¶
- Upload a reverse shell (
pentestmonkey.php) via SMB: - Trigger the shell via HTTP:
Step 3: Retrieve Flag¶
- After gaining a shell (
www-data), readflag3.txtin/:
Flag 3
6b0baffdd3f948cfb26259df3adec80a
Flag 4: Privilege Escalation to Root on target2¶
Step 1: Check SUID Binaries¶
- Find binaries with
SUIDbit set: /usr/bin/findis exploitable.
Step 2: Exploit find SUID¶
- Use GTFOBins technique to spawn a root shell:
- Verify privileges:
Step 3: Retrieve Flag¶
- Access
/root/flag4.txt:
Flag 4
ea93d2c1cfb9461b8712505b0c33a63c