# TryHackMe Mr. Robot Boot2Root—Writeup

Welcome back to my writeup!! I’ll walk you through a detailed, step-by-step breakdown of how I successfully **compromised the Mr. Robot Boot2Root Challenge** on TryHackMe. We'll go through everything — from initial enumeration, exploiting vulnerabilities, gaining foothold, escalating privileges, all the way to full system compromise. Let's dive in!

**Reconnaissance**

First, we’ll perform a port scan using Nmap to identify any open services that could serve as entry points.&#x20;

`nmap -sC -sV --script http-enum <target_ip>`

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FlJduBQqp8Ao9QheiEI2O%2FScreenshot%20(713).png?alt=media&#x26;token=4b9c5578-fa91-44ce-bd6d-0786371adc7b" alt=""><figcaption><p>We use the http-enum NSE of nmap to enumerate directories and files of the target web server.</p></figcaption></figure>

As shown in the scan results, **ports 22 (SSH), 80 (HTTP), and 443 (HTTPS)** are open. Taking a closer look, the http-enum NSE script did exactly what it's designed for — it successfully enumerated and revealed a list of directories and files hosted on the target web server.

Now let's visit the webpage

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FJxpZcQESvKe77Q3hjxCi%2FScreenshot%20(717).png?alt=media&#x26;token=f41ed0d7-f2fb-4adf-b85b-45bc3b71c309" alt=""><figcaption><p>This is the webserver. Kinda cool XD!</p></figcaption></figure>

After executing various commands on the web server with no success, I went back to analyze the Nmap scan results more closely. It became apparent that several of the discovered paths were associated with WordPress, confirming that the site is indeed using WordPress as its content management system. Navigating to **wp-login.php** brought up the familiar WordPress login interface as usual.

**Enumeration**

I attempted to log in using some common username and password combinations, but none were successful. So now, let’s take it a step further by intercepting the login request with **Burp Suite** to analyze the process and look for any potential vulnerabilities.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FZlGx9dI5JnKP9Mwsee8r%2FScreenshot%20(725).png?alt=media&#x26;token=3c6e4a12-40a7-42b0-b423-f2b31f4b891b" alt=""><figcaption></figcaption></figure>

Did you notice something? The request contains two parameters: **log** and **pwd**, which represent the username and password fields in the HTTP POST request. Additionally, the error message returned is **Invalid**. This suggests that we can use **Hydra** to **brute-force** the login by targeting these two parameters with the **http-post-form** method. This method allows us to automate the process of submitting multiple login attempts to identify valid credentials.

Hold on a second, before we proceed with brute-forcing, we need a wordlist. But where can we get one? After revisiting the Nmap scan results, I noticed something I initially overlooked: the presence of a **robots.txt** file on the web server. For context, **robots.txt** is a file used by websites to give instructions to web crawlers about which pages or directories should not be indexed. While it's meant for search engine bots, it can sometimes unintentionally reveal hidden or sensitive paths.

When I visit the robots.txt, these are the files

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FFMNX0NTOOfPEM6t0nky5%2FScreenshot%20(764).png?alt=media&#x26;token=998d9107-154b-4915-9788-5da773e1e8f1" alt=""><figcaption></figcaption></figure>

As shown, there are two interesting files: **fsocity.dic** and **key-1-of-3.txt**. To retrieve them, we can simply use the **wget** command to download the files directly to our terminal. And just like that, we’ve successfully obtained the **first flag**!

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FSwTL8Vf1ZxWfvXCVQrMC%2FScreenshot%20(719).png?alt=media&#x26;token=57d89909-42bf-44d4-8c6b-282d98982c47" alt=""><figcaption></figcaption></figure>

So, what exactly is **fsocity.dic**? After inspecting its contents, I found that it contains a list of words, many of which are related to *Mr. Robot*. Given the **.dic** extension, it’s evident that this is a dictionary file, intended for brute-force or wordlist-based attacks. However, one thing that stood out to me was the presence of **duplicate entries** within the file.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FPEM87Xx78THkuOz8gKpA%2FScreenshot%20(721).png?alt=media&#x26;token=7b01f700-5940-4adf-ab9b-2450e8d12533" alt=""><figcaption></figcaption></figure>

So what I've did is to **sort** the dictionary file and get only the unique once.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FrOBHvjlY6W60cPLbtXZE%2FScreenshot%20(722).png?alt=media&#x26;token=09c3d703-9610-4ed7-80d8-7131302f227a" alt=""><figcaption><p>As you can see, the unique once are only 11451, really save our time.</p></figcaption></figure>

All I need to do is to save it to a new wordlist.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FgZhWCT53Lnk2ppL42h00%2FScreenshot%20(723).png?alt=media&#x26;token=e324fd6f-7a5b-467e-a8ad-7da52e29ce31" alt=""><figcaption></figcaption></figure>

