{"id":238,"date":"2023-04-07T17:49:23","date_gmt":"2023-04-07T17:49:23","guid":{"rendered":"https:\/\/infosecjake.net\/?p=238"},"modified":"2023-04-07T17:49:24","modified_gmt":"2023-04-07T17:49:24","slug":"tryhackme-mr-robot-ctf-walkthrough","status":"publish","type":"post","link":"https:\/\/infosecjake.net\/?p=238","title":{"rendered":"Tryhackme &#8211; Mr Robot CTF Walkthrough"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"772\" height=\"203\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image.png\" alt=\"\" class=\"wp-image-239\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image.png 772w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-300x79.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-768x202.png 768w\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" \/><\/figure>\n\n\n\n<p>Hey everyone, back for another CTF box from Tryhackme.com. This time Mr Robot CTF. I really enjoyed the show, so I\u2019m excited to see what easter eggs there may be in this box. Let\u2019s get started.<\/p>\n\n\n\n<p>First, as usual, we want to connect to the VPN for Tryhackme. The site has a good walkthrough on how to do this, so I\u2019ll refrain from duplicating instructions on that.<\/p>\n\n\n\n<p>After connecting to VPN, we need to join the room and start the Mr Robot box. Wait for the IP to display before taking any further action.<\/p>\n\n\n\n<p>After the box is up, we need to start off with an Nmap scan. We always want to start by discovering what ports and services are open on the machine. This gives us a better understanding of where we will need to start looking for vulnerabilities that we can exploit to gain access to the system.<\/p>\n\n\n\n<p>We are going to start with a simple Nmap scan using the -A flag. This flag enables OS detection, version detection, script scanning, and even traceroute. The reason I want to detect OS and service versions is to better help me look for vulnerabilities in older, out of date, software.<\/p>\n\n\n\n<p>Here\u2019s the results of our Nmap scan:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"421\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-1.png\" alt=\"nmap scan\n\" class=\"wp-image-240\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-1.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-1-300x130.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-1-768x332.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Now, I should note that by default, Nmap does not scan ALL ports on a system. This is because a full system scan can take a long time. It scans the top 1,000 ports, unless you specify otherwise with different flags. These ports are where most services typically run.<\/p>\n\n\n\n<p>Our results show that we have 3 ports open. SSH, HTTP, and HTTPS. So we have a secure shell service and then a web service running.<\/p>\n\n\n\n<p>Since that leaves us with little option to start off with, lets jump straight into checking out this website.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"285\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-2.png\" alt=\"website\" class=\"wp-image-241\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-2.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-2-300x88.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-2-768x224.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Loading the site brings up a CLI type screen that you can directly interact with. A list of acceptable commands are given that you can type out on the command prompt. I\u2019ll poke around with this to see what I can find.<\/p>\n\n\n\n<p>Poking around with the commands you get some cool videos and references to the show.<\/p>\n\n\n\n<p>Aside from the references to the show, I\u2019m not finding much here.<\/p>\n\n\n\n<p>So, let\u2019s use a tool that will help us search the site itself for other directories that we may be able to access.<\/p>\n\n\n\n<p>For this, I\u2019m going to use the Dirb tool within Kali linux. This will scan the site and look for any interesting directories from a dictionary file that it uses. Just a heads up, this scan will take a bit.<\/p>\n\n\n\n<p>Here are the results (most of it anyways):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"559\" height=\"1024\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-3-559x1024.png\" alt=\"Dirb results\" class=\"wp-image-242\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-3-559x1024.png 559w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-3-164x300.png 164w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-3.png 684w\" sizes=\"auto, (max-width: 559px) 100vw, 559px\" \/><\/figure>\n\n\n\n<p>From the start, we can see some interesting directories such as \/admin, \/robots.txt, \/login, \/phpMyAdmin, and others. So, what we should do next is start browsing those pages for anything of interest that may give us a way in.<\/p>\n\n\n\n<p>First up, robots.txt. This txt file is used by web services to tell search engines what pages on the site that it should not spider or save a history of. Essentially, it\u2019s a \u201cdon\u2019t look here\u201d list. Which, funnily enough, is why we want to look there.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"970\" height=\"275\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-4.png\" alt=\"robots.txt\" class=\"wp-image-243\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-4.png 970w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-4-300x85.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-4-768x218.png 768w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/figure>\n\n\n\n<p>Well, looks like we have our first key.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"911\" height=\"203\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-5.png\" alt=\"1st key\" class=\"wp-image-244\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-5.png 911w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-5-300x67.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-5-768x171.png 768w\" sizes=\"auto, (max-width: 911px) 100vw, 911px\" \/><\/figure>\n\n\n\n<p>Copy the key and paste it into the first key answer field on the page to get your first key logged.<\/p>\n\n\n\n<p>Let\u2019s continue!<\/p>\n\n\n\n<p>Next up, I tried the \/admin page, but it seemed to load a CLI type screen that continually tried to load. Appears to be a dead end. Next up, I tried the \/login page. This takes you to a WordPress login page, as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"596\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-6.png\" alt=\"login page\" class=\"wp-image-245\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-6.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-6-300x183.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-6-768x469.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Interesting, there was that other file on the \/robots.txt page that lists a fsocity.dic file. Let\u2019s just navigate to that and grab it for ourselves.<\/p>\n\n\n\n<p>That downloads the file for us, as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"922\" height=\"359\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-7.png\" alt=\"fsocity file\" class=\"wp-image-246\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-7.png 922w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-7-300x117.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-7-768x299.png 768w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-7-920x359.png 920w\" sizes=\"auto, (max-width: 922px) 100vw, 922px\" \/><\/figure>\n\n\n\n<p>I got curious and opened the file, scrolled down a couple lines, and noticed that listed Alderson. Having seen the show, I know that Elliot Alderson is the main character of the show Mr Robot.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"953\" height=\"369\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-8.png\" alt=\"fsocity file view\" class=\"wp-image-247\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-8.png 953w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-8-300x116.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-8-768x297.png 768w\" sizes=\"auto, (max-width: 953px) 100vw, 953px\" \/><\/figure>\n\n\n\n<p>Lets try logging in with his first name as the user and last name as the password.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"627\" height=\"348\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-9.png\" alt=\"failed login\" class=\"wp-image-248\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-9.png 627w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-9-300x167.png 300w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/figure>\n\n\n\n<p>Well, the last name as a password was not correct. However, we did confirm that Elliot is the username from the error message we received.<\/p>\n\n\n\n<p>So, now that we have half of the credentials we need to get into the system, we need to figure out a way to crack the password. The .dic file that we downloaded is probably going to contain the password we need. However, this file is large with tens of thousands of lines. There is no way we can do that line by line, so we\u2019ll need to use a tool to automate this.<\/p>\n\n\n\n<p>A quick google search brought me to this page <a href=\"https:\/\/www.hackingarticles.in\/multiple-ways-to-crack-wordpress-login\/\" target=\"_blank\" rel=\"noopener\" title=\"Hacking Articles\">Multiple Ways to Crack WordPress login &#8211; Hacking Articles<\/a>. Listed in this page are multiple avenues that you can use to brute force a wordpress login. Let\u2019s work with Wpscan first, since it is first on the list.<\/p>\n\n\n\n<p>Instead of using a user list, we\u2019re just going to specify the username Elliot.<\/p>\n\n\n\n<p>Your command should come out like below. FYI, I had to use http instead of https as it was getting an SSL error when trying to use the https address.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"75\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-10.png\" alt=\"wpscan start\" class=\"wp-image-249\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-10.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-10-300x23.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-10-768x59.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Let\u2019s fire it off and see what we get. Side note, brute force attacks with large wordlists can take a long time. Patience is a virtue here.<\/p>\n\n\n\n<p>Side note, while I was waiting for the wpscan to do its magic, I started looking at some of the other directories we found previously. Going down the list, I found the \/license directory. Browsing to that page, you get a nice little text message calling you a script kiddie\u2026.but scrolling down the page it asks if you want a password and what you see below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-11-717x1024.png\" alt=\"license file\" class=\"wp-image-250\" width=\"390\" height=\"557\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-11-717x1024.png 717w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-11-210x300.png 210w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-11-768x1097.png 768w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-11.png 945w\" sizes=\"auto, (max-width: 390px) 100vw, 390px\" \/><\/figure>\n\n\n\n<p>The last line in the image above is a hash. I know from just looking at it, that it is Base64. Primarily because of the = sign at the end. However, if you aren\u2019t aware, you can use online sites to quickly identify and decrypt a Base64 has quickly. As shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"774\" height=\"547\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-12.png\" alt=\"decrypting hash\" class=\"wp-image-251\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-12.png 774w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-12-300x212.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-12-768x543.png 768w\" sizes=\"auto, (max-width: 774px) 100vw, 774px\" \/><\/figure>\n\n\n\n<p>We have our password. So now, we can cancel our brute force, which is still running.<\/p>\n\n\n\n<p>Let\u2019s login to the WordPress site and see what we can find.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"125\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-13.png\" alt=\"WordPress logged in\" class=\"wp-image-252\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-13.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-13-300x38.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-13-768x98.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Inside the WordPress site, there\u2019s really nothing to see. It\u2019s an unused WordPress site with no posts, pages, or comments. There are two users. Elliot is the admin and there is a subscriber.<\/p>\n\n\n\n<p>So, here is where we hit a little bit of conundrum. How do we use this, which we were supposed to get into, to get a shell onto the machine itself?<\/p>\n\n\n\n<p>Off to Google I go.<\/p>\n\n\n\n<p>A quick search and I think I\u2019ve found something that may work. Reverse shell from WordPress on this article: <a href=\"https:\/\/www.hackingarticles.in\/wordpress-reverse-shell\/\" target=\"_blank\" rel=\"noopener\" title=\"Hacking Articles\">WordPress: Reverse Shell &#8211; Hacking Articles<\/a><\/p>\n\n\n\n<p>Let\u2019s start off with the first option, the Metasploit framework attack.<\/p>\n\n\n\n<p>Open a command prompt and type \u2018msfconsole\u2019. This will start up Metasploit.<\/p>\n\n\n\n<p>Once it loads, we are going to use the same module from the article, as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"872\" height=\"75\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-14.png\" alt=\"MSF exploit\" class=\"wp-image-253\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-14.png 872w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-14-300x26.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-14-768x66.png 768w\" sizes=\"auto, (max-width: 872px) 100vw, 872px\" \/><\/figure>\n\n\n\n<p>After entering all the details, as the article above shows, I was not able to get this exploit to run. Metasploit keeps stating that the target does not appear to be running WordPress.<\/p>\n\n\n\n<p>So, let\u2019s move on to the next option on the article.<\/p>\n\n\n\n<p>Following the instructions, we\u2019re going to the Appearance section, then Editor, and then clicking on the 404 template on the right side of the page. This will load a section where you can enter custom code.<\/p>\n\n\n\n<p>Let\u2019s grab a php reverse shell script from pentestmonkey, here <a href=\"https:\/\/pentestmonkey.net\/tools\/web-shells\/php-reverse-shell\" target=\"_blank\" rel=\"noopener\" title=\"Pentestmonkey\">https:\/\/pentestmonkey.net\/tools\/web-shells\/php-reverse-shell<\/a><\/p>\n\n\n\n<p>Since I\u2019m on Kali, I just downloaded the .tar file and opened it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"419\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-15.png\" alt=\"Editing 404 theme\" class=\"wp-image-254\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-15.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-15-300x129.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-15-768x330.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>After copying and pasting the script into the 404 template, I\u2019ve updated the IP field with my Kali box IP and I left the port at 1234. This is what is going to tell the reverse shell where to connect to. However, we will first need to start a listener on our Kali machine in order for the victim machine to connect to us.<\/p>\n\n\n\n<p>Let\u2019s do that now.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"458\" height=\"116\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-16.png\" alt=\"netcat listener\" class=\"wp-image-255\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-16.png 458w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-16-300x76.png 300w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><\/figure>\n\n\n\n<p>Listener is started on port 1234. This will listen for any incoming connections, such as our reverse shell. What we are doing is establishing a connection from the victim machine to our machine by forcing the victim machine to connect to us and opening a port to let them in.<\/p>\n\n\n\n<p>Now, after starting the listener, we\u2019ll click update on the 404 file. This saves the file and now we must trigger it by navigating to it through URL.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"834\" height=\"67\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-17.png\" alt=\"Activating php reverse shell\" class=\"wp-image-256\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-17.png 834w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-17-300x24.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-17-768x62.png 768w\" sizes=\"auto, (max-width: 834px) 100vw, 834px\" \/><\/figure>\n\n\n\n<p>After hitting enter, we check our listener\u2026<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"182\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-18.png\" alt=\"Reverse shell started\" class=\"wp-image-257\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-18.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-18-300x56.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-18-768x143.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>We have a connection! Let&#8217;s check what account we have access to with the &#8216;whoami&#8217; command and check our present directory with &#8216;pwd&#8217;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"206\" height=\"131\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-19.png\" alt=\"whoami\" class=\"wp-image-258\"\/><\/figure>\n\n\n\n<p>Let\u2019s run a quick search for another key. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"497\" height=\"186\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-20.png\" alt=\"search for 2nd key\" class=\"wp-image-259\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-20.png 497w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-20-300x112.png 300w\" sizes=\"auto, (max-width: 497px) 100vw, 497px\" \/><\/figure>\n\n\n\n<p>Note, since we don\u2019t have a full shell, we don\u2019t have access to grep, which helps you filter search results. I ran a full search of \/ prior to the one above looking for the word \u2018key\u2019. Since we know the format of the first key, we could assume the next key would have been \u201ckey-2-of-3\u201d and the last key will be \u201ckey-3-of-3\u201d.<\/p>\n\n\n\n<p>Let\u2019s grab the 2<sup>nd<\/sup> key.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"511\" height=\"298\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-21.png\" alt=\"2nd key passworded\" class=\"wp-image-260\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-21.png 511w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-21-300x175.png 300w\" sizes=\"auto, (max-width: 511px) 100vw, 511px\" \/><\/figure>\n\n\n\n<p>Well, obviously it won\u2019t be that easy. Argh.<\/p>\n\n\n\n<p>However, there\u2019s an MD5 password hash here. The hash is the string of numbers and letters after the : sign when viewing the md5 file above. We\u2019ll need to crack that to get access to the user robot.<\/p>\n\n\n\n<p>John the Ripper is a good cracking tool that we will go ahead and use to crack this MD5 password. First, I\u2019ll save the hash in a text file so that we can use that with John as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"187\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-22.png\" alt=\"\" class=\"wp-image-261\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-22.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-22-300x58.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-22-768x147.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>First, we select our wordlist, rockyou.txt to use as a dictionary. Then we specify the format is Raw-MD5, so that John knows the correct method to crack. Last, tell it where the hash file is that we saved previously. Hit enter and it should quickly show you the password, which is marked out above.<\/p>\n\n\n\n<p>Before we can attempt to change from daemon to robot, we\u2019ll need to change our reverse shell to a more stable shell session by entering the below command. This will change our prompt and enable us to use things like grep and other handy tools.<\/p>\n\n\n\n<p><code>python3 -c 'import pty;pty.spawn(\"\/bin\/bash\")'<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"620\" height=\"75\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-23.png\" alt=\"Converting to full CLI terminal\" class=\"wp-image-262\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-23.png 620w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-23-300x36.png 300w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/figure>\n\n\n\n<p>Now that we have a full terminal, we should try swapping to robot.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"484\" height=\"152\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-24.png\" alt=\"su robot\" class=\"wp-image-263\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-24.png 484w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-24-300x94.png 300w\" sizes=\"auto, (max-width: 484px) 100vw, 484px\" \/><\/figure>\n\n\n\n<p>Now, lets view that flag in the home directory.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-25.png\" alt=\"grabbing 2nd key now\" class=\"wp-image-264\" width=\"452\" height=\"272\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-25.png 452w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-25-300x181.png 300w\" sizes=\"auto, (max-width: 452px) 100vw, 452px\" \/><\/figure>\n\n\n\n<p>Copy and paste that flag. Now, we have one last flag left.<\/p>\n\n\n\n<p>Now, we know that we need to get root on this box. However, we only have access to the user robot. So, we\u2019ll need to escalate privileges somehow to get root access.<\/p>\n\n\n\n<p>After some research, through Google of course, I found the <a href=\"https:\/\/delinea.com\/blog\/linux-privilege-escalation\" target=\"_blank\" rel=\"noopener\" title=\"\">site below<\/a> which provides some common privilege escalation techniques. First, I want to preface this with saying that I immediately tried look at the \/etc\/passwd and \/etc\/shadow files. Unfortunately, robot does not have that access. I also tried Sudo \u2013 l but again, no luck. Next, we are going to try the highlighted portion below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/delinea.com\/blog\/linux-privilege-escalation\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"499\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-26.png\" alt=\"https:\/\/delinea.com\/blog\/linux-privilege-escalation\" class=\"wp-image-265\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-26.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-26-300x154.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-26-768x393.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/a><\/figure>\n\n\n\n<p>After running that command, here\u2019s what we are seeing.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"627\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-27.png\" alt=\"SUID access\" class=\"wp-image-266\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-27.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-27-300x193.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-27-768x494.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Why are we looking at SUID files? The below article, which I used for research, does a great job of explaining the importance of these. Essentially, it allows us to execute these with permissions of another user. In the case of nmap, it looks like we can execute that as root.<\/p>\n\n\n\n<p>A little more digging and this article explains how using SUID and Nmap, we can escalate privileges and get root.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.adamcouch.co.uk\/linux-privilege-escalation-setuid-nmap\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Linux Privilege Escalation with Setuid and Nmap (adamcouch.co.uk)<\/a><\/p>\n\n\n\n<p>Let\u2019s try it!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"463\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-28.png\" alt=\"nmap SUID\" class=\"wp-image-268\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-28.png 709w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-28-300x196.png 300w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<p><strong>Well then, that was easier than I thought it would be.<\/strong><\/p>\n\n\n\n<p><strong>Now that we have root access, we can hit !sh to exit interactive mode and retain root rights. We can then find and capture that last flag.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"558\" height=\"298\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-29.png\" alt=\"root flag \" class=\"wp-image-269\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-29.png 558w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image-29-300x160.png 300w\" sizes=\"auto, (max-width: 558px) 100vw, 558px\" \/><\/figure>\n\n\n\n<p><strong>And we are done!<\/strong><\/p>\n\n\n\n<p><strong>I hope you\u2019ve enjoyed this walkthrough. Again, we came across some new things that we had to spend some time doing research on. However, we were able to find ways to run our exploits, escalate our privileges and get those <\/strong><b>flags<\/b><strong>. Until<\/strong><strong> next time!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey everyone, back for another CTF box from Tryhackme.com. This time Mr Robot CTF. I really enjoyed the show, so<\/p>\n<p><a href=\"https:\/\/infosecjake.net\/?p=238\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Tryhackme &#8211; Mr Robot CTF Walkthrough<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":239,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[31],"tags":[33,32,34],"class_list":["post-238","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ctf-challenge-walkthroughs","tag-ctf","tag-tryhackme","tag-walkthrough"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/04\/image.png","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=238"}],"version-history":[{"count":1,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/238\/revisions"}],"predecessor-version":[{"id":270,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/238\/revisions\/270"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/media\/239"}],"wp:attachment":[{"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}