RootMe

Task 1: Deploy the machine

Deploy the machine

No answer needed

Task 2: Reconnaissance

Scan the machine, how many ports are open?

  • Let's run a nmap scan to see which ports are open.

  • There are two open ports:

Port
Service

22

ssh

80

http

Answer

What version of Apache is running?

Answer

What service is running on port 22?

Answer

Find directories on the web server using the GoBuster tool.

  • We can find directories with the following command:

No answer needed

What is the hidden directory?

Answer

Task 3: Getting a shell

user.txt

  • In order to get a reverse shell, we have to first go to the /panel directory.

  • There are multiple ways of obtaining a reverse shell. We will be using a php reverse shell.

  • We will be using the /usr/share/webshells/php/php-reverse-shell.php script after making some modifications.

  • We have to replace the IP address with our own IP address which we can find using the ip command. We can also change the port to any particular port we want like 9999.

  • Once we have replaced the IP address we are ready to upload our php-reverse-shell.php file.

  • Let's click on the Upload button next.

  • Looks like php is not allowed.

  • There is a workaround for this, we can try to change the file extension to php5 to see if that is allowed.

  • Let's hit Upload.

  • Our file upload has been successful.

  • We can now use netcat to listen for requests.

  • Next, let's go to the /uploads folder.

  • On clicking on the php-reverse-shell.php5 link, a request will be sent to our IP address on the 9999 port which will be caught by our netcat listener.

  • We have our reverse shell.

  • Let's find the user.txt file using the find command.

  • Now we simply have to cat the file.

Answer

Task 4: Privilege escalation

Search for files with SUID permission, which file is weird?

  • Again, we can use the find command to find the relevant file.

  • Out of all the binaries with the SUID bit set, the /usr/bin/python binary is the most unusual.

Answer

Find a form to escalate your privileges.

  • We will be using the python utility to escalate our privilege since it already has the SUID bit set.

  • But before we do that, we need to check out GTFObins for a shell script.

  • We have to use the selected script with the /usr/bin/python interpreter.

  • We have successfully escalated our privilege to root.

No answer needed

root.txt

  • Let's find the root.txt file.

  • All we have to do now is cat the file.

Answer

Last updated

Was this helpful?