**Exploitation**

Now that we have the wordlist, let's start to bruteforce the wordpress login.

Our approach for this is straightforward, we’ll start by brute-forcing the **username**, since both the username and password are currently unknown. Once we’ve successfully identified a valid username, we’ll move on to brute-forcing the **password** to complete the login.&#x20;

*`hydra -L wordlist.txt -p bruhbruh 10.10.245.109 http-post-form '/wp-login.php:log=^USER&pwd=^PASS^: Invalid' -t 10`*&#x20;

Now what does our payload mean? (***'/wp-login.php:log=^USER\&pwd=^PASS^: Invalid'***) is the format Hydra uses to interact with web login forms. The first part, **/wp-login.php**, is the path to the login page. The second part, **log=^USER\&pwd=^PASS^**, tells Hydra where to inject the usernames and passwords from our lists, it replaces **^USER^** and **^PASS^** with each attempt. Lastly, **Invalid** is the failure condition; Hydra looks for this keyword in the response to determine if the login attempt failed. If the word "Invalid" doesn’t appear, Hydra assumes the credentials were successful.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2Fz9I3oYpk1ghO9IfHAwdR%2FScreenshot%20(729).png?alt=media&#x26;token=a03636f7-478a-455d-bfe4-f5388a141bd0" alt=""><figcaption></figcaption></figure>

Now the username is **elliot**. It's time for our password! But first, take a look when I attempt to login as elliot.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FhK4guxJ4mRxo4kPVj4Ig%2FScreenshot%20(731).png?alt=media&#x26;token=83c1bcd5-e952-4209-be17-6f11abafa0d9" alt=""><figcaption><p>It seems that elliot is a valid user.</p></figcaption></figure>

Now, the error we receive is different from **Invalid** to **Incorrect.** So, to keep our brute-force working properly, we need to update the error condition in our payload accordingly.

*`hydra -l elliot -P wordlist.txt 10.10.245.109 http-post-form '/wp-login.php:log=^USER&pwd=^PASS^: Incorrect' -t 10 -VVV`*

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F5QSKqgBHljcE3MafspgA%2FScreenshot%20(733).png?alt=media&#x26;token=c4069c73-d55d-483b-bf83-edfcf93f136b" alt=""><figcaption></figcaption></figure>

&#x20;Now that we have all the credentials **elliot:ER28-0652,** let's login!

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FJnryQarVCZ3Rh3bK2OA2%2FScreenshot%20(734).png?alt=media&#x26;token=10208604-5541-40ec-b9aa-f9f79c348808" alt=""><figcaption></figcaption></figure>

We're in!! It turns out that elliot is the admin user!

Now all we need to do is to gain a reverse shell! Since we are the admin here, we can modify the **.php** files inside **appearance** tab.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FmhFPBg0hRtWp0s5QcpMp%2FScreenshot%20(741).png?alt=media&#x26;token=d3bb4487-d7a4-41de-ae05-24fd149cf2e1" alt=""><figcaption></figcaption></figure>

We can modify this 404 template to gain a reverse shell, so I visit pentestmonkey for this and use his reverse shell payload for php. Here's the [link](https://github.com/pentestmonkey/php-reverse-shell/blob/master/php-reverse-shell.php) for the payload.&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FYydnHY6xkhbavZ71gB30%2FScreenshot%20(742).png?alt=media&#x26;token=6c927bdc-e7a0-417b-a128-2a4ceb403cff" alt=""><figcaption></figcaption></figure>

All we need to do is to setup our listener.

*`nc -lnvp 4444`*&#x20;

Browse a random directory to trigger the 404 template.&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FXaAnJ0dLBwvvn9T5xcii%2FScreenshot%20(744).png?alt=media&#x26;token=d0a55eba-72b3-4933-86f4-5f7c8e55b607" alt=""><figcaption></figcaption></figure>

Let's spawn a pty shell for better prompt.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2Fdn13GWIBx9rs5KVmn1mI%2FScreenshot%20(746).png?alt=media&#x26;token=792a9cf0-5721-4d8a-a20b-3de02be423cb" alt=""><figcaption></figcaption></figure>

Yes, I already checked the the robot user, and their are 2 files inside it.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FjiGzbtAaiZ2NBFYiw0Mf%2FScreenshot%20(747).png?alt=media&#x26;token=edd8288e-7d6f-4380-bc2f-599519f5af79" alt=""><figcaption></figcaption></figure>

There's the second flag! But hold up..

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FBgW8gFi3ILOtyLKLtW9i%2FScreenshot%20(749).png?alt=media&#x26;token=e6cc18f5-f1a7-47f2-a67e-e07b304f6d64" alt=""><figcaption></figcaption></figure>

Why permission denied? Well, if we check the file permissions, this is the result

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FmhS6A5HYLdj46XDQMejy%2FScreenshot%20(750).png?alt=media&#x26;token=03da69ce-3954-44c0-bf18-3f5dd1f9eabc" alt=""><figcaption></figcaption></figure>

