{"id":370,"date":"2023-10-27T03:15:41","date_gmt":"2023-10-27T03:15:41","guid":{"rendered":"https:\/\/infosecjake.net\/?p=370"},"modified":"2023-10-30T18:16:31","modified_gmt":"2023-10-30T18:16:31","slug":"tryhackme-internal-walkthrough","status":"publish","type":"post","link":"https:\/\/infosecjake.net\/?p=370","title":{"rendered":"Tryhackme &#8211; Internal Walkthrough"},"content":{"rendered":"\n<p>We are back with another CTF box on TryHackMe. This time we have a box named Internal, which is rated as hard. This box is set up to resemble a black-box penetration test. The accompanying post encourages you to treat this as a penetration test and document your findings in a penetration test report.<\/p>\n\n\n\n<p>First, as usual, we will start off by booting up our Kali VM and connecting to the VPN for TryHackMe (THM). <\/p>\n\n\n\n<p>Next, we start up the Internal box on THM and wait for the IP address to show.<\/p>\n\n\n\n<p>I do encourage you to understand the penetration testing methodology, as it does help guide you through a pentest. There are multiple methodologies that you can use, OWASP has a great page on that here, <a href=\"https:\/\/owasp.org\/www-project-web-security-testing-guide\/latest\/3-The_OWASP_Testing_Framework\/1-Penetration_Testing_Methodologies\">WSTG &#8211; Latest | OWASP Foundation<\/a> with the Web Security Testing Guide.<\/p>\n\n\n\n<p>To begin, we will run an Nmap scan on our host. <\/p>\n\n\n\n<p>I like this scan as it starts with a service detection (-sV) and OS detection (-O).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"524\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image.png\" alt=\"Nmap scan\" class=\"wp-image-372\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-300x161.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-768x413.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>So, we have an HTTP service on port 80 and SSH on port 22. Other than that, it\u2019s pretty closed off, though I didn\u2019t scan all ports either.<\/p>\n\n\n\n<p>So, let\u2019s look at what we can find for this http service with Dirb. Dirb is a directory browsal tool. It\u2019s good at finding web directories, which we can potentially use to exploit this box.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"675\" height=\"486\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-1.png\" alt=\"Dirb results\" class=\"wp-image-373\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-1.png 675w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-1-300x216.png 300w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><\/figure>\n\n\n\n<p>Pretty quickly, we find a \/blog directory. Taking a look at that, we find a WordPress site.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"465\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-2.png\" alt=\"Wordpress site\" class=\"wp-image-374\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-2.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-2-300x143.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-2-768x366.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>The only post on the site is by Admin, so we know we have an Admin user already. This is a pretty quick user enumeration.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"866\" height=\"847\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-3.png\" alt=\"Admin user enumeration\" class=\"wp-image-375\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-3.png 866w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-3-300x293.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-3-768x751.png 768w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-3-50x50.png 50w\" sizes=\"auto, (max-width: 866px) 100vw, 866px\" \/><\/figure>\n\n\n\n<p>So, let\u2019s see if we can brute force the password for Admin on this site.<\/p>\n\n\n\n<p>For that, we will use WPScan, it\u2019s a handy tool that will both find vulns on a WordPress site and also do brute forcing.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"83\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-4.png\" alt=\"WPscan brute force\" class=\"wp-image-376\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-4.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-4-300x26.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-4-768x65.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>We start up our scan and wait for some results.<\/p>\n\n\n\n<p>Before long, we have a match.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"519\" height=\"92\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-5.png\" alt=\"WP Admin creds\" class=\"wp-image-377\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-5.png 519w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-5-300x53.png 300w\" sizes=\"auto, (max-width: 519px) 100vw, 519px\" \/><\/figure>\n\n\n\n<p>So, with the credentials, we can now login to the WordPress page as the admin user.<\/p>\n\n\n\n<p>During the initial login, it may prompt you to verify the email address. I just chose to remind me later of that.<\/p>\n\n\n\n<p>We are now in!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"497\" height=\"103\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-6.png\" alt=\"Logged in as admin\" class=\"wp-image-378\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-6.png 497w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-6-300x62.png 300w\" sizes=\"auto, (max-width: 497px) 100vw, 497px\" \/><\/figure>\n\n\n\n<p>After looking around a little bit, I didn\u2019t find much of anything on the site itself. However, knowing that I also run a WordPress site, I do know that the Theme Editor function allows you to modify specific pages, including <strong><em>PHP<\/em><\/strong> pages. We could use one of these pages to trigger a reverse PHP shell.<\/p>\n\n\n\n<p>A quick guide on how to do this, from <a href=\"https:\/\/www.hackingarticles.in\/wordpress-reverse-shell\/\">https:\/\/www.hackingarticles.in\/wordpress-reverse-shell\/<\/a>. This guide is really good, so definitely give it a look if you plan to do this.<\/p>\n\n\n\n<p>We will do pretty much the same thing here. We will use a reverse PHP shell from pentestmonkey on the 404 page off the WP site. You can grab that reverse PHP shell here &#8211; <a href=\"https:\/\/pentestmonkey.net\/tools\/web-shells\/php-reverse-shell\">https:\/\/pentestmonkey.net\/tools\/web-shells\/php-reverse-shell<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"230\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-7.png\" alt=\"Reverse PHP shell\" class=\"wp-image-379\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-7.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-7-300x71.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-7-768x181.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>I updated the 404 file and pasted the reverse shell script in. Make sure to replace the IP and port to your respective IP and port.<\/p>\n\n\n\n<p>Next, let\u2019s start up our netcat listener. This listener does exactly that, it listens for incoming connections on the specified port. In this case, port 1337, which is the same port we put into our reverse PHP shell on the WordPress site.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"420\" height=\"119\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-8.png\" alt=\"netcat listener\" class=\"wp-image-380\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-8.png 420w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-8-300x85.png 300w\" sizes=\"auto, (max-width: 420px) 100vw, 420px\" \/><\/figure>\n\n\n\n<p>Now, let\u2019s visit the page to trigger the script. This took a little trial and error to find the exact URL based on the theme the site was using.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"892\" height=\"53\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-9.png\" alt=\"Triggering php shell\" class=\"wp-image-381\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-9.png 892w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-9-300x18.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-9-768x46.png 768w\" sizes=\"auto, (max-width: 892px) 100vw, 892px\" \/><\/figure>\n\n\n\n<p>Checking our listener, and we now have a reverse shell.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"242\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-10.png\" alt=\"Reverse shell established\" class=\"wp-image-382\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-10.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-10-300x74.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-10-768x191.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>If you look closely at the remote shell connection, you&#8217;ll see we are now connected to the box as user www-data.<\/p>\n\n\n\n<p>At this point, I ran a quick file search for User.txt with the below command.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"444\" height=\"33\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-11.png\" alt=\"Searching for User.txt\" class=\"wp-image-383\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-11.png 444w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-11-300x22.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-11-440x33.png 440w\" sizes=\"auto, (max-width: 444px) 100vw, 444px\" \/><\/figure>\n\n\n\n<p>However, this found no results. I then moved to the \/home directory and saw that we have a user named \u2018aubreanna\u2019. However, with our current user, www-data, we cannot access that directory. So, it looks like we need to escalate privileges to the user aubreanna.<\/p>\n\n\n\n<p>One tool that I used a lot during my CPENT exam was Linpeas\/Winpeas. This tool is specifically designed to identify potential avenues to escalate privileges on the box. However, we must first get Linpeas over on this box.<\/p>\n\n\n\n<p>First, I\u2019m going to test the ability to run wget from this box. Wget is a simple utility that allows you to download webpage data\/files. We can use Wget to download our script remotely. I just did a simple \u2018wget http:\/\/google.com\u2019 to see if it worked. It did, so I canceled before it downloaded the page. Next, I will need to start a simple web server on my Kali box and host the Linpeas script. Then, I can wget from the victim machine and download the script directly.<\/p>\n\n\n\n<p>On my desktop, I have a folder called pywww. This folder hosts multiple files that I\u2019ve used in the past, including linpeas.sh. As shown below, I started a terminal in that folder (this is important) and then started up a simple http server. Now, back to the victim machine, we\u2019ll issue our command and download the script.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"639\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-12.png\" alt=\"Pywww directory and http server started\" class=\"wp-image-384\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-12.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-12-300x197.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-12-768x503.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Now that our server is active, let\u2019s pull over the linpeas.sh script.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"601\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-13.png\" alt=\"Downloading script to the victim machine\" class=\"wp-image-385\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-13.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-13-300x185.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-13-768x473.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Just wanted to note, I had to choose the \/tmp directory to output this file to (-O \/tmp\/linpeas.sh). I could not write to the default directory or even the \/home directory. The \/tmp directory was what worked for me.<\/p>\n\n\n\n<p>Now, we can run our script and see what we find.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"588\" height=\"72\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-14.png\" alt=\"Making executable\" class=\"wp-image-386\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-14.png 588w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-14-300x37.png 300w\" sizes=\"auto, (max-width: 588px) 100vw, 588px\" \/><\/figure>\n\n\n\n<p>First, we gotta make sure its executable, oops. After issuing the chmod +x, we can now run it and watch the results scroll by. This may take a few minutes to complete.<\/p>\n\n\n\n<p>The legend on Linpeas is super useful. It color-codes the findings based on likelihood of privilege escalation. I love it, it makes reading the really long output much easier.<\/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\/10\/image-15.png\" alt=\"Linpeas legend\" class=\"wp-image-387\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-15.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-15-300x58.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-15-768x147.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Scrolling through the results, I\u2019m not seeing any red\/yellow findings. However, I do see multiple red findings. We will take a closer look at those.<\/p>\n\n\n\n<p>First, the Sudo version is 1.8.21p2. This could be exploitable. I\u2019ve done a previous CTF that had a Sudo vulnerability that was exploitable for root. This looks like it might be the same thing.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"110\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-16.png\" alt=\"Sudo version\" class=\"wp-image-388\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-16.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-16-300x34.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-16-768x87.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>We also have a sizeable list of identified vulnerabilities, including sudo Baron Samedit. I have used this one before. It is pretty easy to exploit, so we may have a path to root with that.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"741\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-17.png\" alt=\"Linpeas output\" class=\"wp-image-389\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-17.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-17-300x228.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-17-768x584.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>The handy thing about these vulnerabilities is that Linpeas provides direct links.<\/p>\n\n\n\n<p>We also have some WordPress config files.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"181\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-18.png\" alt=\"WP config files\" class=\"wp-image-390\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-18.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-18-300x56.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-18-768x143.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>SSH config files are available as well.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"95\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-19.png\" alt=\"ssh config\" class=\"wp-image-391\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-19.png 500w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-19-300x57.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/figure>\n\n\n\n<p>Also, some phpMyAdmin files..<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"131\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-20.png\" alt=\"phpmyadmin files\" class=\"wp-image-392\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-20.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-20-300x40.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-20-768x103.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>I spent some time here and reviewed the WordPress and SSH files, not finding much. I then made my way down to the phpMyAdmin files. Here is where I started finding interesting information.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"564\" height=\"335\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-22.png\" alt=\"phpmyadmin creds\" class=\"wp-image-394\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-22.png 564w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-22-300x178.png 300w\" sizes=\"auto, (max-width: 564px) 100vw, 564px\" \/><\/figure>\n\n\n\n<p>We now have a phpMyAdmin username and password.<\/p>\n\n\n\n<p>While I was doing all of this, I still had my Dirb running in the background. Let\u2019s see where this phpMyAdmin directory is.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"878\" height=\"339\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-23.png\" alt=\"Dirb still running\" class=\"wp-image-395\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-23.png 878w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-23-300x116.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-23-768x297.png 768w\" sizes=\"auto, (max-width: 878px) 100vw, 878px\" \/><\/figure>\n\n\n\n<p>Now, with the URL and the credentials. We will login to the phpMyAdmin service. After logging in, I checked out the pma_users section under phpMyAdmin. However, no user credentials were located here.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"864\" height=\"803\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-24.png\" alt=\"phpmyadmin creds empty\" class=\"wp-image-396\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-24.png 864w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-24-300x279.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-24-768x714.png 768w\" sizes=\"auto, (max-width: 864px) 100vw, 864px\" \/><\/figure>\n\n\n\n<p>At this point, I spent some time trying to execute the PwnKit vulnerability. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"939\" height=\"134\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-25.png\" alt=\"PwnKit\" class=\"wp-image-397\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-25.png 939w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-25-300x43.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-25-768x110.png 768w\" sizes=\"auto, (max-width: 939px) 100vw, 939px\" \/><\/figure>\n\n\n\n<p>However, the problem I ran into is that I do not have the ability to run \u2018make\u2019 on the system as it\u2019s not installed, and the www-data user cannot install it. Make is a <s>compiler<\/s> build tool (thank you for the correction!) and is not installed on this system. (Thanks to some great feedback, I could have downloaded make myself from <a href=\"https:\/\/ftp.gnu.org\/gnu\/make\/\" target=\"_blank\" rel=\"noopener\" title=\"make download\">https:\/\/ftp.gnu.org\/gnu\/make\/<\/a> and pursued this path a bit further.)<\/p>\n\n\n\n<p>So, let\u2019s do some further detective work on the system. Browsing the files, I found an interesting file called wp-save.txt, by searching for .txt files on the system. This file just so happened to have credentials we need in it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"263\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-26.png\" alt=\"aubreanna creds\" class=\"wp-image-398\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-26.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-26-300x81.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-26-768x207.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Running \u2018su aubreanna\u2019 allows me to swap to that user with her credentials.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"447\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-27.png\" alt=\"user flag\" class=\"wp-image-399\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-27.png 672w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-27-300x200.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-27-507x338.png 507w\" sizes=\"auto, (max-width: 672px) 100vw, 672px\" \/><\/figure>\n\n\n\n<p>And we now have the user flag!<\/p>\n\n\n\n<p>Again, I tried installing make with the new user access. However, this was a no-go as well. Ok, so at this point, I shifted gears and focused on the vulnerability below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"974\" height=\"127\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-28.png\" alt=\"Sudo Baron vuln\" class=\"wp-image-400\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-28.png 974w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-28-300x39.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-28-768x100.png 768w\" sizes=\"auto, (max-width: 974px) 100vw, 974px\" \/><\/figure>\n\n\n\n<p>I downloaded the exploits via the Download URL above from Linpeas.<\/p>\n\n\n\n<p>I then hosted those files on my simple HTTP server and used wget to download them to the victims \/tmp directory.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"47\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-29.png\" alt=\"Downloading Sudo Baron exploits\" class=\"wp-image-401\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-29.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-29-300x14.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-29-768x37.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>After all files were downloaded, I checked out the Readme.MD file to see which script I should run.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"60\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-30.png\" alt=\"Readme\" class=\"wp-image-402\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-30.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-30-300x18.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-30-768x47.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Here, the first script, is what I started with.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"288\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-31.png\" alt=\"Getting root\" class=\"wp-image-403\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-31.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-31-300x89.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-31-768x227.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>And as you can see, I now have root. Easy peasy!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"334\" height=\"242\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-32.png\" alt=\"Root flag\" class=\"wp-image-404\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-32.png 334w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/10\/image-32-300x217.png 300w\" sizes=\"auto, (max-width: 334px) 100vw, 334px\" \/><\/figure>\n\n\n\n<p>And just like that, we have the root flag. <\/p>\n\n\n\n<p>I do believe that there are likely other methods of getting root on the system. However, this vulnerability is one that I&#8217;ve used before and it&#8217;s now worked 2\/2. This just shows you how critical the vulnerability itself is. If you were writing a penetration testing report on this, that sudo Baron vulnerability would be a great callout.<\/p>\n\n\n\n<p>This was a good box. It did take me down a bit of a rabbit hole with the myphpadmin stuff, but after some furhter digging I was able to find an avenue to get user credentials which led to root access.<\/p>\n\n\n\n<p>Hope you enjoyed it! Best of luck on your journey!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are back with another CTF box on TryHackMe. This time we have a box named Internal, which is rated<\/p>\n<p><a href=\"https:\/\/infosecjake.net\/?p=370\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Tryhackme &#8211; Internal Walkthrough<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":371,"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-370","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\/10\/Internal.png","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/370","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=370"}],"version-history":[{"count":2,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/370\/revisions"}],"predecessor-version":[{"id":411,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/370\/revisions\/411"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/media\/371"}],"wp:attachment":[{"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}