<?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 0xKillua on Medium]]></title>
        <description><![CDATA[Stories by 0xKillua on Medium]]></description>
        <link>https://medium.com/@K1lluax?source=rss-5038fafe3831------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Jz6YvFsWP339JK5TTDMJTA.jpeg</url>
            <title>Stories by 0xKillua on Medium</title>
            <link>https://medium.com/@K1lluax?source=rss-5038fafe3831------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:12:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@K1lluax/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[Critical Vulnerability in Password Reset Function: Bypassing Token Validation for Account Takeover]]></title>
            <link>https://medium.com/@K1lluax/critical-vulnerability-in-password-reset-function-bypassing-token-validation-for-account-takeover-15cd4d39f52d?source=rss-5038fafe3831------2</link>
            <guid isPermaLink="false">https://medium.com/p/15cd4d39f52d</guid>
            <category><![CDATA[web-app-pentesting]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[web-app-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-app-vulnerabilities]]></category>
            <dc:creator><![CDATA[0xKillua]]></dc:creator>
            <pubDate>Fri, 20 Sep 2024 01:47:29 GMT</pubDate>
            <atom:updated>2024-09-20T01:47:29.883Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In this post, I will share a critical security vulnerability I discovered during a web application penetration test, affecting the password reset function. The issue allowed full account takeover by exploiting the token validation mechanism in the reset password URL. This is a textbook example of improper token validation that can lead to severe security breaches.</p><h3>Overview of the Vulnerability</h3><p>While conducting a security assessment on a web application, I encountered a flaw in the password reset functionality. This function is responsible for sending a password reset link to users’ emails, containing two critical parameters in the URL:</p><ul><li>emailToken: Expected to be a JWT token for authentication and validation.</li><li>UserID: Contains the unique identifier of the user in the database.</li></ul><p>Normally, these tokens are meant to ensure that only the rightful account owner can reset the password. However, by manipulating the emailToken, I was able to bypass the validation and take over the account.</p><h3>Vulnerability Exploitation</h3><p>The steps involved in exploiting this vulnerability are as follows:</p><ol><li>The user requests a password reset link.</li><li>The system sends a URL to the user’s email with the following parameters:</li></ol><pre>https://target.com/auth/reset_password?emailtoken=&lt;JWT_TOKEN&gt;&amp;userId=&lt;UserID&gt;</pre><p>3. The emailToken is supposed to be a valid JSON Web Token (JWT) to verify the request&#39;s authenticity.</p><ol><li><strong>The Issue</strong>: When I modified the emailToken parameter to an invalid or arbitrary string (e.g., HelloBastards), the system still allowed the password reset functionality to proceed.</li><li>The system only checked the presence of the parameters in the URL, without verifying the actual validity of the emailToken.</li><li>This allowed me to reset the password of the associated user account by sending a POST request with the new password, leading to a complete account takeover.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*iMs5cLK0Ef_qB-xSeOcjrg.png" /></figure><h3>Impact</h3><ul><li><strong>Severity</strong>: Critical</li><li><strong>Affected Functionality</strong>: Password Reset</li><li><strong>Risk</strong>: This vulnerability allows an attacker to reset the password of any user in the application, effectively gaining full access to their account. In a worst-case scenario, this could lead to widespread user data theft, service disruption, or system compromise.</li></ul><h3>How to Fix</h3><p>To resolve this vulnerability, the following steps should be implemented:</p><ol><li><strong>Implement Proper Token Validation</strong>: Ensure that the emailToken is correctly validated as a signed JWT. This means checking its signature, expiry, and the claims inside the token.</li><li><strong>Rate Limiting and Brute-Force Protection</strong>: Implement rate-limiting mechanisms to prevent automated attacks or brute-force attempts against the password reset functionality.</li><li><strong>Additional Security Controls</strong>: Consider adding multi-factor authentication (MFA) for the password reset process as an extra precaution.</li><li><strong>Check for Tampering</strong>: Any manipulation of the token should immediately result in an error. Implement integrity checks to detect changes in the emailToken.</li><li><strong>Use Stronger Tokens</strong>: The token should be signed using a secure algorithm, such as HMAC or RSA, depending on the system’s architecture.</li><li><strong>OTP (One-Time Password) Mechanism</strong>: Instead of relying solely on a token in the URL, a more secure approach is to use a time-based One-Time Password (OTP) sent to the user’s email or phone number. Here’s why OTP is preferred:</li></ol><ul><li><strong>Temporary and Time-Limited</strong>: OTPs are valid for a short duration (e.g., 5–10 minutes), reducing the attack window.</li><li><strong>Unique per Request</strong>: Every password reset attempt generates a new OTP, making it difficult to reuse any prior OTP.</li><li><strong>Multi-Factor Verification</strong>: Combining OTP with a second factor (such as email or SMS verification) adds another layer of security.</li></ul><h3>Conclusion</h3><p>This vulnerability highlights the dangers of weak token validation mechanisms in password reset functionalities. A robust solution involves implementing proper token validation, combined with OTP-based authentication for resetting passwords, as well as other layers of security such as rate-limiting and MFA. By taking these measures, web applications can significantly reduce the risk of account takeovers and protect their users’ data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15cd4d39f52d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Recon to Root: Exploiting MongoDB to Hijack Django Admin Privileges]]></title>
            <link>https://medium.com/@K1lluax/how-we-took-over-a-database-admin-account-a-red-team-assessment-case-study-23f6a4bfc7ac?source=rss-5038fafe3831------2</link>
            <guid isPermaLink="false">https://medium.com/p/23f6a4bfc7ac</guid>
            <category><![CDATA[cyberattack]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cybersecurity-assessments]]></category>
            <category><![CDATA[red-team-methodology]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[0xKillua]]></dc:creator>
            <pubDate>Sun, 28 Jul 2024 16:02:06 GMT</pubDate>
            <atom:updated>2024-08-17T09:28:29.373Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In the world of cybersecurity, red team assessments are critical for identifying vulnerabilities and strengthening defenses. In one of our recent assessments, we managed to take over a database admin account, providing invaluable insights into potential risks and areas for improvement. This article will walk you through our approach, the techniques we used, and the lessons learned from this successful compromise.</p><h3>The Objective: Database Admin Account Takeover</h3><p>Our primary objective in this assessment was to gain access to critical systems by compromising a high-value target: the database admin account. This account typically holds significant privileges and access to sensitive data, making it a prime target for attackers.</p><h3>Execution: The Takeover Process</h3><h3>Reconnaissance</h3><p>Our first step was to gather as much information as possible about the target environment. We used both passive and active reconnaissance techniques, including:</p><ul><li><strong>Network Scanning</strong>: Identifying live hosts and open ports.</li><li><strong>OSINT (Open Source Intelligence)</strong>: Gathering publicly available information about the organization and its employees.</li></ul><blockquote>we find mongodb ports ON (27017 and 27018)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*-Ve1by21j1_cHB2DX_IGjw.png" /></figure><h3>Enumeration</h3><p>During our reconnaissance, we discovered MongoDB ports open on 27017 and 27018. Using the OSINT framework, we found a subdomain for Django administration.<br>To streamline the enumeration process, we utilized a custom script that automates subdomain discovery, endpoint fuzzing, and more. You can find the script on my GitHub repository <a href="https://github.com/k1lluax/Deep-Recon">here</a>.</p><h3>Fuzzing</h3><p>To discover all endpoints, we used a fuzzing tool:</p><pre>fuff -u admin.domain.com/FUZZ -w /path/to/wordlist</pre><p>We identified three endpoints:</p><ul><li>/admin</li><li>/upload</li><li>/files</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*WvO6ge4paZ631fsfmOXPqw.png" /><figcaption>django administration page</figcaption></figure><h3>Attempted Exploitation</h3><p>We tried to upload a reverse shell but were unsuccessful ☹️.</p><p>However, while interacting with the application, we encountered an error page indicating that the developer had left the debugging mode on.</p><h3>Debug Mode Exploitation</h3><p>With the debugging mode enabled, we could see the backend code and a prototype of the database. This exposure allowed us to find credentials for MongoDB.</p><p>With the debugging mode enabled, we could see the backend code and a prototype of the database.</p><p>This exposure allowed us to find credentials for MongoDB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*v4PAD1670mRslZJ3pc_mAA.png" /><figcaption>error page @ debugging mode ON</figcaption></figure><p>then login by credentials of mongodb</p><pre>mongodb -u username -p password ipadress:port/database_name </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*GHJHHcuuJaU0rFVbG-uVDA.png" /></figure><h3>Exploiting the auth_user Collection in MongoDB to Gain Admin Privileges in Django 😈</h3><h3>Remember i found admin.domain.com</h3><p>this a administration subdomain to manage web application</p><h3>Step-by-Step Process</h3><h4>Discovering the auth_user Collection</h4><p>After obtaining the database password, I found a collection called auth_user.</p><p>This collection contains authenticated users responsible for administering the Django application, managing products, and overseeing the web application.</p><h4>Creating a New User</h4><p>I started by creating a new user in the auth_user collection. Initially, this user was not authenticated. To escalate this user&#39;s privileges, I needed to modify their permissions directly in the database.</p><h4>Updating User Permissions</h4><p>Using the MongoDB shell, I executed the following commands to update the user’s permissions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*tn-IXj1KeTmJDlNModg77A.png" /><figcaption>You know this username 👽</figcaption></figure><p>This command sets the is_staff, is_active, and is_superuser fields to true, effectively making the user a superuser.</p><h4>Logging into Django Administration</h4><p>Once the new user had superuser privileges, I logged into the Django administration page. From there, I deleted all existing authenticated users to ensure exclusive control over the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*c7vCx5_ojYcOK6a85EmUtA.png" /></figure><h4>Creating Backdoors</h4><p>To secure my access further, I created multiple backdoor users in the auth_user collection. These additional users also had superuser privileges, ensuring that even if one account was discovered and removed, I would still have access to the application.Changing the Database Password</p><h4>Changing the Database Password</h4><p>Next, I changed the database password to secure my access further:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*4ni1vtN467PPkfsR36dJ9w.png" /></figure><h3>Conclusion</h3><p>In this red team assessment, we demonstrated how an attacker could exploit misconfigurations and vulnerabilities to gain administrative access to a critical system. By targeting the MongoDB instance and leveraging the exposed debugging mode, we were able to escalate our privileges and take over the Django administration. This allowed us to delete existing users, create backdoors, and change database credentials, securing persistent access.</p><p>This case study highlights the importance of securing database access, disabling debugging modes in production environments, and regularly auditing user permissions. Organizations must implement robust security measures and continuously monitor for potential vulnerabilities to safeguard their systems against such attacks.</p><h3>Summary of Key Lessons Learned:</h3><ol><li><strong>Secure Database Access</strong>: Ensure that database ports are not publicly accessible and use strong, unique credentials.</li><li><strong>Disable Debugging in Production</strong>: Always disable debugging modes in production environments to prevent exposure of sensitive information.</li><li><strong>Regular Audits and Monitoring</strong>: Conduct regular security audits and monitor user permissions to detect and mitigate unauthorized access.</li><li><strong>Implement Network Segmentation</strong>: Limit access to critical systems by segmenting your network and using firewalls to control traffic.</li><li><strong>Red Team Assessments</strong>: Regularly perform red team assessments to identify and address vulnerabilities before attackers can exploit them.</li></ol><p>Happy Hacking 🤑</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23f6a4bfc7ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>