If you're familiar with Linux file permissions, you’ll notice that the second key is owned by the user **robot** — and since we’re not logged in as robot, we don’t have permission to access it. Fortunately, there’s another readable file available to us: **password.raw-md5**.

I've checked the content and this is the result.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FtBIUdp0gYL20bXpIT9ty%2FScreenshot%20(751).png?alt=media&#x26;token=922e7d3b-ab40-4e20-ab21-eda43c08ce2c" alt=""><figcaption></figcaption></figure>

Looks like an MD5 hash, let's crack it using **john!**

Let's save the hash to our local machine

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F8ajzUhnBvL9U5EMhHxHg%2FScreenshot%20(752).png?alt=media&#x26;token=35964b7d-9577-4587-a0b3-896d0cc0a965" alt=""><figcaption></figcaption></figure>

Now let's crack it using **john**!!

*`john --format=raw-md5 --wordlist=/usr/share/wordlists/rockyou.txt hash`*

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FugDiu0drkoHH4DjETaiC%2FScreenshot%20(753).png?alt=media&#x26;token=1a8dde1d-da96-449c-b16c-821a96eb4bc4" alt=""><figcaption></figcaption></figure>

It turns out that the password of robot is full alphabet! Now let's switch to user robot and get the 2nd flag!

*`su robot`*&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F7jfAfyiajYqNl1WTIbgu%2FScreenshot%20(754).png?alt=media&#x26;token=e937932e-890d-4e4d-88b0-021b22e00ea8" alt=""><figcaption></figcaption></figure>

We're now user robot!!!&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FlOkQGvWV14zbHj7K6kHw%2FScreenshot%20(756).png?alt=media&#x26;token=10bab232-ae7c-481e-a276-6126a1b6884a" alt=""><figcaption><p>2nd flag!!</p></figcaption></figure>

**Privilege Escalation**

Our objective now is to gain root access by escalating privileges.

*`find / -type f -perm -04000 2>/dev/null`*&#x20;

This command is used to search the entire filesystem (**/**) for **regular files** (**-type f**) that have the **SUID (Set User ID) permission bit** set (**-perm -04000**). SUID allows users to execute a file with the permissions of the file owner, typically root. This is often used by system utilities that need elevated privileges. The part **2>/dev/null** is used to **suppress error messages**, such as "Permission denied", by redirecting standard error (**2**) to **/dev/null**. This command is commonly used in **privilege escalation** during penetration testing or system auditing to find potential security risks.

This is the strangest part, it has **Nmap**!!

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F3JTfyMWxk5P1TJ2r4beu%2Flolo.png?alt=media&#x26;token=d2cdc620-f3a9-40c0-9490-50dd29091699" alt=""><figcaption></figcaption></figure>

It's unusual to find a tool like this on a CTF machine. When I executed it, this was the output.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FiYmi131Kb4wbmdUhzeSH%2FScreenshot%20(757).png?alt=media&#x26;token=1191a40f-564a-4715-8fb7-5cf841e517ee" alt=""><figcaption></figcaption></figure>

This seems to be an older version of Nmap since it includes an interactive mode. I launched it in interactive mode and saw this.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F6xXmqV0Jkqa2CNCKFlUX%2FScreenshot%20(759).png?alt=media&#x26;token=33127a3e-2bed-4159-8483-62a679379eb9" alt=""><figcaption></figcaption></figure>

As shown here, this command is available. From what I remember, entering a command that starts with an exclamation mark, like **!whoami**, triggers privilege escalation and will return as root.&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FeReIgTxotlORnshZrRap%2FScreenshot%20(760).png?alt=media&#x26;token=6fdab037-342e-4dd4-a43e-c8ec840d9e09" alt=""><figcaption></figcaption></figure>

It works!!! It returns as root! Now to get a root shell, just change the **whoami** to **sh.**

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FIT0c4Avespn1ohrlmSQS%2FScreenshot%20(761).png?alt=media&#x26;token=b1890d02-8db9-44d0-9841-052395e0ed74" alt=""><figcaption></figcaption></figure>

We're root!!

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F7PN8wIwr7OHzgIRHTWRl%2FScreenshot%20(763).png?alt=media&#x26;token=8a050ba3-4eff-472c-96d3-de54a196fa03" alt=""><figcaption><p>Mr. Robot Complete</p></figcaption></figure>

**ANNOUNCEMENT FROM KUR0SH1R0**

I’ve decided to step away from CTFs and any hacking-related activities for now. With midterm exams coming up, I need to concentrate fully on my studies and make sure I’m prepared. It’s a short-term sacrifice, but I know this focus will help me perform better in the long run. Once the exams are behind me, I’ll dive back into the challenges and continue working towards my goals. Adios!
