<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Write-ups%2FTHM%2FMr_Robot</id>
	<title>Write-ups/THM/Mr Robot - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Write-ups%2FTHM%2FMr_Robot"/>
	<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Write-ups/THM/Mr_Robot&amp;action=history"/>
	<updated>2026-04-21T15:20:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://book.ghanim.no/index.php?title=Write-ups/THM/Mr_Robot&amp;diff=1143&amp;oldid=prev</id>
		<title>imported&gt;Aghanim at 10:23, 6 August 2021</title>
		<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Write-ups/THM/Mr_Robot&amp;diff=1143&amp;oldid=prev"/>
		<updated>2021-08-06T10:23:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox WriteUp&lt;br /&gt;
| name = Mr Robot&lt;br /&gt;
| platform = TryHackMe&lt;br /&gt;
| os = Linux&lt;br /&gt;
| difficulty = Medium&lt;br /&gt;
| techniques = WordPress, SUID&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-14.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://www.tryhackme.com/room/mrrobot https://www.tryhackme.com/room/mrrobot]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an interesting CTF where the objective is to find 3 keys. As always we start with the enumeration stage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Enumeration ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
root@ip-10-10-127-105:~/ctf# nmap -sC -sV 10.10.81.39 -oN nmap-result&lt;br /&gt;
&lt;br /&gt;
Starting Nmap 7.60 ( https://nmap.org ) at 2021-08-06 10:42 BST&lt;br /&gt;
Nmap scan report for ip-10-10-81-39.eu-west-1.compute.internal (10.10.81.39)&lt;br /&gt;
Host is up (0.00041s latency).&lt;br /&gt;
Not shown: 997 filtered ports&lt;br /&gt;
PORT    STATE  SERVICE  VERSION&lt;br /&gt;
22/tcp  closed ssh&lt;br /&gt;
80/tcp  open   http     Apache httpd&lt;br /&gt;
|_http-server-header: Apache&lt;br /&gt;
|_http-title: Site doesn&amp;#039;t have a title (text/html).&lt;br /&gt;
443/tcp open   ssl/http Apache httpd&lt;br /&gt;
|_http-server-header: Apache&lt;br /&gt;
|_http-title: Site doesn&amp;#039;t have a title (text/html).&lt;br /&gt;
| ssl-cert: Subject: commonName=www.example.com&lt;br /&gt;
| Not valid before: 2015-09-16T10:45:03&lt;br /&gt;
|_Not valid after:  2025-09-13T10:45:03&lt;br /&gt;
MAC Address: 02:6D:E8:5E:D7:8B (Unknown)&lt;br /&gt;
&lt;br /&gt;
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .&lt;br /&gt;
Nmap done: 1 IP address (1 host up) scanned in 30.30 seconds&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are 2 ports open and 1 closed. We&amp;#039;ll take a look at the webserver.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-xxxxx.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interesting website. The commands show us videos and pictures, but nothing that can help us find the keys.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ll try to see if we can find any hidden directories. We&amp;#039;ll use gobuster.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
root@ip-10-10-127-105:~/ctf# gobuster dir -u http://10.10.81.39 -w /usr/share//wordlists/dirb/common.txt &amp;gt; gobuster.result&lt;br /&gt;
root@ip-10-10-127-105:~/ctf# cat gobuster.result&lt;br /&gt;
===============================================================&lt;br /&gt;
Gobuster v3.0.1&lt;br /&gt;
by OJ Reeves (@TheColonial) &amp;amp; Christian Mehlmauer (@_FireFart_)&lt;br /&gt;
===============================================================&lt;br /&gt;
[+] Url:            http://10.10.81.39&lt;br /&gt;
[+] Threads:        10&lt;br /&gt;
[+] Wordlist:       /usr/share//wordlists/dirb/common.txt&lt;br /&gt;
[+] Status codes:   200,204,301,302,307,401,403&lt;br /&gt;
[+] User Agent:     gobuster/3.0.1&lt;br /&gt;
[+] Timeout:        10s&lt;br /&gt;
===============================================================&lt;br /&gt;
2021/08/06 10:45:46 Starting gobuster&lt;br /&gt;
===============================================================&lt;br /&gt;
/.hta (Status: 403)&lt;br /&gt;
/.htaccess (Status: 403)&lt;br /&gt;
/.htpasswd (Status: 403)&lt;br /&gt;
/0 (Status: 301)&lt;br /&gt;
/admin (Status: 301)&lt;br /&gt;
/audio (Status: 301)&lt;br /&gt;
/blog (Status: 301)&lt;br /&gt;
/css (Status: 301)&lt;br /&gt;
/favicon.ico (Status: 200)&lt;br /&gt;
/images (Status: 301)&lt;br /&gt;
/index.html (Status: 200)&lt;br /&gt;
/intro (Status: 200)&lt;br /&gt;
/js (Status: 301)&lt;br /&gt;
/license (Status: 200)&lt;br /&gt;
/phpmyadmin (Status: 403)&lt;br /&gt;
/readme (Status: 200)&lt;br /&gt;
/robots (Status: 200)&lt;br /&gt;
/robots.txt (Status: 200)&lt;br /&gt;
/sitemap (Status: 200)&lt;br /&gt;
/sitemap.xml (Status: 200)&lt;br /&gt;
/video (Status: 301)&lt;br /&gt;
/wp-admin (Status: 301)&lt;br /&gt;
/wp-content (Status: 301)&lt;br /&gt;
/wp-includes (Status: 301)&lt;br /&gt;
===============================================================&lt;br /&gt;
2021/08/06 10:46:17 Finished&lt;br /&gt;
===============================================================&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looking through all of the directories, there is one interesting in particular. &amp;#039;&amp;#039;&amp;#039;/lincense&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;robots.txt. &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== First key! ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the robots.txt we find the first key.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-3.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can open the first key by navigating to&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
10.10.102.201/key-1-of-3.txt&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-10.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Second key! ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next we investigate /license directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-1.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scrolling down on this webpage we get a password thats base64 encoded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decoding the base64 we get the username and password for Elliot.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Looking back at the gobuster result, we saw that this is a wordpress webiste. Navigating to /wp-admin we can try and login with Elliots user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-2.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 And we&amp;#039;re in!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reverse Shell ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will try and get a reverse shell. In the Appearance section we can edit a theme called Twenty Fifteen. In the Editor we can edit 404 Template. Its a php website so we will inject a php reverse shell.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-xxxxxxx.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will save and open a listener on our attacker machine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
nc -lvnp 4444&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Opening the 404.php website will active our shell and give us a reverse shell.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-xxxxxxxxxxxxxxxx.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We navigate to /home/robot and try to open the second we get permission denied.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-4.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But we see that there is another file there called &amp;#039;&amp;#039;&amp;#039;password.raw-md5&amp;#039;&amp;#039;&amp;#039;. Judging by the title, this is hashed with MD5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-6.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can either crack this ourselves or go to crackstation. The latter is easiest as Im sure this hash is found in some rainbow table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After cracking the hash, we will try logging in using the user robots credentials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-7.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We get an error message saying that we must run the command from a terminal. So we will stabilize the reverse shell using these commands.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
python -c &amp;#039;import pty;pty.spawn(&amp;quot;/bin/bash&amp;quot;)&amp;#039;&lt;br /&gt;
export TERM=xterm&lt;br /&gt;
&lt;br /&gt;
# Background the shell with CTRL+z&lt;br /&gt;
stty raw -echo; fg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-8.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now we can open the second key.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-9.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Third key! and PrivEsc ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will try to escalate our privileges. We will look for sudo rights, SUID and capabilites. We can also use linpeas which is an amazing script for finding privilege escalation vectors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Running this command will list files with SUID bit set.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
robot@linux:~$ find / -perm -u=s -type f 2&amp;gt;/dev/null&lt;br /&gt;
/bin/ping&lt;br /&gt;
/bin/umount&lt;br /&gt;
/bin/mount&lt;br /&gt;
/bin/ping6&lt;br /&gt;
/bin/su&lt;br /&gt;
/usr/bin/passwd&lt;br /&gt;
/usr/bin/newgrp&lt;br /&gt;
/usr/bin/chsh&lt;br /&gt;
/usr/bin/chfn&lt;br /&gt;
/usr/bin/gpasswd&lt;br /&gt;
/usr/bin/sudo&lt;br /&gt;
/usr/local/bin/nmap&lt;br /&gt;
/usr/lib/openssh/ssh-keysign&lt;br /&gt;
/usr/lib/eject/dmcrypt-get-device&lt;br /&gt;
/usr/lib/vmware-tools/bin32/vmware-user-suid-wrapper&lt;br /&gt;
/usr/lib/vmware-tools/bin64/vmware-user-suid-wrapper&lt;br /&gt;
/usr/lib/pt_chown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One file standing out is nmap. Navigating to gtfobins we will try to spawn a shell with root permissions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-11.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-12.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And we are root! and have the last key!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2021-08-image-13.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Very interesting CTF and a good challenge if you&amp;#039;re a beginner.&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:TryHackMe]]&lt;br /&gt;
[[Category:Write-ups]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Aghanim</name></author>
	</entry>
</feed>