Box Stats
Box Info | Details |
---|---|
Box Name : | Jeff |
Difficulty : | Hard |
Play : | Jeff |
Recommended : | Yes ![]() |
Summary
Hello, this was a great hard box that i did with my new teammate Zero
. We had a great teamwork & we solved it pretty fast for its level, i recommend you to try it. I’ll not say much now, let’s start!
Enumeration/Reconnaissance
Now as always let’s continue with a nmap scan.
1 |
|
The hint says to us to add jeff.thm
to /etc/hosts
file.
1 |
|
Website doesn’t provide something useful, so let’s continue with a gobuster
scan.
1 |
|
/backups
seems interesting, let’s run a gobuster
scan in it with lot of extensions.
1 |
|
Here we go, let’s download it & open it. When we try to open it asks for password:
1 |
|
We can easily crack it using fcrackzip
.
1 |
|
Once we unzip, we can see that provides a wordpress password.
1 |
|
The problem is that we haven’t a wordpress installation, because of the virtual host we can test for subdomains. We can do that using gobuster
or wfuzz
i’ll show you both ways.
1 |
|
1 |
|
Let’s add it to /etc/hosts
.
1 |
|
Shell as www-data
Now we can see the wordpress site:
Let’s run a wpscan
scan to find out the username.
1 |
|
So now we can login in as jeff:phO#g)C5dhIWZn3BKP#
at /wp-admin
.
To spawn a reverse shell, the normal way using the theme editor doesn’t work. We have to use the plugin editor now, follow my steps:
1 |
|
1 |
|
Shell as backupmgr
Doing the enumeration, i found out a ftp_backup.php
file with some credentials in.
1 |
|
Let’s try to connect to FTP server using curl
. Note: -P -
is the important part makes curl use the only available connection.
1 |
|
I googled around for “linux backup privilege escalation” and i found an article about TAR wildcard injection & it worked.
First lets generate a python one-liner reverse shell using msfvenom.
1 |
|
Let’s add into shell.sh:
1 |
|
Now we will use 2 commands that help tar to run shell.sh:
1 |
|
Now let’s upload them to FTP server using curl.
1 |
|
We’ve shell back.
1 |
|
Shell as jeff
Now i searched for files based on jeff
user.
1 |
|
Perfect, the systool
binary has 3 options:
1 |
|
The second option, prints message.txt
file from the same directory. So we can just create a symlink that points to /var/backups/jeff.bak
1 |
|
Perfect now let’s login using SSH.
1 |
|
We’re into rbash
to bypass that we’ll use SSH again with --no-profile
.
1 |
|
Shell as root
Checking the sudo -l
we can run crontab
as root:
1 |
|
The crontab command allows us to create or edit a cron job. Let’s create a cron job that change root password every 1 minute.
*/1 * * * * echo 'root:pwned' | sudo chpasswd
1 |
|
My teammate found another way to privesc, easier. Since crontab it uses vim we can just do :!/bin/bash
! :D
Let’s read the flags:
1 |
|
Thank You
Thank you for taking the time to read my writeup. If you don’t understand something from the writeup or want to ask me something feel free to contact me through discord(0xatom#8707) or send me a message through twitter 0xatom
Until next time keep pwning hard!