This is a small write-up for Mr Robot CTF, If I got anything wrong, please feel free to correct me or share any other insights.

# Task 1 — Connect to our network

None

Connect to TryHackMe network using AttackBox or OpenVPN.

# Task 2 — Hack the machine

None

Key 1

Reconnaissance the machine using Nmap.

nmap -sC -sV <target ip>
  • -sC : Use Nmap default script.
  • -sV : Probe open ports to determine service/version info.
None

The machine web server is opened, let's see what it has.

None

It looks like it is just a web page for Fsociety, try to find out if there are other pages using Gobuster.

gobuster dir -u <target url> -w /path/to/wordlists
None
None

There are many interesting pages.

Go to the /robots page and we got something.

None

There is a file named fsociety.dic that looks like wordlists for something and key-1-of-3.txt that we want.

None

Key 2

We have to log in, it seems like we have to brute-forcing the username and password with the wordlists we got (fsociety.dic), but there is another way.

None

Go to /license and scroll down, then we will get credentials to log in.

None
None
None

Now we can access /wp-admin .

None

We can edit the code pages of each theme.

None

Add the reverse shell code (php-reverse-shell) to 404.php of TwentyFifteen theme, then config the IP and port to receive the connection from the target machine.

None

Create a reverse shell listener using Netcat.

nc -lvnp <port>
  • -l : listen mode (wait for inbound connections).
  • -v : verbose (print connection info).
  • -n : numeric (don't do DNS lookups; show IPs instead of trying to resolve hostnames).
  • -p : port to listen on.
None

Go to /wp-includes/themes/TwentyFifteen/404.php ,the page where we just added the reverse shell code.

None

We have shell, then find the second key.

None
None

We need the permission to access the key file.

None

We found a password hash file for a user named robot, it is an raw-md5 hash, which is not secure. Let's try to crack the hash using John The Ripper.

None
john -format=raw-md5 -w=/path/to/wordlists <filename>
  • -format=raw-md5 : Use the hash format as raw-md5.
  • -w=/path/to/wordlists : Specify the path of the wordlists.
None

We have the password, then log in as the user robot.

None

Try accessing the key file.

None

We have got the second key!

Key 3

This is the last key, it requires root privileges to access.

None

We need to do privilege escalation, starting with finding the binary file with SUID permission, because if the binary file with SUID permission is configured incorrectly, it may allow users without root privileges to access higher/root level resources.

find / -perm -u=s -type f 2>/dev/null
  • -perm -u=s : Runs with the owner's privileges (often root) instead of the user who executes it.
  • -type f : Only match files.
  • 2>/dev/null : Don't show errors on screen.
None

Let's find the payload used to do privilege escalation exploit using GTFOBins.

None
None

We found a useful nmap payload, it is time to exploit.

None

Now we have root privileges, then find the last key.

None
None

It was fun, I learned a lot of things like such as :

  • Port Scanning
  • Directory Brute-forcing
  • Remote Code Execution / Unrestricted File Upload
  • Reverse Shell
  • Password Cracking
  • Privilege Escalation

And again, if I gave any incorrect technical information, I apologize.