<?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 Ganesh Kalagi on Medium]]></title>
        <description><![CDATA[Stories by Ganesh Kalagi on Medium]]></description>
        <link>https://medium.com/@ganesh.kalagi?source=rss-ba6fa2166836------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*XM8lWFp0pZmky6_7</url>
            <title>Stories by Ganesh Kalagi on Medium</title>
            <link>https://medium.com/@ganesh.kalagi?source=rss-ba6fa2166836------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 20:47:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ganesh.kalagi/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[Directory Listing: A Small Setting with Big Consequences]]></title>
            <link>https://medium.com/@ganesh.kalagi/directory-listing-a-small-setting-with-big-consequences-b9a6d7580ba8?source=rss-ba6fa2166836------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9a6d7580ba8</guid>
            <dc:creator><![CDATA[Ganesh Kalagi]]></dc:creator>
            <pubDate>Thu, 26 Feb 2026 10:42:56 GMT</pubDate>
            <atom:updated>2026-02-26T10:42:56.066Z</atom:updated>
            <content:encoded><![CDATA[<p>When we talk about web security, most people think about SQL Injection, XSS, or authentication bypass. But sometimes, the real danger is something very simple — <strong>Directory Listing</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RBI-afi7gjwBpjbKJPI1rQ.png" /></figure><p>It doesn’t need complex payloads.<br>It doesn’t need advanced tools.<br>Sometimes, you just type a URL… and the server shows you everything.</p><h3>What is Directory Listing?</h3><p>Directory Listing (also called Directory Browsing) happens when a web server allows users to view the contents of a folder on the server.</p><p>Instead of showing a normal webpage, the server displays a list of files and folders inside that directory.</p><p>For example:</p><pre>https://example.com/uploads/</pre><p>Instead of showing an error or redirecting, the page displays:</p><ul><li>backup.zip</li><li>database.sql</li><li>config.php</li><li>images/</li><li>test.html</li></ul><p>Now imagine what an attacker sees</p><p>That’s free information.</p><h3>Why Does This Happen?</h3><p>Directory listing is usually enabled by mistake.</p><p>Web servers like:</p><ul><li>Apache HTTP Server</li><li>Nginx</li><li>Microsoft IIS</li></ul><p>have configuration settings that control whether folder contents can be displayed.</p><p>If:</p><ul><li>There is no index.html or index.php file</li><li>And directory browsing is enabled</li></ul><p>The server automatically shows the file list.</p><p>Simple misconfiguration. Big impact.</p><h3>Why is Directory Listing Dangerous?</h3><p>While it may seem harmless at first, directory listing can lead to serious security risks:</p><ul><li><strong>Sensitive File Exposure:</strong> Backup files (backup.zip), configuration files (config.php, .env), or log files may be accessible.</li><li><strong>Information Disclosure:</strong> Exposed internal structure of your application, revealing naming conventions and paths.</li><li><strong>Reconnaissance Support:</strong> Attackers can find potential entry points or files that can be further exploited.</li><li><strong>Direct Download of Confidential Data:</strong> If a developer accidentally stores credentials or source code in a public folder, it could be freely downloaded.</li></ul><h3>Example of a directory listing attack</h3><p>A user makes a website request to <a href="http://www.vulnweb.com/admin/"><em>www.vulnweb.com/admin/</em>.</a> The response from the server includes the directory content of the directory <em>admin</em>, as seen in the below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*s52CBpBHowXgwTTtwpKzmA.png" /><figcaption>From the above directory listing, you can see that in the <em>admin</em> directory, there is a sub-directory called <em>backup</em>, which might include enough information for an attacker to craft an attack.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*cSEajdesMLz2e3xNjPhA0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tVnydMz7IWzQbdIvU_ho7g.png" /></figure><p>The attacker can display the whole list of files in the <em>backup</em> directory. This directory includes sensitive files such as password files, database files, FTP logs, and PHP scripts. It is obvious that this information was not intended for public viewing.</p><p>A web server misconfiguration has caused a file list disclosure and the data is publicly available. Worse still, files like these, such as FTP logs, might contain other sensitive information, potentially including usernames, IP addresses, or the complete directory structure of the web hosting operating system.</p><h3>How Attackers Find Directory Listing</h3><p>It’s easier than you think.</p><h3>Manual Method</h3><p>Security testers simply try common paths:</p><ul><li>/uploads/</li><li>/backup/</li><li>/admin/</li><li>/images/</li><li>/logs/</li></ul><p>If it opens and shows files → Vulnerable.</p><h3>Automated Tools</h3><p>Tools like:</p><ul><li>Burp Suite</li><li>OWASP ZAP</li><li>Dirb</li></ul><p>can quickly detect exposed directories during VAPT.</p><h3>How to mitigate directory listing vulnerabilities?</h3><p>To disable directory listing and mitigate any vulnerabilities on a specific web server, you need to change the web server configuration. This means you need to have administrator access to that web server.</p><p>In the following blog post, you can find practical tutorials on how to disable directory listing for all popular web servers, including Nginx Apache HTTPD, Tomcat, Microsoft IIS, and more:<a href="https://www.invicti.com/blog/web-security/disable-directory-listing-web-servers/"> How you can disable directory listing on your web server — and why you should</a>.</p><h3>References</h3><ul><li><a href="https://portswigger.net/web-security/information-disclosure/exploiting#directory-listings">Web Security Academy: Information disclosure via directory listings</a></li></ul><h3>Vulnerability classifications</h3><ul><li><a href="https://cwe.mitre.org/data/definitions/538.html">CWE-538: File and Directory Information Exposure</a></li><li><a href="https://cwe.mitre.org/data/definitions/548.html">CWE-548: Information Exposure Through Directory Listing</a></li><li><a href="https://capec.mitre.org/data/definitions/37.html">CAPEC-37: Retrieve Embedded Sensitive Data</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9a6d7580ba8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stored HTML Injection in “First Name” Field]]></title>
            <link>https://medium.com/@ganesh.kalagi/stored-html-injection-in-first-name-field-89f9158eae0f?source=rss-ba6fa2166836------2</link>
            <guid isPermaLink="false">https://medium.com/p/89f9158eae0f</guid>
            <dc:creator><![CDATA[Ganesh Kalagi]]></dc:creator>
            <pubDate>Wed, 25 Feb 2026 10:13:49 GMT</pubDate>
            <atom:updated>2026-02-25T10:13:49.705Z</atom:updated>
            <content:encoded><![CDATA[<p>While testing a web application’s profile update functionality, I came across a classic but still very dangerous issue: <strong>Stored HTML Injection</strong> in the <strong>First Name</strong> field.</p><p>At first glance, it looked like a normal profile page. The user could edit personal details like first name, surname, and email address. Nothing unusual. But when I tested the <strong>First Name</strong> input field with a simple HTML payload, the application behaved unexpectedly.</p><p>Instead of treating my input as plain text, the application rendered it as HTML.</p><p>That’s when I confirmed it — this was a <strong>Stored HTML Injection vulnerability</strong>.</p><h3>What Happened?</h3><p>In the First Name field, I entered a payload like:</p><p>&lt;a style=”position:absolute;margin:50px; background-color: yellow; z-index: 1000;top:50px;padding:100px;font-weight:bold;font-size:45px;color:red;” href=”<a href="https://evil.com/">https://evil.com</a>&quot;&gt;Click here for win 1000$!&lt;a&gt;</p><p>After saving the profile and refreshing the page, the content was rendered as an actual clickable link.</p><p>Even worse:</p><ul><li>The injected content appeared in the profile page.</li><li>It was stored in the database.</li><li>Every time the profile loaded, the HTML was executed in the browser.</li></ul><p>This means the application was <strong>not sanitizing user input before storing it</strong> and was also <strong>not encoding it before rendering</strong>.</p><h3>Why This Is Dangerous</h3><p>Many developers underestimate HTML Injection because it’s “just HTML.” But in real-world scenarios, this can easily escalate.</p><p>Here’s why it matters:</p><h3>1. Persistent (Stored) Impact</h3><p>Unlike reflected injection, this payload:</p><ul><li>Is stored in the backend database</li><li>Executes every time the page loads</li><li>Affects anyone who views the profile (including admins)</li></ul><h3>2. Phishing Within the Application</h3><p>An attacker can inject something like:</p><ul><li>Fake “Click here to win” banners</li><li>Fake password reset links</li><li>Malicious redirection links</li></ul><p>Users will trust it because it appears inside a legitimate website.</p><h3>3. Path to Stored XSS</h3><p>If the application allows more complex HTML (like &lt;script&gt; tags or event handlers), this can turn into <strong>Stored Cross-Site Scripting (XSS)</strong>, which is far more severe.</p><h3>Root Cause</h3><p>The vulnerability exists because:</p><ul><li>The application does not validate input properly.</li><li>It stores raw HTML in the database.</li><li>It renders user input without output encoding.</li></ul><p>This is a failure of <strong>input sanitization and output encoding controls</strong>.</p><h3>Proof of Concept:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Rw6wxKGYXtq51dHQOHIbQ.png" /><figcaption>Figure 1: The application accepts HTML content in the First Name field without validation.</figcaption></figure><p>Impact observed:</p><ul><li>HTML rendered properly.</li><li>Anchor tag clickable.</li><li>Content persisted after logout/login.</li></ul><p>This confirms stored HTML injection.</p><h3>Business Impact</h3><p>If exploited in production:</p><ul><li>Attackers could inject phishing content.</li><li>Admin panels could display malicious links.</li><li>Brand reputation damage is possible.</li><li>It may lead to credential theft.</li><li>Can escalate to full stored XSS depending on filtering.</li></ul><p>In real-world bug bounty programs, this is often categorized under:</p><ul><li>Stored XSS (if script execution possible)</li><li>HTML Injection</li><li>Content Injection</li></ul><p>Severity depends on exploitability.</p><h3>Recommended Fix</h3><p>Developers should implement:</p><h3>1. Output Encoding (Primary Fix)</h3><p>Always encode user-controlled data before rendering in HTML.</p><p>Example:</p><ul><li>&lt; should render as &amp;lt;</li><li>&gt; should render as &amp;gt;</li></ul><h3>2. Input Validation</h3><ul><li>Restrict First Name field to alphabetic characters only.</li><li>Reject HTML tags entirely.</li></ul><h3>3. Content Security Policy (CSP)</h3><p>Implement strict CSP headers to reduce XSS risk.</p><h3>4. Use Secure Framework Defaults</h3><p>Most modern frameworks provide automatic escaping — ensure it is not disabled.</p><h3>Final Thoughts</h3><p>This issue is a reminder that even simple input fields like “First Name” can become attack vectors if not handled securely.</p><p>Stored HTML Injection may look harmless at first, but in the wrong hands, it becomes a powerful social engineering and phishing tool — especially when injected into trusted pages like account dashboards.</p><p>As testers, we must always check:</p><ul><li>Can input accept HTML?</li><li>Is it stored?</li><li>Is it rendered unsafely?</li><li>Can it escalate to script execution?</li></ul><p>Small fields. Big impact.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89f9158eae0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding a Subdomain Takeover via CNAME Misconfiguration]]></title>
            <link>https://medium.com/@ganesh.kalagi/subdomain-takeover-vulnerability-db135d63aef9?source=rss-ba6fa2166836------2</link>
            <guid isPermaLink="false">https://medium.com/p/db135d63aef9</guid>
            <dc:creator><![CDATA[Ganesh Kalagi]]></dc:creator>
            <pubDate>Wed, 25 Feb 2026 06:47:57 GMT</pubDate>
            <atom:updated>2026-03-05T10:15:04.499Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>During reconnaissance, I discovered a <strong>subdomain takeover vulnerability</strong> caused by a misconfigured DNS record pointing to an inactive third-party service. This misconfiguration allowed the possibility for an attacker to claim the resource and host malicious content under the organization’s domain.</p><p>Subdomain takeover vulnerability occurs when a subdomain points to an unclaimed external service. Learn how it works, real examples, detection methods, and prevention techniques.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7nHsGfPrJV9qFljS3ppdXQ.jpeg" /></figure><h3><strong>What is Subdomain Takeover Vulnerability?</strong></h3><p><strong>Subdomain Takeover Vulnerability</strong> is a security misconfiguration where an attacker gains control of an unused or improperly configured subdomain.</p><p>It usually happens when a DNS record points to an expired or deleted third-party service (like cloud hosting), allowing attackers to claim it and host malicious content under the organization’s domain.</p><p><strong>Normal)</strong><br>blog.example.com → CNAME → myblog.github.io → GitHub Pages (Active)<br>User → blog.example.com → Company’s legitimate blog content</p><p><strong>Dangling DNS State)</strong><br>blog.example.com → CNAME → myblog.github.io → X (Deleted)<br>User → blog.example.com → “404 — Not Found” page</p><p><strong>Takeover State)</strong><br>blog.example.com → CNAME → myblog.github.io → Attacker’s GitHub Pages<br>User → blog.example.com → Attacker’s malicious content</p><p>This situation is called “Dangling DNS,” meaning the DNS record exists but points to a non-existent target.</p><h3>Types of Subdomain Takeover</h3><p>Most Subdomain Takeover cases are CNAME-based takeovers. I’ve compiled 167 publicly disclosed Subdomain Takeovers from HackerOne’s Hacktivity. For details, see: <a href="https://github.com/yee-yore/LLM-Context/blob/main/vulnerabilities/subdomain_takeover.json">https://github.com/yee-yore/LLM-Context/blob/main/vulnerabilities/subdomain_takeover.json</a></p><p><strong>CNAME-based Takeover</strong></p><p>The most common type, occurring when a CNAME record points to a non-existent external service. Most STO cases fall into this category.</p><pre>subdomain.example.com. IN CNAME abandoned-app.herokuapp.com.</pre><p>Although Subdomain Takeovers can theoretically occur via different DNS record types (A, NS, MX, SRV), in practice most real-world cases are <strong>CNAME-based</strong>. Other record types are rarely exploitable today and are typically mentioned only for completeness.</p><h3><strong>How Subdomain Takeover Works</strong></h3><p><strong>1. DNS Record Points to an External Service</strong><br> A company connects its subdomain to a third-party service like cloud hosting or a SaaS platform using a CNAME record.</p><p><strong>2. Service Gets Deleted or Expired</strong><br> Later, the external service is removed, but the DNS entry is not updated. The subdomain still points to a resource that no longer exists.</p><p><strong>3. Attacker Claims the Resource</strong><br> An attacker discovers this unused connection, registers the same service on that platform, and takes control of the subdomain to host malicious or misleading content.</p><h3><strong>Real-World Example of Subdomain Takeover</strong></h3><p>While performing security testing, I discovered a subdomain that appeared to be inactive but was still configured in the DNS records.</p><p><strong>Step 1: Finding the Subdomain</strong><br> During subdomain enumeration, I accessed the subdomain in a browser and noticed an error message: <strong>“The requested URL was not found on this server.”</strong> This suggested that the service behind the subdomain might have been removed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WOFYZknTCfyh1H7D_9gYog.png" /><figcaption>Figure 1: The subdomain returns an error message indicating that the requested URL is not available on the server.</figcaption></figure><p><strong>Step 2: Verifying DNS Records</strong><br> To investigate further, I used the dig command to check the DNS configuration. The result showed that the subdomain was still pointing to an external service through a <strong>CNAME record</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*536Tc9Tk4SOStQX1Q0tX0Q.png" /><figcaption>Figure 2: DNS lookup using the dig command showing that the subdomain still points to an external service via a CNAME record.</figcaption></figure><p><strong>Step 3: Identifying the Misconfiguration</strong><br> Although the DNS entry was active, the actual service connected to it was no longer available. This type of leftover configuration is commonly known as a <strong>dangling DNS record</strong>.</p><p><strong>Step 4: Potential Risk</strong><br> If an attacker discovers this issue, they may be able to register the same resource on the external service and gain control of the subdomain. This could allow them to host malicious or misleading content under the organization’s domain.</p><h3><strong>Why Subdomain Takeover is Dangerous</strong></h3><p><strong>1. Phishing Risk</strong><br> If an attacker gains control of a subdomain, they can create fake login pages that look legitimate. Because the URL belongs to the real domain, users are more likely to trust it and enter sensitive information like usernames and passwords.</p><p><strong>2. Cookie Theft</strong><br> Some applications share cookies across subdomains. If an attacker controls one subdomain, they may be able to capture session cookies and potentially access user sessions.</p><p><strong>3. Brand Damage</strong><br> A compromised subdomain can be used to host malicious content, spam, or scams. Since it appears under the company’s domain, it can harm the organization’s reputation and reduce user trust.</p><p><strong>4. Account Takeover</strong><br> In certain cases, stolen session cookies or phishing attacks can allow attackers to gain unauthorized access to user accounts, leading to further security issues.</p><h3>How to Detect Subdomain Takeover</h3><p><strong>1. Subfinder</strong><br> Subfinder is used to discover subdomains of a target domain. It helps identify unused or forgotten subdomains that may lead to takeover vulnerabilities.</p><p><strong>Command:</strong></p><pre>subfinder -d example.com</pre><p><strong>2. Amass</strong><br> Amass performs deeper subdomain enumeration by collecting data from many public sources. This helps find additional subdomains that might be misconfigured.</p><p><strong>Command:</strong></p><pre>amass enum -d example.com</pre><p><strong>3. Dig</strong><br> dig is a DNS lookup tool used to check DNS records like A records or CNAME records. It helps verify whether a subdomain is still pointing to an external service.</p><p><strong>Command:</strong></p><pre>dig subdomain.example.com</pre><p><strong>4. Nslookup</strong><br> nslookup is another DNS query tool used to inspect domain records and confirm whether a subdomain points to a valid service.</p><p><strong>Command:</strong></p><pre>nslookup subdomain.example.com</pre><p><strong>5. Subzy</strong><br> Subzy is a tool designed to automatically detect potential subdomain takeover vulnerabilities by checking if the subdomain points to an unclaimed service.</p><p><strong>Command:</strong></p><pre>subzy run --targets subdomains.txt</pre><p>This process helps security testers quickly identify <strong>dangling DNS records</strong> that could potentially lead to a <strong>subdomain takeover vulnerability</strong>.</p><h3>Commonly Vulnerable Services</h3><ul><li><strong>AWS S3:</strong> Bucket deleted but CNAME remains</li><li><strong>Heroku:</strong> App deleted, subdomain claimable</li><li><strong>GitHub Pages:</strong> Repo deleted or CNAME unconfigured</li><li><strong>Azure:</strong> CloudApp, Blob Storage, Web Apps</li><li><strong>Shopify:</strong> Store removed but DNS points to Shopify</li><li><strong>Fastly/CloudFront:</strong> Distribution deleted</li><li><strong>Zendesk/Freshdesk:</strong> Support portal deprovisioned</li></ul><h3>How to Prevent Subdomain Takeover</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J0-LMigUMduH15xps1lETg.png" /><figcaption>Figure 3: Illustration of the Subdomain Takeover attack process</figcaption></figure><p><strong>1. Remove Unused DNS Entries</strong><br> Always remove DNS records for subdomains that are no longer used. Leaving old or unused entries can create opportunities for attackers to take control.</p><p><strong>2. Monitor Subdomains</strong><br> Regularly check and keep track of all subdomains associated with your domain. This helps quickly identify inactive or misconfigured subdomains.</p><p><strong>3. Validate External Services</strong><br> If a subdomain is connected to a third-party service, make sure the service is still active. When the service is removed, the related DNS record should also be deleted.</p><p><strong>4. Use Automated Scanning</strong><br> Use security tools to automatically scan subdomains and detect possible takeover issues. Regular scanning helps find problems early before attackers exploit them.</p><h3>Impact</h3><p>If exploited, this vulnerability could allow attackers to:</p><ul><li>Host phishing pages under a trusted domain</li><li>Distribute malicious files</li><li>Damage the organization’s reputation</li><li>Mislead users by impersonating legitimate services</li></ul><h3>Conclusion</h3><p>Subdomain takeover is a common but often overlooked security issue caused by misconfigured or unused DNS records. If not properly managed, attackers may gain control of a subdomain and use it for phishing, malware distribution, or other malicious activities.</p><p>Regularly monitoring subdomains, removing unused DNS entries, and verifying external services can significantly reduce the risk. Proper security practices and periodic testing help organizations prevent subdomain takeover and protect their domain reputation.</p><h3>References</h3><p><strong>HackerOne: A Guide To Subdomain Takeovers 2.0</strong> <a href="https://www.hackerone.com/blog/guide-subdomain-takeovers-20">https://www.hackerone.com/blog/guide-subdomain-takeovers-20</a><br><strong>Subdomain Takeover in Azure<br></strong><a href="https://godiego.co/posts/STO-Azure/">https://godiego.co/posts/STO-Azure/</a><br><strong>Arne Swinnen: Authentication Bypass on Uber’s SSO </strong><a href="https://www.arneswinnen.net/2017/06/authentication-bypass-on-ubers-sso-via-subdomain-takeover/">https://www.arneswinnen.net/2017/06/authentication-bypass-on-ubers-sso-via-subdomain-takeover/</a><br><strong>Can I Takeover XYZ — List of vulnerable services </strong><a href="https://github.com/EdOverflow/can-i-take-over-xyz">https://github.com/EdOverflow/can-i-take-over-xyz</a><br><strong>OWASP: Subdomain Takeover<br></strong><a href="https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/02-Configuration_and_Deployment_Management_Testing/10-Test_for_Subdomain_Takeover">https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/02-Configuration_and_Deployment_Management_Testing/10-Test_for_Subdomain_Takeover</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db135d63aef9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>