<?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 Reshop Das on Medium]]></title>
        <description><![CDATA[Stories by Reshop Das on Medium]]></description>
        <link>https://medium.com/@reshopdas99?source=rss-ad0a7e4420bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*w1QAd6Cr-RWQD9Zj</url>
            <title>Stories by Reshop Das on Medium</title>
            <link>https://medium.com/@reshopdas99?source=rss-ad0a7e4420bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 12:37:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@reshopdas99/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[Stop the Bleed: Misconfigured HTTP Headers That Expose Your App]]></title>
            <link>https://medium.com/@reshopdas99/stop-the-bleed-misconfigured-http-headers-that-expose-your-app-65c0a879cff7?source=rss-ad0a7e4420bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/65c0a879cff7</guid>
            <dc:creator><![CDATA[Reshop Das]]></dc:creator>
            <pubDate>Sun, 15 Jun 2025 13:47:18 GMT</pubDate>
            <atom:updated>2025-06-15T13:47:18.106Z</atom:updated>
            <content:encoded><![CDATA[<p>Your app might be leaking more than you think and no, I’m not talking about zero-days or flashy exploits. I’m talking about basic, often overlooked, HTTP response headers that serve as your app’s first line of defense. When these headers are missing or misconfigured, attackers don’t need to break in you’ve already left the door wide open.</p><p>As a pentester, I’ve seen this countless times: production apps exposing themselves to clickjacking, XSS, token theft, or MITM attacks simply because a few lines of config were forgotten. So let’s walk through the most important HTTP security headers, what they protect against, how they’re commonly misused and how to fix them.</p><h4>🔍What Are HTTP Response Headers?</h4><p>HTTP response headers are like behind-the-scenes instructions your web server sends to a browser. They don’t affect what users see on the page, but they play a big role in how the browser handles your site’s content. When set up properly, these headers can protect your site from a range of client-side attacks and the best part is, you don’t need to change any of your application’s code.</p><p>Think of them as guardrails that tell the browser things like: “Only load scripts from trusted sources,” “Don’t let this page be displayed in a frame,” or “Always use HTTPS when talking to this site.”</p><h4>💀 The Usual Suspects: Headers Commonly Misconfigured or Missing</h4><h4>1. Content-Security-Policy (CSP)</h4><p><strong>What it protects against:</strong> Cross-Site Scripting (XSS), data injection, malicious third-party scripts.</p><p><strong>What goes wrong:</strong><br>Many apps include CSP but leave it wide open. I’ve seen policies like this far too often:</p><pre>Content-Security-Policy: script-src &#39;self&#39; &#39;unsafe-inline&#39; https://*;</pre><p>This basically defeats the purpose of CSP. Allowing &#39;unsafe-inline&#39; or wildcards like https://* lets malicious scripts slip through easily especially in a stored XSS scenario.</p><p><strong>How to fix it:</strong><br>Start strict and tune:</p><pre>Content-Security-Policy: default-src &#39;self&#39;; script-src &#39;self&#39;; style-src &#39;self&#39;;</pre><p>Then gradually allow only what’s necessary. Use browser CSP reports to iterate safely.</p><h4>2. X-Frame-Options / frame-ancestors</h4><p><strong>What it protects against:</strong> Clickjacking attacks.</p><p><strong>What goes wrong:</strong><br>Apps that allow themselves to be embedded in iframes without restriction are vulnerable to UI redress attacks. An attacker can frame your site and trick users into interacting with it unknowingly.</p><p><strong>How to fix it:</strong><br>Use one of the following headers:</p><pre>X-Frame-Options: DENY</pre><p>Or, if embedding within your own domain is necessary:</p><pre>X-Frame-Options: SAMEORIGIN</pre><p>For more control, use this CSP directive:</p><pre>Content-Security-Policy: frame-ancestors &#39;self&#39;;</pre><h4>3. Strict-Transport-Security (HSTS)</h4><p><strong>What it protects against:</strong> Protocol downgrade and SSL stripping attacks.</p><p><strong>What goes wrong:</strong><br>Without HSTS, even apps running on HTTPS can be downgraded to HTTP via a man-in-the-middle attack especially on first load.</p><p><strong>How to fix it:</strong><br>Tell the browser to always use HTTPS for future requests:</p><pre>Strict-Transport-Security: max-age=31536000; includeSubDomains; preload</pre><h4>4. X-Content-Type-Options</h4><p><strong>What it protects against:</strong> MIME-type confusion, which can be exploited in some injection scenarios.</p><p><strong>What goes wrong:</strong><br>If this header is missing, browsers may try to “guess” the file type, opening up attacks if your site serves user-uploaded content.</p><p><strong>How to fix it:</strong></p><pre>X-Content-Type-Options: nosniff</pre><p>This tells browsers to obey the declared content type.</p><h4>5. Referrer-Policy</h4><p><strong>What it protects against:</strong> Leakage of sensitive URL data across origins.</p><p><strong>What goes wrong:</strong><br>Without this header, full URLs (including paths and query strings) may be shared as referrers when users click external links potentially exposing tokens or user info.</p><p><strong>How to fix it:</strong></p><pre>Referrer-Policy: strict-origin-when-cross-origin</pre><p>Or for maximum privacy:</p><pre>Referrer-Policy: no-referrer</pre><h4>6. Permissions-Policy</h4><p><strong>What it protects against:</strong> Unauthorized access to browser features like camera, microphone, geolocation, etc.</p><p><strong>What goes wrong:</strong><br>If this header isn’t set, all browser features are potentially accessible to scripts on the page even if your app doesn’t use them.</p><p><strong>How to fix it:</strong></p><pre>Permissions-Policy: camera=(), microphone=(), geolocation=()</pre><p>This disables access unless explicitly required.</p><h4>🧪 How I Test for Headers During a Pentest</h4><p>One of the first things I check during a web application assessment is the response headers. You don’t need fancy tools a simple curl command does the trick:</p><pre>curl -I https://example.com</pre><p>Or use tools like:</p><ul><li><strong>Burp Suite</strong> (Proxy → HTTP history)</li><li><strong>securityheaders.com</strong> for a quick overview</li><li><strong>ZAP</strong> or <strong>Nikto </strong>or <strong>Nuclei </strong>for header scanning</li></ul><p>I’ve often seen apps missing all six headers. Sometimes they’re partially configured, like having CSP with &#39;unsafe-inline&#39;, or HSTS without includeSubDomains. These half-measures can be worse than nothing they give a false sense of security.</p><h4>✅ Conclusion</h4><p><strong>Misconfigured HTTP response headers are silent vulnerabilities in your application’s security.</strong><br>They might appear minor, but collectively, they can open the door to serious threats because attackers always target the easiest entry points.</p><p><strong>The good news? These issues are simple to resolve.</strong><br>No need for code rewrites or major refactoring. Just a few configuration changes in your web server or middleware can significantly strengthen your security defenses.</p><p><strong>Don’t leave the door cracked open.</strong><br>Harden your headers. Close the gaps before someone else finds them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65c0a879cff7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bypassing 2FA in a Banking App — A Real-World Example]]></title>
            <link>https://medium.com/@reshopdas99/bypassing-2fa-in-a-banking-app-a-real-world-example-7a3a47653e78?source=rss-ad0a7e4420bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a3a47653e78</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacker]]></category>
            <category><![CDATA[web-application-security]]></category>
            <category><![CDATA[hacking-training]]></category>
            <category><![CDATA[2fa-bypass]]></category>
            <dc:creator><![CDATA[Reshop Das]]></dc:creator>
            <pubDate>Mon, 12 May 2025 12:13:39 GMT</pubDate>
            <atom:updated>2025-05-12T12:18:26.166Z</atom:updated>
            <content:encoded><![CDATA[<p>Two-factor authentication (2FA) is widely considered a critical layer of defense in modern applications, especially in banking platforms. But what if that layer is poorly implemented? In this post, I’ll walk you through a real-world scenario where I was able to bypass 2FA entirely — just by manipulating a single parameter in the login response. This vulnerability allowed full access to user accounts without ever needing to enter the OTP. Let’s dive into how it happened and what made it possible.</p><h4>What is 2FA and Why Do We Need It?</h4><p>Two-Factor Authentication (2FA) is a security mechanism that adds an extra layer of protection to the login process. Instead of relying solely on a password (something you know), 2FA requires a second factor usually something you have, like a mobile device, or something you are, like a fingerprint.</p><p>For example, after entering your password, a website may send you a one time password (OTP) to your phone. You need to enter this OTP to complete the login. Even if someone steals your password, they still can’t log in without the second factor.</p><p>In high-risk applications like online banking, 2FA is essential. It significantly reduces the chances of unauthorized access, account takeovers, and financial fraud — even if the user’s primary credentials are compromised.</p><h4>🐞Vulnerability Description</h4><p>In this banking application, the login process involved two steps:</p><ol><li><strong>Credential Verification:</strong> The user enters their username and password.</li><li><strong>OTP Verification:</strong> If the credentials are correct, the server sends a 6-digit OTP to the user’s registered mobile number or email. This OTP must be entered to complete the login.</li></ol><p>While analyzing the OTP verification process, I observed that the application’s response to the OTP submission was controlled by a simple status flag:</p><p>status: 1 → Incorrect OTP</p><p>status: 0 → Correct OTP</p><p>This flag was returned in the server’s response after the OTP was submitted.</p><p>During testing, I noticed that this status could be manipulated on the client side. By intercepting the response and modifying the status value from 1 to 0, the application treated the OTP as valid—even if it was incorrect.</p><p>This bypass allowed me to complete the login process without ever entering the actual OTP, effectively defeating the 2FA mechanism.</p><h4>💡Visualizing the Exploit</h4><p>To better illustrate the vulnerability, here are the key steps I took during the testing process. These screenshots demonstrate how the response to the OTP verification can be manipulated to bypass the 2FA step entirely:</p><p><strong>Step 1: </strong>I logged into the application using my credentials and sent a request to receive the OTP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I3xWgbNffpPX2wSWOO-3WQ.png" /><figcaption>Exhibit 1</figcaption></figure><p><strong>Step 2:</strong> Submit the OTP verification request with an incorrect OTP and capture the response using Burp Suite. As shown in Exhibit 2, the status is set to “1”, indicating that the OTP is incorrect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aizqn3RT37HrSER6y_h66Q.png" /><figcaption>Exhibit 2</figcaption></figure><p><strong>Step 3: </strong>Modify the status from “1” to “0”. A status of “0” indicates that the OTP is correct. As shown in the exhibit 3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SXT5W4GEg1Jjysg3vdpf0Q.png" /><figcaption>Exhibit 3</figcaption></figure><p><strong>Boom!</strong> I was able to log into the application normally and access all modules and functions as usual, as shown in Exhibit 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Llao_xck7MLh45mYGpLwZw.png" /><figcaption>Exhibit 4</figcaption></figure><h4>💥 Impact</h4><p>By bypassing the OTP verification process, I was able to access the application without providing the correct second factor. This vulnerability renders the two-factor authentication mechanism useless and exposes user accounts to the following risks:</p><ul><li><strong>Unauthorized access</strong> to sensitive user data and banking information.</li><li><strong>Account takeover</strong> possibilities, where attackers can make fraudulent transactions or change account settings.</li><li><strong>Financial fraud</strong>, as attackers could initiate unauthorized fund transfers.</li><li>Complete <strong>compromise</strong> of the application’s 2FA security, making it ineffective against even basic attacks.</li></ul><p>This vulnerability significantly weakens the security of a high-risk application like online banking, potentially leading to severe financial losses.</p><h4>☭ Recommendations</h4><p>To resolve this issue and strengthen 2FA security:</p><ol><li><strong>Issue a fresh session token after OTP verification:</strong> The application server should generate and send a new session cookie or token only after successful OTP validation. This token should then be used to maintain the user session. This ensures that only fully authenticated users are granted access and prevents session fixation attacks.</li><li><strong>Server-side validation:</strong> Perform all critical authentication validations, such as OTP verification, exclusively on the server side. Do not rely on or allow modification of status flags from the client, as they should not be trusted.</li><li><strong>Use a secure response model:</strong> Avoid exposing easily manipulated values like status: 0 or status: 1 in responses. Use server-driven redirects or opaque response structures.</li><li><strong>Implement rate-limiting:</strong> Apply rate limits and account lockouts on OTP submission endpoints to prevent brute-force or automated attacks.</li></ol><h4>💭 Conclusion</h4><p>In this real-world example, a simple vulnerability in the OTP verification process allowed me to bypass the two-factor authentication entirely, highlighting the importance of proper server-side validation. When implementing 2FA, it’s crucial to ensure that no sensitive authentication logic is exposed to client-side manipulation. By addressing these security gaps, we can ensure that 2FA remains a strong defense against unauthorized access and potential financial fraud.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a3a47653e78" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>