{"id":416,"date":"2023-11-23T00:53:59","date_gmt":"2023-11-23T00:53:59","guid":{"rendered":"https:\/\/infosecjake.net\/?p=416"},"modified":"2023-11-23T00:53:59","modified_gmt":"2023-11-23T00:53:59","slug":"tryhackme-ultratech-ctf-walkthrough","status":"publish","type":"post","link":"https:\/\/infosecjake.net\/?p=416","title":{"rendered":"Tryhackme &#8211; UltraTech CTF Walkthrough"},"content":{"rendered":"\n<p>Back again for another CTF box. This time, the day before Thanksgiving. Had some time off work and figured I\u2019d get a box in while I can.<\/p>\n\n\n\n<p>As always, we will start up our Kali VM and connect to the VPN for THM.<\/p>\n\n\n\n<p>Next, we will join the room and start up the CTF box.<\/p>\n\n\n\n<p>Once everything is up and running, it\u2019s time to start enumerating. As usual, we\u2019ll run an Nmap scan to see what ports and services are running on the box.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Task 2<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"213\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image.png\" alt=\"nmap\" class=\"wp-image-417\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-300x66.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-768x168.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>With a simple scan, we have ports 21, 22, and 8081. I do want to note that by default, Nmap only scans the top 10k ports unless you explicitly tell it to scan a different port range or all ports. This can be done with other switches when running your scan. You can see more of this on Nmap\u2019s website, <a href=\"https:\/\/nmap.org\/book\/man-briefoptions.html\" target=\"_blank\" rel=\"noopener\" title=\"\">https:\/\/nmap.org\/book\/man-briefoptions.html<\/a>.<\/p>\n\n\n\n<p>Now, that we have scan results, we can start answering some of the enumeration questions in Task 2.<\/p>\n\n\n\n<p>First up, what software is using port 8081. We can see that Node.js is using that port.<\/p>\n\n\n\n<p>The next question asks what other non-standard port is being used. However, noting that the answer is 5 characters long, it appears that this is beyond the typical 10k port scan range that Nmap does by default. This means, we need to scan more ports.<\/p>\n\n\n\n<p>We will need to submit another Nmap scan, but this time with an expanded port range. I\u2019m going to go ahead and scan all ports, just to be safe. This, unfortunately, takes longer to run just due to the amount of ports that Nmap has to check.<\/p>\n\n\n\n<p>We will scan all ports with the switch -p1-65535. This tells Nmap to scan ports 1 \u2013 65,535. You could also use the switch -P- which would be easier to type. However, I chose to use the elongated version just to show the entire port range. Additionally, I\u2019ve used the -T 4 switch to change the timing to make the scan run much faster. A word of caution on this, running too high can cause issues and should be limited when used in any real production environment.<\/p>\n\n\n\n<p>So our new scan will look something like this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"80\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-2.png\" alt=\"nmap again\" class=\"wp-image-419\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-2.png 688w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-2-300x35.png 300w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"467\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-1.png\" alt=\"That took a while...\" class=\"wp-image-418\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-1.png 695w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-1-300x202.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/figure>\n\n\n\n<p>And we finally have our results back.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"165\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-3.png\" alt=\"nmap results\" class=\"wp-image-420\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-3.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-3-300x51.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-3-768x130.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>So, our other non-standard port is 31,331. We have the answer to question 2 in Task 2.<\/p>\n\n\n\n<p>Question 3 is asking what software uses this port. Simple enough, it\u2019s Apache.<\/p>\n\n\n\n<p>Question 4 then asks us what Linux Distro appears to be in use. From the results on port 31331, it looks like it may be Ubuntu. Entering Ubuntu nets us a correct answer.<\/p>\n\n\n\n<p>Finally question 5 asks us how many routes from the REST API on port 8081 are used by the web application. For a quick reference, the below link talks about REST API routes and endpoints and the difference between them.<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.wordpress.org\/rest-api\/extending-the-rest-api\/routes-and-endpoints\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Routes and Endpoints | REST API Handbook | WordPress Developer Resources<\/a><\/p>\n\n\n\n<p>For this one, we need to do some directory traversing on this to see what we can find.<\/p>\n\n\n\n<p>For this, we will use Dirb.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"822\" height=\"461\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-4.png\" alt=\"dirb\" class=\"wp-image-421\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-4.png 822w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-4-300x168.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-4-768x431.png 768w\" sizes=\"auto, (max-width: 822px) 100vw, 822px\" \/><\/figure>\n\n\n\n<p>Pretty quickly, we see \/auth and \/ping. So, we\u2019ll answer 2 for question 5.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Task 3<\/h2>\n\n\n\n<p>Here it talks about a page to login. I did first check out the \/auth but got a message that I need to specify a username and password.<\/p>\n\n\n\n<p>Let\u2019s revert back to some enumeration. What is one file most websites use to explicitly tell crawlers not to archive? Robots.txt. So, let\u2019s see if the site has that file and what may be on it.<\/p>\n\n\n\n<p>I first tried this on port 8081 but got nothing. I then tried with port 31331.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"247\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-5.png\" alt=\"robots.txt\" class=\"wp-image-422\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-5.png 909w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-5-300x82.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-5-768x209.png 768w\" sizes=\"auto, (max-width: 909px) 100vw, 909px\" \/><\/figure>\n\n\n\n<p>So, we have a utech_sitemap.txt page. Let\u2019s have a look at it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"278\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-6.png\" alt=\"sitemap\" class=\"wp-image-423\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-6.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-6-300x86.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-6-768x219.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Visiting each page, I noticed that partners.html has a login screen.<\/p>\n\n\n\n<p>A hint in the Task section notes that \u201cQuick and dirty login implementations usually goes with poor data management.\u201d<\/p>\n\n\n\n<p>So, I loaded up BurpSuite and ran through checking the login process with admin\/admin. Just to see what the program does.<\/p>\n\n\n\n<p>Here\u2019s what I found interesting.<\/p>\n\n\n\n<p>After sending the credentials, the page also does a GET on the \/ping endpoint with the IP address of the CTF box.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"850\" height=\"403\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-7.png\" alt=\"Burp request\" class=\"wp-image-424\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-7.png 850w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-7-300x142.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-7-768x364.png 768w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/figure>\n\n\n\n<p>When looking at the page source, I see the following JS files.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"555\" height=\"120\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-8.png\" alt=\"api.js file\" class=\"wp-image-425\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-8.png 555w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-8-300x65.png 300w\" sizes=\"auto, (max-width: 555px) 100vw, 555px\" \/><\/figure>\n\n\n\n<p>This calls the api.js which then calls the \/ping endpoint.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"955\" height=\"233\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-9.png\" alt=\"\/ping endpoint\" class=\"wp-image-426\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-9.png 955w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-9-300x73.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-9-768x187.png 768w\" sizes=\"auto, (max-width: 955px) 100vw, 955px\" \/><\/figure>\n\n\n\n<p>Exactly what we saw in the Burp request.<\/p>\n\n\n\n<p>Manually going to the API endpoint and pasting the ping in nets us the below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"82\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-10.png\" alt=\"ping usage\" class=\"wp-image-427\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-10.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-10-300x25.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-10-768x65.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Ok, so for this one, this took me a bit, mainly because I got stuck with command substitution and using the wrong character.<\/p>\n\n\n\n<p>In the JS file, it shows not a single quote, but a tic mark, if I\u2019m not mistaken. It\u2019s on the tilde key on your keyboard.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"603\" height=\"45\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-11.png\" alt=\"important ` usage\" class=\"wp-image-428\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-11.png 603w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-11-300x22.png 300w\" sizes=\"auto, (max-width: 603px) 100vw, 603px\" \/><\/figure>\n\n\n\n<p>For context, I was trying to do something like the below, where you can potentially combine commands by using a separator. I tried using a semicolon to separate the ping command with the next.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"154\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-12.png\" alt=\"attempted command usage\" class=\"wp-image-429\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-12.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-12-300x47.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-12-768x121.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>I also attempted adding single quotes with the same type of command usage.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"253\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-13.png\" alt=\"using single quotes\" class=\"wp-image-430\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-13.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-13-300x78.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-13-768x199.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>This also does not work because it won\u2019t process \u2018. It will, however, process `. Once I figured out that the tic mark worked, it was go time.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"167\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-14.png\" alt=\"whoami worked\" class=\"wp-image-431\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-14.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-14-300x51.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-14-768x132.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>As we can see, in the response, it shows \u2018www\u2019. That is the current user we ran that command under.<\/p>\n\n\n\n<p>Now, let\u2019s run an ls command to see what\u2019s in the directory.<\/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\/11\/image-15.png\" alt=\"directory listing\" class=\"wp-image-432\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-15.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-15-300x58.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-15-768x147.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>This should be our answer to Task 3, question 1. The filename is utech.db.sqlite.<\/p>\n\n\n\n<p>Question 2 in Task 3 asks us what the first user\u2019s password hash is. I\u2019m assuming this might be in the database file?<\/p>\n\n\n\n<p>Let\u2019s try a \u2018cat\u2019 command to view the file itself.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"99\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-16.png\" alt=\"viewing database file\" class=\"wp-image-433\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-16.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-16-300x30.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-16-768x78.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>A bit surprised that worked, honestly.<\/p>\n\n\n\n<p>So, we will use the hash for root, to answer this question. That is, the numbers and letters immediately following root, up until the closed parenthesis.<\/p>\n\n\n\n<p>Question 3 asks us what the password is with this hash. That means we need to crack the hash.<\/p>\n\n\n\n<p>For this, I just googled \u2018Online Hash Cracker\u2019 and chose <a href=\"https:\/\/crackstation.net\/\">https:\/\/crackstation.net\/<\/a><\/p>\n\n\n\n<p>Pasting in the hash and clicking crack, simple enough, and got us the password.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"345\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-17.png\" alt=\"Hash crack\" class=\"wp-image-434\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-17.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-17-300x106.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-17-768x272.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Now that we have our hash, we can move on to Task 4.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Task 4<\/h2>\n\n\n\n<p>The last question asks for Root\u2019s private SSH key and the last 9 characters of it.<\/p>\n\n\n\n<p>Since we do have root\u2019s credentials, let\u2019s see if we can login as root.<\/p>\n\n\n\n<p>This actually hung me up a LOT longer than it should have. I did not notice that the username was r00t instead of root. Tricky, tricky. I was trying to login with the legit root account instead of r00t and it was obviously failing. <\/p>\n\n\n\n<p>Let\u2019s ssh in as r00t, instead.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"425\" height=\"69\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-18.png\" alt=\"ssh as r00t\" class=\"wp-image-435\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-18.png 425w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-18-300x49.png 300w\" sizes=\"auto, (max-width: 425px) 100vw, 425px\" \/><\/figure>\n\n\n\n<p>Now, that we are finally in. We can attempt to escalate privileges to actual root user.<\/p>\n\n\n\n<p>Since I really like Linpeas, we are going to go ahead and grab it and run it on the CTF box.<\/p>\n\n\n\n<p>First, we will start up our http server in my pywww directory where linpeas.sh is stored. This allows me to quickly host a web server and do a wget to pull the file on the victim machine.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"925\" height=\"138\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-19.png\" alt=\"setting up http server\" class=\"wp-image-436\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-19.png 925w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-19-300x45.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-19-768x115.png 768w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-19-920x138.png 920w\" sizes=\"auto, (max-width: 925px) 100vw, 925px\" \/><\/figure>\n\n\n\n<p>As you can see from the above, the incoming GET request for linpeas.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"258\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-20.png\" alt=\"grabbing linpeas\" class=\"wp-image-437\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-20.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-20-300x79.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-20-768x203.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Next, we give the script executable permissions and then run it\u2026<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"563\" height=\"28\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-21.png\" alt=\"making executable\" class=\"wp-image-438\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-21.png 563w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-21-300x15.png 300w\" sizes=\"auto, (max-width: 563px) 100vw, 563px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"849\" height=\"681\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-22.png\" alt=\"linpeas\" class=\"wp-image-439\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-22.png 849w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-22-300x241.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-22-768x616.png 768w\" sizes=\"auto, (max-width: 849px) 100vw, 849px\" \/><\/figure>\n\n\n\n<p>Look at that cute lil feller\u2026.<\/p>\n\n\n\n<p>Right off the bat, we see that Sudo version appears to be vulnerable\u2026<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"88\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-23.png\" alt=\"Sudo version\" class=\"wp-image-440\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-23.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-23-300x27.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-23-768x69.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/book.hacktricks.xyz\/linux-hardening\/privilege-escalation#sudo-version\" target=\"_blank\" rel=\"noopener\" title=\"\">https:\/\/book.hacktricks.xyz\/linux-hardening\/privilege-escalation#sudo-version<\/a><\/p>\n\n\n\n<p>After some back and forth with this (and by some I mean quite a while), I decided to use the PwnKit vulnerability that Linpeas pointed also out further down.<\/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\/11\/image-24.png\" alt=\"Pwnkit\" class=\"wp-image-441\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-24.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-24-300x56.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-24-768x143.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"297\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-25.png\" alt=\"Grabbing and running Pwnkit\" class=\"wp-image-442\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-25.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-25-300x91.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-25-768x234.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>You can use the same exploit here: <a href=\"https:\/\/github.com\/arthepsy\/CVE-2021-4034?source=post_page-----91de3028a426--------------------------------\" target=\"_blank\" rel=\"noopener\" title=\"\">https:\/\/github.com\/arthepsy\/CVE-2021-4034?source=post_page&#8212;&#8211;91de3028a426&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/a><\/p>\n\n\n\n<p>I first downloaded the exploit file to my Kali machine and named it pwnkit.c. I then uploaded it to the CTF machine using wget and then compiled it with gcc. Finally, executing it provides us with root access.<\/p>\n\n\n\n<p>And now, we have root.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"763\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-26.png\" alt=\"root ssh key\" class=\"wp-image-443\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-26.png 900w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-26-300x254.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/11\/image-26-768x651.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<p>Some quick searching and we have our RSA key. Copy the first 9 characters, and we are finished with this box.<\/p>\n\n\n\n<p>Overall, this was a fun box. Definitely had some parts that I spent some time working on and trying to figure out. However, it has some good vulnerabilities to exploit and what appears to be multiple ways to do it. <\/p>\n\n\n\n<p>I hope you enjoyed it! <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back again for another CTF box. This time, the day before Thanksgiving. Had some time off work and figured I\u2019d<\/p>\n<p><a href=\"https:\/\/infosecjake.net\/?p=416\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Tryhackme &#8211; UltraTech CTF Walkthrough<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":444,"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-416","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\/11\/UltraTech.png","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/416","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=416"}],"version-history":[{"count":1,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/416\/revisions"}],"predecessor-version":[{"id":445,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/416\/revisions\/445"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/media\/444"}],"wp:attachment":[{"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}