{"id":280,"date":"2023-07-25T02:40:38","date_gmt":"2023-07-25T02:40:38","guid":{"rendered":"https:\/\/infosecjake.net\/?p=280"},"modified":"2023-08-03T15:05:13","modified_gmt":"2023-08-03T15:05:13","slug":"tryhackme-relevant-walkthrough","status":"publish","type":"post","link":"https:\/\/infosecjake.net\/?p=280","title":{"rendered":"Tryhackme &#8211; Relevant CTF Walkthrough"},"content":{"rendered":"\n<p>First off, I&#8217;d like to say that I love how this CTF challenge is modeled off a real penetration test. The creator gives you a scope, rules of engagement, and a short background. I would encourage you to practice taking screenshots and documenting what you have done throughout this CTF. It is great practice for creating a penetration test report. Let&#8217;s start on Tryhackme Relevant!<\/p>\n\n\n\n<p>First, let&#8217;s start up the attack box after connecting to VPN with our Kali VM.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"249\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image.png\" alt=\"Starting up the CTF machine\" class=\"wp-image-281\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-300x77.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-768x196.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>We start our machine, and give it a few minutes to fully boot.<br><br>Next, lets scan the machine to see what we can find.<br><br>I\u2019ve done a simple nmap -sV -A on the IP of the machine. The switches -sV are for service detection, and -A are for OS detection.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"961\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-1.png\" alt=\"nmap scan results\" class=\"wp-image-282\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-1.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-1-300x296.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-1-768x757.png 768w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-1-50x50.png 50w\" 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=\"749\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-2.png\" alt=\"initial scan\" class=\"wp-image-283\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-2.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-2-300x230.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-2-768x590.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>We have several ports of interest open on the machine. We also can note that this is a Windows Server, 2008\/12\/16 based on the guesses from nmap. However, we can determine that for sure later. I have highlighted the open ports, including an HTTP service, RDP, and SMB.<\/p>\n\n\n\n<p>Let\u2019s start by looking at the web page hosted by the server.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"878\" height=\"462\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-19.png\" alt=\"IIS server\" class=\"wp-image-301\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-19.png 878w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-19-300x158.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-19-768x404.png 768w\" sizes=\"auto, (max-width: 878px) 100vw, 878px\" \/><\/figure>\n\n\n\n<p>Basic IIS installation, but we should run a directory traversal tool on and possibly Nikto to see what might be here. While doing those, I\u2019m going to run another nmap scan on the SMB service, as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"803\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-4.png\" alt=\"SMB scan\" class=\"wp-image-285\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-4.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-4-300x247.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-4-768x633.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>As shown, this one appears to be vulnerable to MS17-010. You may already know this one as it was very widespread and made news around the world. This is Eternal Blue, and is a well-known vulnerability with SMB. Let\u2019s try to exploit it.<br><br>As noted in the description of the machine, Metasploit is not required for this machine. However, Metasploit does have an exploit for MS17-010. So, lets use it.<br><br>Type msfconsole in a terminal to load up Metasploit. Next, we are going to type \u2018Search MS17-010\u2019 to find the module we need.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"321\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-5.png\" alt=\"msf module\" class=\"wp-image-286\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-5.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-5-300x99.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-5-768x253.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>We are going to use option 0, so type \u2018use 0\u2019.<br><br>Now, type \u2018options\u2019 to see what all options we need to set for this exploit.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"531\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-6.png\" alt=\"MSF options\" class=\"wp-image-287\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-6.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-6-300x163.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-6-768x418.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Highlighted are the RHOSTS, which is the victim and the LHOST which is my machine. I need to set both of those IP addresses accordingly.<br><br>You can set options with a command such as \u2018set RHOST 192.168.0.1\u2019 and that will set the ip address for RHOSTS to 192.168.0.1. However, that should be the IP of your victim machine.<\/p>\n\n\n\n<p>With both IP\u2019s set, lets run the exploit.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"659\" height=\"100\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-7.png\" alt=\"Module didnt work\" class=\"wp-image-288\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-7.png 659w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-7-300x46.png 300w\" sizes=\"auto, (max-width: 659px) 100vw, 659px\" \/><\/figure>\n\n\n\n<p>No dice. I tried this a few times, just to be sure. Sometimes the exploit may fail, so it\u2019s a good idea to try it a couple of times just to be sure.<\/p>\n\n\n\n<p>Since that failed, let\u2019s take a closer look at the SMB service running on the machine.<\/p>\n\n\n\n<p>However, our Nikto and dirb scans have finished. Let\u2019s look at those.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"707\" height=\"1024\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-8-707x1024.png\" alt=\"Nikto &amp; Dirb results\" class=\"wp-image-289\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-8-707x1024.png 707w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-8-207x300.png 207w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-8-768x1112.png 768w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-8.png 932w\" sizes=\"auto, (max-width: 707px) 100vw, 707px\" \/><\/figure>\n\n\n\n<p>Nothing spectacular from either scans. Bummer.<\/p>\n\n\n\n<p>(FYI, I had started a hydra brute force on the RDP for this box and this apparently cause the box to stop responding. At this point, I had to stop &amp; restart the box to continue. By the way, crashing a machine would be frowned upon in a real penetration test. Woops. )<\/p>\n\n\n\n<p>After restarting the box, we run the smbclient -L on the machine to see what shares it has.<\/p>\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\/07\/image-9.png\" alt=\"smbclient command\" class=\"wp-image-290\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-9.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-9-300x91.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-9-768x234.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>Interesting, we have a share called nt4wrksv. Let\u2019s connect to it and see what\u2019s on there.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"227\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-10.png\" alt=\"Downloading smb file\" class=\"wp-image-291\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-10.png 975w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-10-300x70.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-10-768x179.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p>We connected to the share, found a passwords.txt file and downloaded it.<\/p>\n\n\n\n<p>Looking at the passwords file, we see they are encoded.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"839\" height=\"183\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-11.png\" alt=\"Encoded passwords\" class=\"wp-image-292\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-11.png 839w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-11-300x65.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-11-768x168.png 768w\" sizes=\"auto, (max-width: 839px) 100vw, 839px\" \/><\/figure>\n\n\n\n<p>I believe that the first one is Base64, based on the == at the end. So, let\u2019s go decode it.<\/p>\n\n\n\n<p>I usually go to this site, <a href=\"https:\/\/www.base64decode.org\/\">https:\/\/www.base64decode.org\/<\/a>, to decode Base64. It\u2019s fast and free. You could decode them through the command line, however, this is just faster in my opinion.<\/p>\n\n\n\n<p>Anyways, let\u2019s decode.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"481\" height=\"855\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-12.png\" alt=\"Decoding 1st password\" class=\"wp-image-293\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-12.png 481w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-12-169x300.png 169w\" sizes=\"auto, (max-width: 481px) 100vw, 481px\" \/><\/figure>\n\n\n\n<p>We have a username and password. Let\u2019s try the other.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"509\" height=\"808\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-13.png\" alt=\"decoded 2nd password\" class=\"wp-image-294\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-13.png 509w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-13-189x300.png 189w\" sizes=\"auto, (max-width: 509px) 100vw, 509px\" \/><\/figure>\n\n\n\n<p>Again, another username and password.<\/p>\n\n\n\n<p>Since we now have credentials that we can use, let\u2019s use Metasploit again. This time, a different module.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"533\" height=\"50\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-14.png\" alt=\"ms17 010 psexec\" class=\"wp-image-295\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-14.png 533w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-14-300x28.png 300w\" sizes=\"auto, (max-width: 533px) 100vw, 533px\" \/><\/figure>\n\n\n\n<p>With our options set and the SMBUser and SMBPass fields filled in with our first username and password. We execute the attack. This took 3 times of running it for it to create a meterpreter session.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"322\" height=\"100\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-15.png\" alt=\"Gained access\" class=\"wp-image-296\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-15.png 322w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-15-300x93.png 300w\" sizes=\"auto, (max-width: 322px) 100vw, 322px\" \/><\/figure>\n\n\n\n<p>We now have access to the box.<\/p>\n\n\n\n<p>Let\u2019s find the user flag.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"859\" height=\"230\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-16.png\" alt=\"user flag\" class=\"wp-image-297\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-16.png 859w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-16-300x80.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-16-768x206.png 768w\" sizes=\"auto, (max-width: 859px) 100vw, 859px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"670\" height=\"66\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-17.png\" alt=\"user flag grabbed\" class=\"wp-image-298\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-17.png 670w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-17-300x30.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-17-666x66.png 666w\" sizes=\"auto, (max-width: 670px) 100vw, 670px\" \/><\/figure>\n\n\n\n<p>Now, let\u2019s see if we can get the root flag. I\u2019m going to check the same place, except in Administrator\u2019s Desktop.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"905\" height=\"298\" src=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-18.png\" alt=\"root flag grabbed\" class=\"wp-image-299\" srcset=\"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-18.png 905w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-18-300x99.png 300w, https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/image-18-768x253.png 768w\" sizes=\"auto, (max-width: 905px) 100vw, 905px\" \/><\/figure>\n\n\n\n<p>There we go. Both flags with simple SMB access to the machine.<\/p>\n\n\n\n<p>Make sure you copy and paste your flags into the sections within TryHackMe and submit your answers. We are done!<\/p>\n\n\n\n<p>Hope you enjoyed the walkthrough!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>First off, I&#8217;d like to say that I love how this CTF challenge is modeled off a real penetration test.<\/p>\n<p><a href=\"https:\/\/infosecjake.net\/?p=280\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Tryhackme &#8211; Relevant CTF Walkthrough<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":303,"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,8,7,34],"class_list":["post-280","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ctf-challenge-walkthroughs","tag-ctf","tag-cyber-security","tag-infosec","tag-walkthrough"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/infosecjake.net\/wp-content\/uploads\/2023\/07\/Relevant.png","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/280","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=280"}],"version-history":[{"count":4,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/280\/revisions"}],"predecessor-version":[{"id":321,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/posts\/280\/revisions\/321"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=\/wp\/v2\/media\/303"}],"wp:attachment":[{"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infosecjake.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}