πŸ’€Mr Robot CTF

Based on the Mr. Robot show, can you root this box?

https://tryhackme.com/room/mrrobotarrow-up-right
Room Attributes
Value

Subscription Required

False [Free]

Type

Challenges (CTF)

Difficulty

Medium

Tags

MrRobot, Root, Beginner

Video Walkthrough

TryHackMe Mr Robot Official Walkthrough

Task 1 - Connect to our network

Go to your accessarrow-up-right page and download your configuration file.

circle-check

Use an OpenVPN client to connect. In my example I am on Linux, on the access page we have a windows tutorial.

circle-check

You are now ready to use our machines on our network!

circle-check

Now when you deploy material, you will see an internal IP address of your Virtual Machine.

circle-check

Task 2 - Hack the machine

What is key 1?

Running nmap or rustscan against the target returns two open ports on port 80 and 443.

circle-exclamation

Checking the robots.txtarrow-up-right file shows two interesting files:

  • fsocity.dic

  • key-1-of-3.txt

robots.txt

key-1-of-3.txt contains the first flag:

chevron-rightReveal Flag 🚩hashtag

🚩073403c8a58a1f80d943455fb30724b9

What is key 2?

Next run dirb, dirbuster, or gobuster against the target to find some interesting URLs:

/0 opened a wordpress blog. Going to the login screen http://TARGET_IP/wp-login.php shows the wordpress login screen. Entering the username 'admin' and the password 'admin' presents an error message:

triangle-exclamation

This page can be used to enumerate valid usernames as when providing the username 'elliot' (the main character's name in Mr. Robotarrow-up-right) the error states the password is wrong:

triangle-exclamation

Looking at fsocity.dic there are a number of duplicate entries so we can strip those out to optimise the wordlist:

We can then use wpscanarrow-up-right, hydraarrow-up-right, or burp suite intruderarrow-up-right (slow) to brute force the password.

You should find the password around the 5000th attempt.

chevron-rightElliot's Passwordhashtag

ER28-0652

circle-exclamation

Once logged into wordpress as an admin we can check out the image gallery. One image has white text in the background which reveals another username and also their password:

hello friend

In order to turn our wordpress access into a shell we can edit the templates to add the PHP PenTestMonkeyarrow-up-right reverse shell pointing to your tun0 IP address into the 404.php template file:

https://www.revshells.com/arrow-up-right
Adding PHP PenTestMonkeyarrow-up-right reverse shell to the 404.php template file

Start a netcat listener on your machine then open the 404.php page in a browser to trigger the reverse shell.

With a shell we can extract the md5 hash from password.raw-md5 from the daemon /home/robot/ directory:

We can reverse the hash using crackstationarrow-up-right:

https://crackstation.net/arrow-up-right
Hash
Type
Result

c3fcd3d76192e4007dfb496cca67e13b

md5

(expand below)

chevron-rightrobot User Passwordhashtag

abcdefghijklmnopqrstuvwxyz

Trying to cat key-2-of-3.txt we find that we don't have adequate permissions:

Trying to run su results in an error message saying we need to run it in a terminal

To get past this we need to upgrade our shell to a TTY shell:

https://netsec.ws/?p=337arrow-up-right
chevron-rightReveal Flag 🚩hashtag

🚩822c73956184f694993bede3eb39f959

What is key 3?

circle-exclamation

The final flag is in the root directory so in order to reach that we need to privilege escalate our current shell. Searching the filesystem for files with the SUID bit set we find that nmap is installed and SUID is set:

GTFOBins shows the steps to run nmap in interactive mode which you can abuse to run commands as root:

https://gtfobins.github.io/gtfobins/nmap/arrow-up-right

With root shell we can access the root directory and obtain our final flag!

chevron-rightReveal Flag 🚩hashtag

🚩04787ddef27c3dee1ee161b21670b4e4

Last updated