{"id":11694,"date":"2024-02-22T17:27:33","date_gmt":"2024-02-22T11:57:33","guid":{"rendered":"https:\/\/reconforce.in\/blog\/?p=11632"},"modified":"2024-02-22T17:27:33","modified_gmt":"2024-02-22T11:57:33","slug":"lazyadmin-ctf-walkthrough-2024","status":"publish","type":"post","link":"https:\/\/reconcybersecurity.com\/blogs\/lazyadmin-ctf-walkthrough-2024\/","title":{"rendered":"LazyAdmin CTF Walkthrough &#8211; 2024"},"content":{"rendered":"\n<h2 id=\"introduction-to-lazyadmin-ctf\" class=\"wp-block-heading\"><strong>Introduction to LazyAdmin CTF<\/strong><\/h2>\n\n\n\n<p>Welcome to the LazyAdmin CTF Walkthrough! This guide will help you beat the challenges in the LazyAdmin Capture The Flag (CTF) competition. We&#8217;ll go through each task step by step, making it easy for beginners and fun for experts. Whether you&#8217;re new to cybersecurity or a pro looking for a challenge, this walkthrough is for you. Let&#8217;s get started and conquer the LazyAdmin CTF together!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"setup-environment\"><strong>Setup Environment<\/strong><\/h3>\n\n\n\n<div class=\"wp-block-media-text has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center\" style=\"grid-template-columns:auto 25%\"><div class=\"wp-block-media-text__content\">\n<p><strong>TryHackMe | LazyAdmin<\/strong><\/p>\n\n\n\n<p>TryHackMe is an online platform for learning and teaching cyber security, all through your browser.<\/p>\n\n\n\n<p class=\"has-small-font-size\">tryhackme.com<\/p>\n<\/div><figure class=\"wp-block-media-text__media\"><a href=\"https:\/\/tryhackme.com\/room\/lazyadmin\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/1-zUZIT0rM94Et42XCCtc9yg.jpg\" alt=\"LazyAdmin\" class=\"wp-image-11633 size-full\"\/><\/a><\/figure><\/div>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Via VulnHub:<\/strong> Download the Mr. Robot machine onto your local device, install it on a virtualization platform such as VirtualBox, configure the network settings, and initiate the attack.<\/li>\n\n\n\n<li><strong>Through TryHackMe:<\/strong> Alternatively, access to this machine is possible via TryHackMe. Download the VPN configuration file to your device and utilize openvpn with the specified command:<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240202_120545-2.png\" alt=\"\" class=\"wp-image-11594\"\/><\/figure>\n\n\n\n<p>You should see this line at the end of the code\u2026<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240202_121026.png\" alt=\"\" class=\"wp-image-11595\"\/><\/figure>\n\n\n\n<p>Alternatively, leverage the Attackbox offered by THM. A VPN connection is necessary since both our machine and the target machine need to be on the same network for effective attacks.&nbsp;<\/p>\n\n\n\n<p>Once all prerequisites are in place, we\u2019re set to initiate the scan on the target machine.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"mr-robot-ctf-challenges\"><span id=\"lazyadmin-ctf-challenges\"><strong>LazyAdmin CTF Challenges<\/strong><\/span><\/h3>\n\n\n\n<p>Below are the two keys we have to find in order to complete our LazyAdmin CTF&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240216_172639-1024x332.png\" alt=\"\" class=\"wp-image-11634\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"challenge-1-scanning\"><strong>Challenge 1: <\/strong>Scanning<\/h4>\n\n\n\n<p>In the LazyAdmin <a href=\"https:\/\/reconforce.in\/oscp-training-in-delhi.html\" target=\"_blank\" rel=\"noreferrer noopener\">CTF<\/a> scanning phase, we have to use tools like nmap to check the target machine for weak points. Look for open doors (ports), services, and possible entry spots, laying the groundwork for the next steps in their attack plan.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"solution\"><strong>Solution:<\/strong><\/h5>\n\n\n\n<p>IP given by Machine \u2013<strong> 10.10.241.186<\/strong><\/p>\n\n\n\n<p><strong>Note: <\/strong>In your case, IP will be different as the Machine generates random IP every time.<\/p>\n\n\n\n<p><strong>Scanning the network with Nmap:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>nmap -v 10.10.241.186<\/strong><\/code><\/pre>\n\n\n\n<p>After scanning we can see that there two some ports opened on the server.<\/p>\n\n\n\n<p><strong>Ports Opened: <\/strong>22 &#8211; OpenSSH, 80 &#8211; HTTP.<\/p>\n\n\n\n<p>Let&#8217;s scan these specific ports and see if we can find any information about them&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>nmap -sV -sC -p 80,22 -v 10.10.241.186<\/strong><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240216_174724.png\" alt=\"\" class=\"wp-image-11635\"\/><\/figure>\n\n\n\n<p>Since port 80 is open, let&#8217;s go to the URL and see what&#8217;s there.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240216_175930-1024x387.png\" alt=\"\" class=\"wp-image-11636\"\/><\/figure>\n\n\n\n<p>We&#8217;re only seeing an Apache Default page when accessing the IP address. We can attempt to discover hidden directories on the URL using gobuster. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>gobuster dir -u http:\/\/&lt;MACHINE_IP&gt; -w &lt;PATH_TO_WORDLIST<\/strong><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240218_160755-1024x257.png\" alt=\"\" class=\"wp-image-11638\"\/><\/figure>\n\n\n\n<p><strong>Directory found &#8211; [<\/strong> \/content <strong>]<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240218_161302.png\" alt=\"\" class=\"wp-image-11639\"\/><\/figure>\n\n\n\n<p>After checking the directory, we discovered only one webpage, the image of which is provided below\u2026<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240218_161709-1024x406.png\" alt=\"\" class=\"wp-image-11640\"\/><\/figure>\n\n\n\n<p>To discover additional information, we can utilize the Gobuster tool once more, this time focusing on the previously identified directory (<strong>\/content<\/strong>) to uncover any hidden content within it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240218_162424-1024x68.png\" alt=\"\" class=\"wp-image-11641\"\/><\/figure>\n\n\n\n<p>After executing the command, we discovered several directories within the &#8216;<strong>\/content&#8217;<\/strong> directory. Out of these, only two directories are significant for us, bringing us closer to completing our LazyAdmin CTF.<\/p>\n\n\n\n<p>The names of those directories are marked in the following screenshot:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240218_164337-1024x187.png\" alt=\"\" class=\"wp-image-11642\"\/><\/figure>\n\n\n\n<p>Let&#8217;s have a look at these directories and see if we can something interesting there&#8230;<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Directory 1 &#8211; \/Inc<\/strong><\/p>\n\n\n\n<p><strong>Directory Path: <\/strong>&lt;Machine IP&gt;\/content\/inc<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240218_165251.png\" alt=\"\" class=\"wp-image-11643\"\/><\/figure>\n\n\n\n<p>There&#8217;s something interesting in the mysql_backup folder. Let&#8217;s navigate inside and see what it holds.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240220_162659.png\" alt=\"\" class=\"wp-image-11644\"\/><\/figure>\n\n\n\n<p>Here&#8217;s a <strong>MySQL<\/strong> backup file that will help us in the upcoming challenges of our CTF. so you should download it onto your system.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Directory 1 &#8211; \/as<\/strong><\/p>\n\n\n\n<p><strong>Directory Path: <\/strong>&lt;Machine IP&gt;\/content\/as<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240220_163712-1024x461.png\" alt=\"\" class=\"wp-image-11645\"\/><\/figure>\n\n\n\n<p>Great! This seems to be a login page of some website that might help us in finding our keys. Now, the question is: How can we log in without any information about the username and password?<\/p>\n\n\n\n<p>Remember, we only have one crucial file that may contain information about this login page. Let&#8217;s use the &#8216;cat&#8217; command to check and see what information we can extract from it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>cat mysql_bakup_20191129023059-1.5.1.sql<\/strong>\n#In your case file name might be different...<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240220_165744-1024x177.png\" alt=\"\" class=\"wp-image-11646\"\/><\/figure>\n\n\n\n<p>You can see that this file contains a username and a password that we can use to gain access into that login page we found earlier, but the password is in hash so quickly decrypt it by visiting <a href=\"https:\/\/crackstation.net\/\" target=\"_blank\" rel=\"noreferrer noopener\">crackstation.net<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240220_171049-1024x336.png\" alt=\"\" class=\"wp-image-11647\"\/><\/figure>\n\n\n\n<p>Password for the username &#8216;<strong>manager<\/strong>&#8216; is &#8216;<strong>Password123<\/strong>&#8216;. Login into that panel by using this information.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240220_172117-1024x413.png\" alt=\"\" class=\"wp-image-11649\"\/><\/figure>\n\n\n\n<p>We&#8217;re in! First, take a look at this panel and find a spot where we can upload our script, also known as our reverse shell. There are a few pages in this panel where we can do that. Let&#8217;s upload our reverse shell script on the &#8216;<strong>ADS<\/strong>&#8216; page.<\/p>\n\n\n\n<p>You can copy a php reverse shell code by visiting pentestmonkey on github by clicking <a href=\"http:\/\/You can copy a php reverse shell code by visiting pentestmonkey on github by clicking this button -\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>here<\/strong><\/a>.<\/p>\n\n\n\n<p>After copying the shell, paste it into the &#8216;<strong>ADS<\/strong>&#8216; page of our panel and give it a name of your choice to identify.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240220_174607-1024x378.png\" alt=\"\" class=\"wp-image-11651\" style=\"width:683px;height:auto\"\/><figcaption class=\"wp-element-caption\"><strong>Change the ip to your host ip and leave the port default <\/strong><\/figcaption><\/figure>\n\n\n\n<p>After clicking &#8216;Done,&#8217; revisit the <strong>\/inc<\/strong> directory and locate a folder named &#8216;<strong>ads<\/strong>.&#8217; Enter this folder.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240220_175720-1024x248.png\" alt=\"\" class=\"wp-image-11652\"\/><\/figure>\n\n\n\n<p>Now, we just have simply click on our reverse shell script file to execute it. Before doing so, ensure to start the netcat listener in your terminal using the port specified in the script.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>nc -nvlp &lt;port no.&gt;<\/strong> #By default port no. is 1234<\/code><\/pre>\n\n\n\n<p>Once after running the command in your terminal, click on your reverse shell file inside the &#8216;\/ads&#8217; folder and check if you got the shell or not in your terminal.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240221_174401-1024x301.png\" alt=\"\" class=\"wp-image-11654\" style=\"width:680px;height:auto\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240221_174514-1-1024x179.png\" alt=\"\" class=\"wp-image-11655\"\/><\/figure>\n\n\n\n<h5 id=\"finding-1st-flag-of-lazyadmin-ctf\" class=\"wp-block-heading\"><strong>Finding 1st Flag of Lazyadmin CTF<\/strong><\/h5>\n\n\n\n<p>Look, we&#8217;ve got our shell. Now to grab both flags of our Lazyadmin CTF, just follow the steps below.<\/p>\n\n\n\n<p><strong>Step1: <\/strong>type <code>cd home <\/code>to get into home directory.<\/p>\n\n\n\n<p><strong>Step2:<\/strong> After typing <code>ls<\/code>, we only got one directory called &#8216;<strong>itguy<\/strong>&#8216; so get into it and you can see a file named <strong>user.txt<\/strong> there. It&#8217;s your first key, so copy and paste it into the first answer slot of THM.  <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240221_181338-1024x478.png\" alt=\"\" class=\"wp-image-11657\"\/><\/figure>\n\n\n\n<h5 id=\"finding-2st-flag-of-lazyadmin-ctf\" class=\"wp-block-heading\"><strong>Finding 2st Flag of Lazyadmin CTF<\/strong><\/h5>\n\n\n\n<p>Congratulations on obtaining the first flag in the LazyAdmin CTF! To acquire the second one, follow the steps below.<\/p>\n\n\n\n<p><strong>Step2:<\/strong> To obtain the root flag, we must escalate our privileges and become the root user.<\/p>\n\n\n\n<p><strong>Command &#8211; <\/strong><code>sudo -l<\/code><\/p>\n\n\n\n<p><strong>Step3:<\/strong> You can see, a perl scripting language and path to a backup file here. So go to <strong>\/home\/itguy directory<\/strong> and use <code>cat<\/code> command to see content of <strong>backup.pl<\/strong> file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240222_162556-1024x441.png\" alt=\"\" class=\"wp-image-11659\"\/><\/figure>\n\n\n\n<p><strong>Step4:<\/strong> In the image above, you can see a <strong>copy.sh<\/strong> script located in the &#8216;<strong>\/etc<\/strong>&#8216; directory. This script is set to run when we execute backup.pl.<\/p>\n\n\n\n<p><strong>Step5: <\/strong>See content of copy.sh by using <code>cat \/etc\/copy.sh<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240222_163521.png\" alt=\"\" class=\"wp-image-11660\"\/><\/figure>\n\n\n\n<p><strong>Step6:<\/strong> To gain root access, we simply need to edit this script, replace its IP with our tunnel IP, and then activate the netcat listener on the specified port number.<\/p>\n\n\n\n<p><strong>Step7:<\/strong> Open a leafpad and copy\/paste this code into it, then change the IP to your tunnel or host IP.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240222_165616-1024x115.png\" alt=\"\" class=\"wp-image-11662\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<p><strong>Step8:<\/strong> Open a new terminal window and begin your netcat listener on the designated port. Then, paste the modified code into your previous terminal session. After executing the command below, you&#8217;ll have root access in your new shell.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/usr\/bin\/perl \/home\/itguy\/backup.pl<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240222_171945.png\" alt=\"\" class=\"wp-image-11664\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"895\" height=\"105\" src=\"https:\/\/reconforce.in\/blog\/wp-content\/uploads\/2024\/02\/Screenshot_20240222_172057.png\" alt=\"\" class=\"wp-image-11665\" srcset=\"https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/Screenshot_20240222_172057.png 895w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/Screenshot_20240222_172057-300x35.png 300w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/Screenshot_20240222_172057-768x90.png 768w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/Screenshot_20240222_172057-380x45.png 380w, https:\/\/reconcybersecurity.com\/blogs\/wp-content\/uploads\/2024\/02\/Screenshot_20240222_172057-800x94.png 800w\" sizes=\"auto, (max-width: 895px) 100vw, 895px\" \/><\/figure>\n\n\n\n<p>Congratulations on obtaining the root flag and completing the LazyAdmin CTF! We hope you found the walkthrough helpful and enjoyable.<\/p>\n","protected":false},"excerpt":{"rendered":"Introduction to LazyAdmin CTF Welcome to the LazyAdmin CTF Walkthrough! This guide will help you beat the challenges&hellip;\n","protected":false},"author":1,"featured_media":0,"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,"footnotes":""},"categories":[2326,2318],"tags":[2327,2316,2328,2329,2330,2331],"class_list":{"0":"post-11694","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-blogs","7":"category-ctf-walkthrough","8":"tag-capture-the-flag","9":"tag-ctf","10":"tag-lazyadmin","11":"tag-lazyadmin-ctf","12":"tag-reverse-shell","13":"tag-tryhackme"},"_links":{"self":[{"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/posts\/11694","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/comments?post=11694"}],"version-history":[{"count":0,"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/posts\/11694\/revisions"}],"wp:attachment":[{"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/media?parent=11694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/categories?post=11694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/reconcybersecurity.com\/blogs\/wp-json\/wp\/v2\/tags?post=11694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}