<?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 Shehzad Ali on Medium]]></title>
        <description><![CDATA[Stories by Shehzad Ali on Medium]]></description>
        <link>https://medium.com/@hunter313?source=rss-ece8c5c2e858------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*p1nTk7QZgeC4AZBv5UFWZA.png</url>
            <title>Stories by Shehzad Ali on Medium</title>
            <link>https://medium.com/@hunter313?source=rss-ece8c5c2e858------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 23:04:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hunter313/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[Software Supply Chain Attack — NPM Dependency Confusion]]></title>
            <link>https://hunter313.medium.com/software-supply-chain-attack-npm-dependency-confusion-b8c35daf0bad?source=rss-ece8c5c2e858------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8c35daf0bad</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[supply-chain-security]]></category>
            <dc:creator><![CDATA[Shehzad Ali]]></dc:creator>
            <pubDate>Thu, 02 Oct 2025 12:24:03 GMT</pubDate>
            <atom:updated>2025-10-03T06:29:17.235Z</atom:updated>
            <content:encoded><![CDATA[<h3>Software Supply Chain Attack — NPM Dependency Confusion</h3><h3>TL;DR</h3><p>I discovered an NPM <strong>dependency confusion</strong> (a type of software supply chain attack) during a black-box pentest of a client’s web application. By claiming an unowned official package name on the public npm registry and publishing a tiny package with a callback, I received callbacks from the target’s stage environment. I was also able to get a short-lived reverse shell, and then automate post-compromise collection for secrets (SSH keys, AWS creds, etc.). This write-up explains what dependency confusion is, how I found it, what happened in my proof-of-concept (PoC), the real impact, and how to prevent and detect these attacks.</p><h3>What is a software supply chain attack?</h3><p>A <strong>software supply chain attack</strong> targets the tools, libraries, packages, or processes used to build, test, or deploy software rather than the software itself. Instead of exploiting an application directly, an attacker compromises something the application depends on for example, a third-party library or a CI/CD pipeline and uses that trust to run malicious code inside the victim’s build or runtime environment.</p><p>Common entry points for supply chain attacks:</p><ul><li>Public package repositories (npm, PyPI, RubyGems, etc.)</li><li>Compromised build servers or CI credentials</li><li>Malicious updates to dependencies</li><li>Typosquatting / dependency confusion (the focus here)</li></ul><h3>What is an NPM dependency confusion attack?</h3><p><strong>Dependency confusion</strong> occurs when an application or build process resolves a package name to a public registry (npmjs.org) instead of an internal or private registry that the organization intended to use. If the organization has a package or internal dependency name that is <em>not claimed</em> on the public registry or if the build system prefers public packages nan attacker can publish a malicious package with that same name on the public registry. When builds or deployments install the dependency, they pull the attacker’s package and execute its code in the build or runtime environment.</p><p><strong>Why this works:</strong></p><ul><li>Many package managers resolve to public registries by default.</li><li>CI systems or build scripts sometimes do not enforce scoped (org) names or private registry configuration.</li><li>Developers may reference package names that are ambiguous (not scoped to @org/), allowing confusion between internal and public packages.</li></ul><h3>My Engagement:</h3><p>I was performing a black-box pentest for a client. The target web application had already been tested multiple times and, after several rounds, I hadn’t found any valid vulnerabilities in the application code itself.</p><p>While browsing X, I saw a <a href="https://x.com/GodfatherOrwa/status/1937434096054964426">post</a> by <a href="https://x.com/GodfatherOrwa/status/1937434096054964426">@GodfatherOrwa</a> about a Burp Suite technique that leverages JS miner extension. I adapted that idea to probe the target for any unscoped or unclaimed packages on the public npm registry and used those findings to drive further testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*-sCiKSfYF7s12hMMuD9YrA.png" /><figcaption>Tips for Dependency Confusion Finding</figcaption></figure><p>Quickly i use this trick and I found something surprising, a package name that the organisation appeared to use internally was not claimed on npmjs.org.</p><p>It looked like an “official” package name but nobody had reserved it publicly, so there was a clear gap an attacker could exploit. That small oversight made the whole supply chain trick possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HA9A6eODlwec6e0i5io6gg.png" /><figcaption>The ORG was not Claimed (NPM Package was also Not Claimed)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4fQvlyNiB4BlRB5hrT_KSQ.png" /><figcaption>Target Package Not Found</figcaption></figure><p>To prove it, I quickly registered and published a tiny proof-of-concept package under that unclaimed name. I kept the package harmless on purpose: its only job was to show whether the staging environment would actually pull and run code from the public registry.</p><p>Inside the package I added a simple callback (a ping to a Burp Collaborator / webhook) so I could see if and when the target fetched and executed the package. Not long after publishing, the stage environment hit my callback :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q9ByPYzQFmuTEKVQweq0KQ.png" /><figcaption>Publishing Package with Malicious Code Index.js</figcaption></figure><p>That network callback confirmed the stage host had fetched my package from npmjs.org and executed its lifecycle. This changed the issue from a theoretical risk into a demonstrated compromise: the build/runtime was resolving an attacker-controlled package name from the public registry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K-7gOT9sd-veMu4wy5WR0Q.png" /><figcaption>Initial Callbacks on Burp-Collab</figcaption></figure><p>I attempted a reverse shell and the connection came through, but it stayed open only for a few seconds (ephemeral shell). Even though short, that shell proved that arbitrary code could run in the staging environment when a malicious package is installed.</p><p>To show the full impact I built a<a href="https://github.com/Shehzadcyber/NPM-Dependency-Confusion-Attack-RCE-Payload"> JavaScript automation</a> that would run on the compromised host, look for common secrets (SSH keys, AWS credentials, API tokens) and send any findings back to my server using the configured webhook. Using the callback evidence plus the controlled automation, I was able to escalate the situation: with the credentials and misconfigurations discovered during testing, I ultimately gained root on the stage host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g2SCYLLCsmryEF0GXK-0DA.png" /><figcaption>Reverse Shell Established</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*062a7NPD5ARPinxtWLLKtw.png" /><figcaption>AWS Creds</figcaption></figure><h4><strong>Next?</strong></h4><p>It wasn’t only the staging environment that contacted my callbacks far from it. Because the package name matched the organisation’s official brand (for example, testbrand for a company named “TEST brand”), and also the same path was used for the npm module i.e /npm/module/XYZ</p><p>After I published the proof-of-concept package, I received numerous requests: CI/CD runners, build agents, and several stage hosts reached out to my endpoints. This pattern strongly suggested that multiple parts of the infrastructure were resolving the package name to the public npm registry.</p><p>So why didn’t I capture a production callback? The answer is simple human error. I was changing the webhook.site identifier and repeatedly restarting Burp Suite during testing, which fragmented my telemetry. Because I rotated webhook IDs and closed Burp Collaborator sessions while new installs were occurring, I missed some of the incoming hits including the one I strongly suspect originated from a production host.</p><p>After numerous attempts to demonstrate further impact attempting to verify RCE and to enumerate credentials npm flagged the package as suspicious.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tYemYVVdQJ5Iim0-sYglGA.png" /></figure><p>The package was labeled as backdoored and an advisory was published; the package had been downloaded across many systems (“1000+” downloads). Once the package was marked and the advisory went live, I was no longer able to reproduce the reverse shell against production hosts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*snzfrbqqA5sHLPTvFnSrzg.png" /><figcaption>Advisories</figcaption></figure><p>However, the combination of early callbacks from various infrastructure components, the advisory download numbers, and the fact that the package name was explicitly tied to the organisation’s brand left me confident the production environment had been affected during the window before npm intervened.</p><h3>Why this is so dangerous ?</h3><p>A successful dependency confusion attack can lead to any of the following, depending on where the malicious package executes:</p><ul><li><strong>Remote code execution (RCE)</strong> in build servers or runtime environments.</li><li><strong>Credential theft</strong> (CI tokens, cloud credentials, SSH keys) if the environment has secrets available.</li><li><strong>Privilege escalation</strong> if stolen credentials access more sensitive systems.</li><li><strong>Persistent backdoors</strong> installed in production or distribution channels.</li><li><strong>Malware distribution</strong> by injecting malicious code into official builds or releases.</li><li><strong>Supply chain compromise at scale</strong>, affecting downstream customers who consume the compromised artifact.</li></ul><p>Because packages run in the context of the environment that installs them, the attacker inherits whatever privileges that environment has. If CI/CD runners have cloud credentials, an attacker can pivot from there to cloud resources.</p><h3>Ethical &amp; Legal note</h3><p>Supply-chain testing can cause significant disruption. Always:</p><ul><li>Work <strong>only within the written scope</strong> of the engagement.</li><li><strong>Notify</strong> the client and stop active exploitation once you have sufficient evidence.</li><li><strong>Coordinate takedown</strong> of any public artifacts you created and help the client rotate credentials exposed during testing.</li><li>Avoid leaving backdoors or persistent access after the test.</li></ul><h3>Final recommendations (quick checklist for orgs)</h3><ul><li>Enforce scoped package names for internal packages.</li><li>Use private registries and lock CI to them.</li><li>Pin dependencies and commit lockfiles.</li><li>Limit CI permissions and use ephemeral credentials.</li><li>Monitor package publishes and set alerts for typosquat or unclaimed names matching internal patterns.</li><li>Rotate credentials if a dependency confusion event is confirmed.</li><li>Run dependency and SBOM tooling in CI.</li></ul><h3>Conclusion</h3><p>This write-up highlighted the risks and real-world impact of an NPM dependency confusion attack, a type of software supply chain compromise. By demonstrating how a malicious package can be pulled by a build or runtime environment, we showed that even small oversights in package naming or registry configuration can lead to serious security breaches. The engagement revealed that staging environments, CI/CD runners, and multiple infrastructure components were all vulnerable to such attacks, underlining the importance of supply chain security in modern software development.</p><h3>References</h3><ol><li><a href="https://www.researchgate.net/publication/371304663_Software_supply_chain_security_issues_and_countermeasures">Michael, A. (2021). <em>Software Supply Chain Security</em></a><em>: Risks and Best Practices</em>. InfoSec Journal.</li><li><a href="https://www.blazeinfosec.com/post/dependency-confusion-exploitation/">https://www.blazeinfosec.com/post/dependency-confusion-exploitation/</a></li><li>MITRE ATT&amp;CK. (2025). <em>Supply Chain Compromise (T1195)</em>. Retrieved from <a href="https://attack.mitre.org/">https://attack.mitre.org/</a></li></ol><h3><strong>About the Author:</strong></h3><p>Shehzad Ali<br>Cyber Security Researcher<br><strong>Github<br>LinkedIn</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8c35daf0bad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Account Takeover in Android App (OTP Bypass)]]></title>
            <link>https://hunter313.medium.com/account-takeover-in-android-app-otp-bypass-81d4428f0bc2?source=rss-ece8c5c2e858------2</link>
            <guid isPermaLink="false">https://medium.com/p/81d4428f0bc2</guid>
            <category><![CDATA[mobile-app-testing]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Shehzad Ali]]></dc:creator>
            <pubDate>Sat, 14 Jun 2025 11:58:37 GMT</pubDate>
            <atom:updated>2025-06-14T11:58:37.754Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone! <br>I’m back with another interesting write-up. This time, I’ll share how I found an easy Account Takeover (ATO) vulnerability in an <strong>Android application</strong> during a penetration test. The app I tested was for healthcare, mainly used for patient engagement and support. For privacy reasons, let’s call the app test.apk.</p><h3>Target Overview</h3><p>The app (test.apk) helps patients connect with healthcare services. To protect user data, the app had a proper authentication process with several steps, such as verifying personal information, OTP code, and PIN code. But I found a serious bug in the OTP validation process that allowed me to bypass authentication and take over accounts<strong>.</strong></p><p>Let’s look at how the login flow works.</p><h3>Authentication Process in the Test.apk</h3><p>Here’s how a user logs in to the app:</p><p><strong>1.Personal Info Step<br></strong>The user enters:</p><ul><li>First Name</li><li>Last Name</li><li>Date of Birth (DOB)</li></ul><p><strong>2. Verification Step<br></strong>The app checks the data and then displays:<br> i. Partially hidden phone number (like ******1234)<br> ii. Partially hidden email (like t****@****.com)</p><p><strong>3. OTP Step</strong><br>The user selects either phone or email to receive the OTP (One-Time Password).</p><p><strong>4. PIN Step</strong><br>After entering a valid OTP, the app asks for a PIN code to create a new PIN code (Normally on Mobile devices for app lock).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Com4UuBJbAGmYBZGDp_1g.jpeg" /><figcaption>Authentication Flow of Test.apk</figcaption></figure><p>Sounds secure, right? But the OTP logic had a big weakness…</p><h3>Vulnerability:</h3><h4>OTP Bypass via Response Tampering</h4><p>The main issue was with the OTP verification API.</p><p>When the user enters an OTP, the app sends it to the server and gets a response in JSON format like this:</p><pre>{<br>  &quot;stat&quot;: 0<br>}</pre><ul><li>&quot;stat&quot;: 0 means the OTP is invalid</li><li>&quot;stat&quot;: 1 means the OTP is valid</li></ul><p>Now here’s the problem:<br>This check was only done on the client side not properly verified on the backend.</p><p>So I tried response manipulation:</p><h3>Steps I Did to Bypass OTP</h3><ol><li>I opened the app and entered: First Name, Last Name and DOB</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*UK0ZrPvGULh1tqIbEntU_A.png" /><figcaption>Test.apk Entry Point</figcaption></figure><p>2. I chose my email to receive an OTP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*xfiWcDMnxbeiHw8jXWWVSw.png" /><figcaption>Choosing Option to Receive OTP</figcaption></figure><p>3. Then, I entered a fake/invalid OTP like 111111.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*BSQL4spmMKFOAX3xO5PNNQ.png" /><figcaption>Invalid OTP</figcaption></figure><p>4. Using Burp Suite, I intercepted the response from the server. It returned:</p><pre>{<br>  &quot;stat&quot;: 0<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B9MB4_O9crxQQs5ZZFpNDQ.png" /><figcaption>Invalid Response</figcaption></figure><p>5. I changed<strong> </strong><strong>stat: 0 to </strong><strong>stat: 1</strong> in the response and forwarded it:</p><pre>{<br>  &quot;stat&quot;: 1<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bCNxkc71zKbAvIhZpO0eWA.png" /><figcaption>Changed stat Value From 0 to 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*Ck_MSTc60WgU4PY_xWhVIA.png" /><figcaption>Successful Response Received From Modified stat Value</figcaption></figure><p>And boom I was allowed to move to the next step without entering the real OTP.</p><p>6. The app then asked me to set a new PIN. I did that and successfully logged in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*CIqNj2JiF8AxWMjtAQWKfw.png" /><figcaption>Entering New PIN Code</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*IRdekA5xxUHSi6HnYrbB-A.png" /><figcaption>User UI: Successfully Logged into Account</figcaption></figure><p>I bypassed the OTP step completely using response tampering. This allowed me to take over an account!</p><h3>Impact:</h3><p>This vulnerability could allow Account Takeover (ATO). But there’s a small limitation:</p><p>To reach the OTP screen, the attacker must first know the victim’s:</p><ul><li>First Name</li><li>Last Name</li><li>Date of Birth</li></ul><p>These details can be hard to guess, especially the DOB, which reduces the risk slightly.</p><p>But still, if the attacker somehow knows this information (like in a hospital setting or insider threat), they can:</p><ul><li>Receive the victim’s OTP screen</li><li>Bypass OTP</li><li>Set a new PIN</li><li>Take over the account</li></ul><p>That’s a serious issue in healthcare apps, where sensitive personal and medical data is involved.</p><h3>How This Can Be Exploited</h3><p>An attacker can:</p><ul><li>Use OSINT or leaked data to get names and DOBs</li><li>Input them into the app</li><li>Intercept and tamper with OTP responses</li><li>Bypass OTP and set a PIN</li><li>Get full access to user data (medical history, appointments, etc.)</li></ul><h3>Why Your Healthcare Information Should Be Private and Confidential?</h3><p>Healthcare data is one of the most sensitive types of<strong> personal information</strong>. It includes your medical history, test results, prescriptions, mental health records, and even personal details like your home address and contact information. If this information falls into the wrong hands, it can lead to:</p><ul><li><strong>Privacy Violations</strong>: No one wants their private health issues to be shared without their permission. Leaked medical details can be embarrassing or damaging to your personal life and relationships.</li><li><strong>Identity Theft</strong>: Health records often contain full names, dates of birth, insurance IDs, and more all of which can be used to steal your identity or commit fraud.</li><li><strong>Targeted Scams or Exploitation</strong>: Attackers can use your health data to send fake messages, scams, or emotional blackmail based on your condition or treatment.</li></ul><p>In short, keeping healthcare data confidential isn’t just a technical matter but also it cause serious <strong>psychological effects.</strong></p><h3>Fix / Recommendation</h3><p>To fix this vulnerability:</p><ul><li>The OTP should be verified only on the backend server, not on the client-side.</li><li>The response should be signed or encrypted so it cannot be modified by attackers.</li><li>Implement tamper detection for API responses.</li><li>Use rate limiting and device binding to block repeated guessing.</li><li>Ensure OTP codes expire quickly and are single-use only.</li></ul><h3>What I Learned</h3><p>This bug taught me how even a small mistake in logic handling on the client-side can lead to critical security issues like account takeover. Always remember:</p><blockquote><strong><em>Never trust client-side validation. All important checks must be done on the backend.</em></strong></blockquote><h3>Final Words</h3><p>This was a fun and important finding for me during mobile app testing. It also reminded me how important it is to check both logic and API flows in Android apps.</p><p>Hope this write-up helps others to understand how logic bugs can lead to ATO, even when the app seems secure on the outside.</p><p>If you liked this write-up, feel free to connect, learn, and grow together.</p><p>Thanks for reading.</p><p>Follow me for more real-world pentest stories and write-ups.</p><h4><a href="https://www.linkedin.com/in/shehzadali1337/"><strong>TheRoyHunter313</strong></a><strong><br></strong><a href="https://x.com/TheRoyHunter313"><strong>X</strong></a><strong><br></strong><a href="https://www.linkedin.com/in/shehzadali1337/"><strong>LinkedIn</strong></a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81d4428f0bc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How a Simple Git Leak Led to AWS Keys & Database Credentials]]></title>
            <link>https://hunter313.medium.com/how-a-simple-git-leak-led-to-aws-keys-database-credentials-1f24ed5bd665?source=rss-ece8c5c2e858------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f24ed5bd665</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[Shehzad Ali]]></dc:creator>
            <pubDate>Mon, 09 Jun 2025 05:21:45 GMT</pubDate>
            <atom:updated>2025-06-09T05:21:45.767Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone<strong>,</strong><br>I’m Shehzad Ali, a cybersecurity researcher and penetration tester. This is my second write-up where I’ll share something very interesting that I found during a pentest. I hope this short story will help beginners in pentesting understand how something small can lead to a big issue.</p><h3><strong>What Happened?</strong></h3><p>While testing the target application, I was using the <a href="https://chromewebstore.google.com/detail/dotgit/pampamgoihgcedonnphgehgondkhikel?hl=en">DotGit</a> Chrome extension<strong> </strong>a simple tool that automatically detects exposed .git directories on websites. As soon as I opened the site, the extension popped up within seconds and alerted me that the .git directory was publicly accessible.</p><p>Once I got the alert, I quickly visited the .git/ path directly in the browser, and yes, it was fully exposed. From there, I started downloading the contents of the Git directory.</p><p>Usually, these types of exposures may not lead to anything serious but I always dig deeper. And this time, the .git/config file contained something very sensitive.</p><h3>Inside the .git/config File</h3><p>After downloading the .git folder, I opened the config file and boom, I found a Bitbucket access token and even a link to their private repository.</p><p><strong>Bitbucket</strong> is a platform where developers store and manage their code. It’s like GitHub but with some extra features. Here’s a quick overview:</p><ul><li>Developers use Bitbucket to store source code safely.</li><li>They can make repositories private, so no outsider can see them.</li><li>Teams use Bitbucket to collaborate, review code, and manage software versions.</li><li>Bitbucket also has CI/CD tools to test and deploy code automatically.</li></ul><p>So, having access to their Bitbucket token basically means I could download their entire private source code without needing any login credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9pTgfxQf94eEUSu0lm6PDA.jpeg" /><figcaption>Config File Leaking BitBucket X-Token-Auth</figcaption></figure><h3>Downloading the Private Repo</h3><p>As a responsible pentester, I wanted to see how deep the issue could go. So I used the token to clone their private repository directly to my local machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l_FNu-d2jo5RlaMYjHsw4A.jpeg" /><figcaption>Cloning Private Repo</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vRlBTz_rwh_jWPuskRRuuA.jpeg" /><figcaption>Target Application Source Code</figcaption></figure><p>Once the source code was on my system, I searched for secrets like passwords, tokens, and keys using regex patterns (regular expressions). It’s a method to quickly find words like “password=”, “key=”, or anything that looks like a secret.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a_pVldni5l1gXJdNXnIEXA.jpeg" /><figcaption>Searching For Sensitive Info</figcaption></figure><p>Here’s what I found:</p><ul><li>Multiple secret keys, including AWS S3 keys</li><li>7 different database credentials</li><li>And many more</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QWqJ93NXszJu6O7dof8X8w.jpeg" /><figcaption>Sensitive Info Including DB Creds</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PPt_IZTWbQjxuNIVu748ug.jpeg" /><figcaption>Secret Keys, AWS Creds</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkE_kaJCjUrh4QciIos9oQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*9GmF-hi6t8pR0piOqqz4ew.jpeg" /><figcaption>Database Creds</figcaption></figure><p>This means if someone was malicious, they could connect to these databases, steal the data, or even delete it.</p><h3>Steps:</h3><ol><li>Detected<strong> </strong><strong>.git </strong>directory using the <a href="https://chromewebstore.google.com/detail/dotgit/pampamgoihgcedonnphgehgondkhikel?hl=en">DotGit</a> Chrome extension, it popped up as soon as I opened the site.</li><li>Accessed and downloaded files from <a href="https://target-website.com/.git/">https://target-website.com/.git/.</a></li><li>Opened<strong> </strong><strong>.git/config </strong>file, found Bitbucket private repo URL and auth<strong> </strong>token (X-token).</li><li>Cloned the private repo using the token, full source code downloaded to my system.</li><li>Searched for secrets (passwords, API keys, DB creds) using regex — found AWS keys, 7 DB credentials, and more.</li></ol><h3>Final Advice to Pentesters and Developers</h3><p>From my experience, here are a few lessons:</p><ol><li>Always check for the .git directory during pentesting.<br> If it exists, explore the .git/config file first. It might contain sensitive info like remote repository links or tokens.</li><li>Developers must never push secret tokens, credentials, or private keys to version control.<br> If it happens, revoke the token immediately and rotate all secrets.</li><li><strong>Secure your repos!</strong> Make sure .git folders are not accessible from the browser. Use server rules (like .htaccess or Nginx configs) to block access.</li></ol><h3>Conclusion</h3><p>This case shows how a simple misconfiguration <em>leaking the </em><em>.git directory</em> can lead to a full source code leak, exposed secrets, and critical security risks. As ethical hackers, we must stay curious, careful, and responsible. And as developers, always treat your code and secrets like gold protect them!</p><p>Thanks for reading.</p><p>Follow me for more real-world pentest stories and write-ups.</p><p><a href="https://www.linkedin.com/in/shehzadali1337/"><strong>TheRoyHunter313</strong></a><strong><br></strong><a href="https://x.com/TheRoyHunter313">X</a> <br><a href="https://www.linkedin.com/in/shehzadali1337/">LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f24ed5bd665" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How We Hacked a Crypto Website Through Business Logic Bugs]]></title>
            <link>https://hunter313.medium.com/how-we-hacked-a-crypto-website-through-business-logic-bugs-1064c64640f0?source=rss-ece8c5c2e858------2</link>
            <guid isPermaLink="false">https://medium.com/p/1064c64640f0</guid>
            <dc:creator><![CDATA[Shehzad Ali]]></dc:creator>
            <pubDate>Fri, 11 Apr 2025 18:41:17 GMT</pubDate>
            <atom:updated>2025-04-11T18:41:17.436Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey everyone!</p><p>I hope you’re all doing great! I am Shehzad aka <a href="https://www.linkedin.com/in/shehzadali1337/"><strong><em>TheRoyHunter313</em></strong></a></p><p>In this article, I’m going to share an interesting real-world hacking story where we discovered multiple business logic vulnerabilities in a crypto-related web application. These bugs were serious and could be used to bypass payments, take over accounts, and other misconfigurations.</p><h3>Bugs We Found:</h3><ul><li>OTP Bypassed via Response Manipulation</li><li>OTP Leaked in the Response (Email Verification Bypassed)</li><li>Host Header Injection → Account Takeover</li><li>Payment Bypass</li><li>JWT Misconfiguration → Account Takeover</li><li>CSRF Misconfiguration</li><li>Race Condition</li><li>Internal APIs Leaked</li><li>No Rate Limiting on Login → Brute Force → ATO</li></ul><h3>Story About Us</h3><p><a href="https://www.linkedin.com/in/shehzadali1337/">Me</a> and my friend <a href="https://www.linkedin.com/in/mujtabasec/"><strong>Mujtaba</strong></a><strong> </strong>(we are young cybersecurity enthusiasts and penetration testers) were spending the weekend chilling and talking about trading. We were looking for some good courses to learn crypto trading, blockchain, and the stock market. While searching, we found a website offering paid trading courses and crypto signals.</p><p>The platform was fully paid, and we could only register a new account. That’s when I told my friend, “Why not test the app while we register?” Hacker mindset never sleeps! So, we opened <strong>Burp Suite</strong> and started the registration process to explore the application.</p><h3>About the App Environment</h3><p>As many developers know, apps often run in different environments like:</p><ul><li>Production</li><li>Development</li><li>Staging / Testing</li><li>Beta</li><li>Hybrid</li></ul><p>The target web application was using a <strong>Hybrid Environment</strong>, which mixes live features and test features together. This is risky if not properly secured, and in our case, this setup led to many vulnerabilities being exposed to normal users like us.</p><h3>About the Target Application</h3><p>Our target web application allowed anyone to <strong>register a free account</strong>. After registration, you were automatically redirected to the payment page. The fee was <strong>$10 per month</strong>, and only after paying, users could access the dashboard to start the courses.</p><p>Since we’re hackers, our first goal was to test if we could <strong>bypass the payment system</strong>.</p><p>Although the payment was managed by <strong>Stripe (third-party)</strong>, we didn’t spend much time on bypassing the Stripe API itself. Instead, we focused on testing the <strong>client-side and application logic</strong>, starting from the registration endpoint.</p><h3>1. OTP Leaked in the Response (Email Verification Bypassed)</h3><p>While testing the registration process, we noticed that the server was leaking the <strong>OTP </strong>in the response body. This means when someone registers, their OTP could be seen in the network tab or intercepted via Burp Suite.</p><p>Unfortunately, this issue was only present on the registration endpoint, not on the login. I also tried injecting some JSON parameters like:</p><pre>&quot;role&quot;: &quot;admin&quot;<br>&quot;role&quot;: &quot;staff&quot;<br>&quot;role&quot;: 1<br>&quot;role&quot;: 0</pre><p>But those didn’t work for privilege escalation.</p><p>Although the app in the registration check for the email which is verified or not. If verified then we can’t register as present in the other applications. But the request body was in the json and we used a registered email with a space at the end and at the start. So we can successfully registered the email which was used before with space, like following:</p><pre>Registered Email: &quot;abc@mail.com&quot;<br><br>Again registered: &quot; abc@mail.com&quot;</pre><p>If victim has email: victim@mail.com, the attacker could chain the leaked OTP bug to register victim email as “ victim@mail.com” and verify as the app is leaking the OTP in the response.</p><h4>Impact</h4><p>An attacker can use this vulnerability to bypass the email verification, can use victim email and verify without notifying victims.</p><h3>1.2 OTP Bypassed via Response Manipulation</h3><p>Normally, when we registering a new account, the app sends an OTP to our email for verification. But I thought what if I just close the request after submitting the registration info, before entering the OTP?</p><p>So I tried it. I filled in the details, hit submit, and when the app asked for the OTP, I stopped the request. This way, the email got registered in the system but stayed unverified.</p><p>Later, I tried to log in with that unverified email. After entering the password, the app again asked for the OTP but now on the login screen, as it was not verified during the registering process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dL4vic-3HJ9f7YJiKzg6Gw.png" /><figcaption>OTP on Login panel</figcaption></figure><p>I noticed that the response had a parameter like this:</p><pre>&quot;emailVerified&quot;: false</pre><p>That caught my attention. I quickly used Burp Suite’s <strong>Match &amp; Replace</strong> feature and changed &quot;emailVerified&quot;: false to &quot;emailVerified&quot;: true. But that alone didn’t work.</p><p>The app showed this response when entered invalid OTP:</p><pre>{<br>   &quot;message&quot;: &quot;Invalid OTP&quot;,<br>   &quot;success&quot;: false<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aodJLlaw9rH5f-XDT2FupQ.png" /><figcaption>Invalid OTP Response</figcaption></figure><p>So, I changed the full response to:</p><pre><br>   &quot;message&quot;: &quot;Valid OTP&quot;,<br>   &quot;success&quot;: true,<br><br><br>   &quot;emailVerified&quot;: true<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3vvGNki5B2cGdTmsirW7Dg.png" /><figcaption>Changed Invalid OTP response to Valid</figcaption></figure><p>And boom! I successfully bypassed the OTP check and logged in without ever verifying the email.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3gTwCLiV8raWtsNTHameAg.png" /></figure><p><strong>Impact:</strong> OTP verification was bypassed, allowing login without verifying the email.</p><h3>2. Bypassing Payment</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h2cVjnJxVLx714Qg4YYVvA.png" /><figcaption>Only Accessible to Paid Users</figcaption></figure><p>Logout and then started analyzing the login process. That’s where we found a parameter in the response body that caught our attention:</p><pre>&quot;isSubscribed&quot;: false</pre><p>This parameter was controlling whether the user had paid or not. In Burp Suite, we <strong>intercepted the login request and response</strong>, and manually changed isSubscribed: false to isSubscribed: true.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NUgPjfnJT-SIBTD9tb7zkA.png" /><figcaption>“isSubscribed”:true</figcaption></figure><p>After forwarding the response, we were surprised to see that we could access the <strong>/dashboard</strong> — without paying anything!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gcuHpcb6_j4WTzpvynXxEw.png" /><figcaption>Accessed Paid Feature</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EFsPGQ4ibFnKYJuKBpKSYQ.png" /></figure><p>This meant that the front-end was trusting the isSubscribed parameter from the client-side and allowing us to skip payment. We got full access to the courses, private chats, and all premium content for free.</p><p>However, once we logged out and logged back in, our account went back to normal (non-subscribed), and we were redirected again to the payment page. This showed that <strong>only the client-side was checking</strong> the subscription status, which we had modified.</p><p>For permanent to be paid user, we used Match &amp; Replace feature of BurpSuite as below: with this method we have maintain our paid subscription on the app.</p><p>Note: We also test to pass the isSubscribed:true parameter while registering but this parameter was checking after login not signup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YmSvgDLGfCww3k9ug8Cybw.jpeg" /><figcaption>Match &amp; Replace rules</figcaption></figure><h4>Impact:</h4><p>Any user could become a paid member without actually paying the fee. This leads to revenue loss and unauthorized access to premium features.</p><h3>3. Host Header Injection → Account Takeover</h3><p>One of the most dangerous bugs we found was in the forgot password functionality. When users entered their email to reset their password, the application would send a reset link to their email.</p><p>I decided to test <strong>Host Header Injection</strong> on the /forgot-password endpoint. I added the following headers:</p><pre>X-Forwarded: https://burp-collab.com<br>X-Forwarded-For: https://burp-collab.com<br>X-Forwarded-By: https://burp-collab.com<br>X-Host: https://burp-collab.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VTNrmjJSzDISfiNkWX5HtA.png" /><figcaption>X-Forwarded Header Injection</figcaption></figure><p>And boom! it worked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mf2yFmHLsjaWbtiGMWBH_g.png" /><figcaption>Host Injected to the Reset Link</figcaption></figure><p>The reset link sent to the victim’s email now included my attacker-controlled domain in the link. That means, if the user clicks the reset link, the JWT token (used for password reset) is sent to my server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J_hYvRfaBSI7kGqcdUdGrA.png" /><figcaption>Reset Token Hijacked</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*11JopAY4C59CwUXKMeKfHw.png" /><figcaption>ATO</figcaption></figure><p>This was a One-Click Account Takeover.</p><p>Unfortunately, for this attack to work, the user had to click the link. I tried to take over some admin accounts like admin@target.com and info@target.com, but no one clicked the link during the test period (7–12 days).</p><h4>Impact:</h4><p>If a victim clicks the reset link, an attacker can steal their token and fully take over the account.</p><h3>4. JWT Misconfiguration → 0-Click ATO Attempt</h3><p>While testing the password reset flow, I noticed that the reset link included a JWT token, like this:</p><pre>https://target/reset-password/&lt;jwt-token&gt;</pre><p>I copied the token and analyzed it on <a href="https://jwt.io/">jwt.io</a>. Surprisingly, the token was not signed with a secret key!</p><p>This means I could modify the token freely and the server would still accept it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rHEjeXBk1w-yILp91y6odw.png" /><figcaption>JWT No secret</figcaption></figure><p>Inside the token, there was a field like this:</p><pre>{<br>  &quot;key&quot;: {<br>    &quot;key&quot;: &quot;67cf31f4384yjdsidsd32---my@gmail.com&quot;<br>  },<br>  &quot;iat&quot;: 1742656180,<br>  &quot;exp&quot;: 1742656780<br>}</pre><p>The key was a unique user ID combined with the email.</p><p>I changed the token payload to use another email that I owned (victim account) and generated a new token. Then I sent a POST request to /user/reset-password with the modified token and it worked! I could reset the password of another account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7j55B7eECRPVKOqCoKSQwg.png" /><figcaption>ATO via JWT Misconfiguration</figcaption></figure><h4>What stopped me from achieving full 0-click Account Takeover?</h4><p>The only thing was the <strong>user ID</strong>. I didn’t know the admin’s full unique ID, which was required to generate a valid token. Emails were guessable like admin@target.com, but without the ID, the token wouldn’t work.</p><p>I searched the app deeply, trying to find where user IDs might be leaked in the source code, in API responses, or in Burp history, but no luck.</p><p>I even used Burp’s Sequencer tool to analyze IDs and patterns but couldn’t guess or find the right one.</p><p><strong>Note:</strong> I am still looking into this bug, once we guessed ID, 0-Click ATO is in our hand.</p><h3>5. Internal API Leaks &amp; Other Bugs</h3><p>While exploring the frontend (React-based), I found that some internal API endpoints were exposed. Some of them could be accessed without authentication and gave access to some parts of the application. But it was limited, not critical endpoints were vulnerable.</p><p>Some other bugs we found:</p><p><strong>6. CSRF Misconfiguration</strong>: While commenting on other posts, no CSRF token was used. We exploited this misconfiguration to post comments on behalf of other users.</p><p><strong>7. Race Condition</strong>: We exploited a race condition bug to increase likes on posts made by users.</p><p><strong>8. No Rate Limiting on Login</strong>: There was no rate limit on the login panel, which allowed Account Takeover (ATO) using a known email and a list of passwords. Also some rate limit’s headers were used which i bypassed via response manipulation.</p><h4>Final Thoughts</h4><p>Overall, the application had serious business logic bugs. The developers were pushing changes directly from development to production without proper testing. This kind of environment (hybrid) made it easier for us to discover such critical bugs.<br>I had a great time working on this with my teammate <a href="https://www.linkedin.com/in/mujtabasec/">Mujtaba</a>. It was not just fun but also a great learning experience.</p><h3><strong>Remediation for Developers</strong></h3><p>To fix issues related to response manipulation and business logic, developers should always make sure that important decisions like OTP verification, login status, payment confirmation, or account access are checked on the server side only. Never trust anything coming from the client-side, because it can be easily changed using tools like Burp Suite.</p><p>All user progress or state (like paid or verified) should be handled through secure sessions or tokens stored in the backend. Also, if any data needs to be sent back to the server from the client, it should be properly signed and verified to avoid tampering. Always treat client data as untrusted even if it’s coming from your own frontend.</p><p>Lastly, add proper logs and monitoring so you can catch unusual behavior like skipping steps or accessing paid features without payment.</p><h4>Closing Words</h4><p>That’s all for now! If you’ve read this far, thank you 🙌<br> If you have any tips on guessing user IDs or escalating ATO to 0-click which we discussed in the JWT Misconfiguration section, we’d love to hear from you.</p><p>Your suggestions are always appreciated!</p><p>Stay safe and keep hunting! <br>T<a href="https://x.com/TheRoyHunter313"><strong>heRoyHunter313</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1064c64640f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>