RootMe Walkthrough
One of the best ways to learn ethical hacking is to practice it. So below is a walkthrough of the RootMe Room on THM
Reconnaissance
Nmap
As with most machines, I began with an Nmap scan - which answers the first few questions.
I firstly scanned with sV to determine the software versions, however as the target wouldn’t respond to host discovery, I had to disable it using the -Pn option.
|
|
Directory Searching
Next we had to preform a directory brute force, so I started dirb.
|
|
Getting a Shell
From the recon above, we discover the page /panel/ and when we navigate to that page, we are presented with a file upload area.
Now I wondered if we could upload a shell and as we know the server runs Apache I grabbed the Pentest Monkey Reverse PHP Shell.
Firstly, we setup a netcat listener ready to receive the shell on the attacking machine.
|
|
Next I edited line 49 of the shell to match my attacking machine’s IP address and uploaded it to the website.
Once we uploaded the file, we are provided with a success message; it says Veja - which means go. So if you click on the link it will open the file, this will cause the page to freeze.
Now we return to the netcat listener and we have received a shell and can find the user flag.
Privilege Escalation
Now we have found the user flag, we need to escalate our privileges. To do this, I used to find files with a SUID bit.
|
|
From that, you need to look at the list and see if there are any unusual files. Unfortunately, this step needs experience for you to know what is unusual; therefore I advise that you enter the file names into GTFObins and looking for SUID exploits.
After running down the list, you discover that python has a SUID vulnerability, so now you run it on the reverse shell.
Once the exploit is complete, I use the whoami command to check it worked
|
|
From here you need to find the root flag by outputting the file in the root users home directory.