<?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 N V Anu on Medium]]></title>
        <description><![CDATA[Stories by N V Anu on Medium]]></description>
        <link>https://medium.com/@blu3whal3?source=rss-a558d2d5ca35------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KPoZ01ROSToHdn7aPsw2uA.jpeg</url>
            <title>Stories by N V Anu on Medium</title>
            <link>https://medium.com/@blu3whal3?source=rss-a558d2d5ca35------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 23:20:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@blu3whal3/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[Expose TryHackMe Walkthrough]]></title>
            <link>https://blu3whal3.medium.com/expose-tryhackme-walkthrough-34d4685d6225?source=rss-a558d2d5ca35------2</link>
            <guid isPermaLink="false">https://medium.com/p/34d4685d6225</guid>
            <category><![CDATA[web-pentesting]]></category>
            <category><![CDATA[tryhackme-writeup]]></category>
            <category><![CDATA[expose]]></category>
            <dc:creator><![CDATA[N V Anu]]></dc:creator>
            <pubDate>Thu, 14 Sep 2023 11:33:34 GMT</pubDate>
            <atom:updated>2023-09-14T14:15:33.114Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YzA_iOt-oZZTt2owKjx9AA.png" /></figure><h3><strong>Introduction</strong></h3><blockquote>Hey Guys, Welcome to my first-ever blog post on Medium, where I’ll be sharing TryHackMe challenge walkthroughs. I hope you guys enjoy the journey with me!</blockquote><blockquote>This blog post is going to be about the recent tryhackme room called <a href="https://tryhackme.com/room/expose"><strong>Expose</strong></a><strong>. </strong>It’s a fairly simple machine which requires a lot of recon and also some rabbit holes to throw us all. I hope you guys have fun with this room. Without further ado let’s begin…..</blockquote><blockquote>PS: This is gonna be a bit of a marathon, so hang tight for a bit.</blockquote><h3><strong>Enumeration</strong></h3><p>As usual let’s start with an All port Nmap scan.</p><pre>nmap -sV -sC -p- 10.10.248.104 -oN nma-scan -vv</pre><p>Looking at the results below we can see that we have 2 web app running on port 80 and 1337 respectively. Also we have FTP,SSH and an MQTT service running on their respective ports 21,22 and 1883 .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*O3b_Dep08l3POp0P5GqHqA.png" /></figure><p>Let’s look at the FTP server first and see if anonymous login is enabled or not.</p><pre>ftp 10.10.57.45</pre><p>From the response we can see that it indeed supports anonymous login.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*ylAiWPz23CRZNhEWzMsQuQ.png" /></figure><p>Looking at the FTP server, there isn’t anything stored in here and seems like a dead end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*abv5jusgpE7CodtuU6DtoA.png" /></figure><p><strong>Let’s now move on to the next service which is the web server running on port 1337.</strong></p><p>Opening the web page we can see just the text “EXPOSED”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*I_4zmlu_2PqyGzCnptAWZA.png" /></figure><p>Looking at the page source we don’t see anything except for the text “EXPOSED”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*LDIxwEh1MzOmDbNivoEu4A.png" /></figure><p>Let’s do a directory brute force and see if we can find any hidden routes. For this I used the tool <strong>ffuf</strong>.</p><pre>ffuf -u http://10.10.158.175:1337/FUZZ -w /usr/share/wordlists/SecLists/Discovery/Web-Content/raft-medium-directories.txt</pre><p>From the response we can see some interesting routes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H-moa8JVl84UoxyYQUK6Rw.png" /></figure><p>Let’s have a look at the /admin route first. Looking at the page we can see a login page with a question “Is this the right admin portal?”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wuoEV9ir5oaOwC_G8fxZoQ.png" /></figure><p>Let’s try a random admin credentials. It does not respond with anything, not even an error message. Which probably indicates that this is not the actual admin portal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HKPa19uGTq-AUWT7aX_azw.png" /></figure><p>Looking at the page source we can only see the HTML design without any indication of submit action that usually comes with a login page. Which mean this page is just a UI without any actual login functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*-Ir7b2PacxBRvxXmiYwR_Q.png" /></figure><p>Let’s have a look at the other admin route : /admin_101. Looking at the web page we can see an already filled username : <strong>hacker@root.thm</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zJTnivnCeadSlF1lEzySkg.png" /></figure><p>Lets try a random password to see if this login page works.</p><p>And…. we get an error message. which means that this is the actual login page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DOgJU_umGArZj7Fh0isnMA.png" /></figure><p>Let’s intercept the login request in Burp and see if we can find something.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*C66pQgnnVxHx4TdhaUZo8A.png" /></figure><p>Lets forward the request to the Repeater and send the request. Looking at the response we can see an SQL query which displays all the information for the user : hacker@root.thm.</p><p>An SQL query in the response could possibly mean an SQL injection attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*cyUG3p3CItmlBYiRwZ8AnA.png" /></figure><p>Lets check for SQL Injection vulnerability in the login functionality. For that we can use sqlmap.</p><p>First, copy the request into a file, which we can use with sqlmap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TUeE7Q34u9ykrXPTFvjZIg.png" /></figure><p>Now let’s run sqlmap against the login request file that we just copied.</p><pre>sqlmap -r request</pre><p>While running this command you’ll be prompted with some confirmations, lets respond to those in the following manner for the time being :</p><blockquote>“are you sure that you want to continue with further target testing? [Y/n] Y”</blockquote><blockquote>“it looks like the back-end DBMS is ‘MySQL’. Do you want to skip test payloads specific for other DBMSes? [Y/n] Y”</blockquote><blockquote>“injection not exploitable with NULL values. Do you want to try with a random integer value for option ‘ — union-char’? [Y/n] Y”</blockquote><blockquote>“POST parameter ‘email’ is vulnerable. Do you want to keep testing the others (if any)? [y/N] N”</blockquote><p>Once the command is executed completely, we can see in the final results that the email parameter is vulnerable to time-based sql injection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9AzRpxNTuvLR_ogb0QCntw.png" /></figure><h3>Exploiting SQL Injection</h3><p>Now, We know that the login page is vulnerable to time-based SQL Injection let’s use it to dump the database schema.</p><pre>sqlmap -r request --dbs </pre><p>From the results we can see a database called “expose” which seems like the database for the web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*IdjyExOVpa5xxHBxA31YfQ.png" /></figure><p>Now we have the database name we can dump all the tables within the “expose” database.</p><pre>sqlmap -r request -D expose --tables --dump</pre><p>From the results we can see 2 tables “user” and “config” and also some passwords within the expose database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*xjJgY83dnaC0fQ-N0zU4MA.png" /></figure><p>Looking at the contents of the user table we can see the password for the admin user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_gHvaZVE3tGmZmDQgZS-WA.png" /></figure><p>Now, lets try to login to the admin portal under the route /admin_101 with the credential we just found and boom we are logged in successfully. Looking at the page it seems like some kind of an AI chat application (Definitely not ChatGPT lol) with a banner message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*J2CO4c-_7T1Go679LAi7Qg.png" /></figure><p>Lets look at the page source to see if we have something there that we could use. It looks like we don’t have much info except for the text that we saw earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*d6flIUXmA_WW2j-wMsSiGQ.png" /></figure><p>We also have another table within expose database called “config” and looking at the contents of this table we can see two routes corresponding passwords to access those pages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*3zJns0fJp0QvYGbw6yASAw.png" /></figure><p>Since the first route’s password is stored in the form of a hash, lets crack it using the web-based tool <a href="https://crackstation.net/"><strong>Crackstation</strong></a>. After cracking the hash we got the password for the route : <strong>/file1010111/index.php</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*v7yjx_f55w0dGEbYSdvUIQ.png" /></figure><p>Let’s try the first route that we just got from the config table.</p><p>Firstly let’s try to navigate to the route : <a href="http://10.10.57.45:1337/"><strong>http://10.10.57.45:1337</strong></a><strong> /file1010111/index.php.</strong></p><p>As you can see from the screenshot below, user is prompted to enter a password .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*OrhJRovejGlfEv6fipY9RA.png" /></figure><p>Let’s use the password that we got from cracking the hash earlier. From the screenshot below, It looks like we got access to another admin page. And there is a hint on the page :</p><blockquote>Parameter Fuzzing is also important :) or Can you hide DOM elements?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-1hWStY7kE9K1DOevPjZ_w.png" /></figure><p>From the hint it seems like there is a hidden parameter which we could probably use to attack further.</p><p>Let’s look at the page source.</p><p>Looking at the page source below, this time unlike others we got a hidden hint which says :</p><blockquote>Hint: Try file or view as GET parameters?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cVRTnhNjRAlpt49vU69ujw.png" /></figure><p>Lets try the first parameter “file” and see if we get something from this. Let’s try with some random value for the file parameter. It doen’t respond with anything. Since this is a URL parameter we could try to find LFI vulnerability within this parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*xnof1D9sKyHwcAq78F6HfA.png" /></figure><h3>Exploiting LFI</h3><p>We’ll use the standard check for LFI, which is to see if the Linux passwd file /etc/passwd is accessible via the “file” parameter or not.</p><p>From the response below we can see that the parameter file is indeed vulnerable to LFI. We now have the list of users within the target system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cCj8Cenjrq1EGRzDJ5rZTg.png" /></figure><p>Now let’s look at the other route(<strong><em>/upload-cv00101011/index.php</em></strong>) that we got from the “config” table. From the screenshot below we can see that the user is prompted to enter a password and the hint here says :</p><blockquote>Hint: It is the name of machine user starting with letter “z”</blockquote><p>The hint indicates that the password is the name of the system user starting with “z” which we know from the previous <strong><em>/etc/passwd</em></strong> file that we got by exploiting the LFI vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*ZtS6QkkFYYMTNLzfJyaIcg.png" /></figure><p>Now, Let’s enter the password and submit. After submitting the password we are presented with a file upload page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ln2GTDwakDR7vZWRl_Y3OQ.png" /></figure><p>Looking at the page source we can see that there is a file upload validation script in place. Looking at it closely it seems like it only checks for the extension, if the extension is either jpg or png. No other front-end validation is in place. We could possibly bypass this validation and upload a reverse shell (unless there is a backend validation in place).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*64EGFES6MF4pjfvDlkwcIA.png" /></figure><p>Let’s intercept this request in Burp and change the file extension to see if we can bypass the file extension validation and upload a reverse shell.</p><p>We know that this application is built with php, let’s use a well known php reverse shell from <a href="https://github.com/pentestmonkey/php-reverse-shell"><strong>pentestmonkey</strong></a><strong> </strong>and<strong> </strong>set the lhost and lport values accordingly.</p><p>Now, lets rename the file with an extension jpg/png to bypass the file extension validation that is in place and then upload the file and intercept the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*KG2MqQNBsH2oMHTs1zVkuQ.png" /></figure><p>Now change the file extension to <strong>.php</strong> and forward the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*78uOrgo6Y87AdTIgjL2APA.png" /></figure><p>Looking at the web page we can see that the file has been uploaded successfully and it indicates that the path of the uploaded file can be seen in the source page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*SYj-uvyVz_6_fTWYJCWDXA.png" /></figure><p>Looking at the page source we can see that the file is uploaded under the directory <strong><em>/upload_thm_1001</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z8yDiCan8pswPsd8Hkw4Rw.png" /></figure><p>Looking under the directory <strong><em>/upload_thm_1001 </em></strong>we can see the uploaded file.</p><p><strong><em>NOTE</em></strong><em> : This route comes under the directory </em><strong><em>/upload-cv00101011</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*HtKPKFr9cjnO3qhviOqLXQ.png" /></figure><h3><strong>Let’s get a shell on this machine…</strong></h3><p>Lets Setup a netcat listener and navigate to the file that we uploaded.</p><p>Looking at the netcat listener we can see that we got a shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u3wXkM00f9HDENRJcHyK_A.png" /></figure><p>Let’s look under the home directory and see if we can find the user flag. Looking under the home directory we can see two users “ubuntu” and “zeamkish”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*9XOxBtUDQf11CKsNtSOgyg.png" /></figure><p>Looking at the user “zeamkish” home directory, we can see that we have the user flag file user.txt but we don’t have read permission. There is another file called ssh_creds.txt and the name indicates that it has some ssh credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*PDzN0JmuY2SG8CWpw-7SMg.png" /></figure><p>Looking at the ssh_creds.txt file we can see that we have the “zeamkish” user’s SSH password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*o_QSYTIwD_4RCs6T3Uzl_Q.png" /></figure><p>Now, login as the zeamkish user to get the user’s flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*4tiOD0bK5v7jqVLd64dKqg.png" /></figure><h3><strong>Privilege Escalation</strong></h3><p>Now its time for some privilege escalation….</p><p>Firstly let’s see if the current user can run any binary as sudo</p><pre>sudo -l</pre><p>From the response we can see that the current user cannot run any binary as sudo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*qJumyZQo8uI1d4kavbAryg.png" /></figure><p>Now, let’s look for any binaries with SUID bit set</p><pre>find / -type f -perm -u=s 2&gt;/dev/null</pre><p>From the response we can see that we have the find binary with SUID bit set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*9ndEp48tdTJtxt8D8XNgSQ.png" /></figure><p>We can use the <a href="https://gtfobins.github.io/gtfobins/find/#suid"><strong>GTFobins</strong></a> script to escalate our privilege.</p><pre>/usr/bin/find . -exec /bin/sh -p \; -quit</pre><p>After running the above command we got a root shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*0VSKywyJB06fwHoQpdWG3g.png" /></figure><p>Now lets get the root flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*xV_BtREV1M0gotGFVo5yfg.png" /></figure><blockquote>And that’s pretty much it for this blog. I hope this blog was fun and you guys learned something from this. If you did, don’t forget to leave me a clap :). I am open for any questions, feedbacks or suggestions and finally thanks for sticking out with me so far.</blockquote><blockquote>Be safe, be curious and Happy Hacking….</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34d4685d6225" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>