<?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 Mayank Chhabra on Medium]]></title>
        <description><![CDATA[Stories by Mayank Chhabra on Medium]]></description>
        <link>https://medium.com/@wolfdagger?source=rss-01b1364b7855------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2Q6sa09B6NSA5zDtkDT0Rw.jpeg</url>
            <title>Stories by Mayank Chhabra on Medium</title>
            <link>https://medium.com/@wolfdagger?source=rss-01b1364b7855------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 04:25:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wolfdagger/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[Understanding Open Redirection Vulnerability: Risks, Exploitation & Prevention]]></title>
            <link>https://medium.com/@wolfdagger/understanding-open-redirection-vulnerability-risks-exploitation-prevention-3d5398bbbfbb?source=rss-01b1364b7855------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d5398bbbfbb</guid>
            <category><![CDATA[security-vulnerabilities]]></category>
            <category><![CDATA[open-redirection]]></category>
            <category><![CDATA[application-security]]></category>
            <dc:creator><![CDATA[Mayank Chhabra]]></dc:creator>
            <pubDate>Sun, 12 Apr 2026 12:58:09 GMT</pubDate>
            <atom:updated>2026-04-12T12:58:09.857Z</atom:updated>
            <content:encoded><![CDATA[<p>In modern web applications, seamless navigation between pages and external resources is essential for user experience. However, improper handling of redirection mechanisms can introduce a critical security flaw known as open redirection vulnerability. While often underestimated, this vulnerability can be exploited in phishing attacks, token theft, and user trust abuse.</p><h3>What is Open Redirection?</h3><p>Open redirection occurs when a web application accepts a user-controlled input (such as a URL parameter) and redirects users to that location without proper validation.</p><h3>Example:</h3><pre>https://example.com/redirect?url=https://malicious-site.com</pre><p>If the application does not validate the url parameter, an attacker can craft a link that appears legitimate but redirects users to a malicious website.</p><h3>Why is it Dangerous?</h3><p>At first glance, open redirection might seem like a low-severity issue, but its real impact is often underestimated.</p><h3>1. Phishing Attacks</h3><p>Attackers can abuse trusted domains to trick users into visiting fake login pages.</p><h3>2. Credential Theft</h3><p>Users redirected to attacker-controlled sites may unknowingly enter sensitive information.</p><h3>3. Token Leakage</h3><p>In OAuth or authentication flows, tokens can be exposed via manipulated redirect URLs.</p><h3>4. Bypassing Security Controls</h3><p>Open redirects can sometimes be chained with other vulnerabilities to bypass access controls.</p><h3>How Attackers Exploit It</h3><p>Attackers use various techniques to bypass weak validation:</p><ul><li>URL encoding (%68%74%74%70%73://evil.com)</li><li>Double encoding</li><li>Using subdomains (trusted.com.attacker.com)</li><li>Protocol-relative URLs (//evil.com)</li><li>Mixing HTTP and HTTPS</li><li>Exploiting poorly implemented allowlists</li></ul><h3>Real-World Attack Scenario</h3><ol><li>Attacker crafts a malicious URL using a trusted domain:</li></ol><pre>https://trusted-site.com/login?next=https://evil.com</pre><p>2. Victim clicks the link believing it is legitimate.</p><p>3. The application redirects the user to the attacker’s website</p><p>4. The user enters credentials on a fake login page</p><p>5. Attacker captures sensitive information</p><h3>How to Identify Open Redirection</h3><p>Security testers typically:</p><ol><li>Look for parameters like:</li></ol><ul><li>redirect</li><li>url</li><li>next</li><li>returnUrl</li></ul><p>2. Modify values to external domains</p><p>3. Test encoded and obfuscated payloads</p><p>4. Analyze behavior in authentication and password reset flows.</p><h3>Prevention Techniques</h3><p>To mitigate open redirection vulnerabilities, organizations should implement the following:</p><h3>1. Use Allowlists</h3><p>Only allow redirection to trusted, predefined domains.</p><h3>2. Avoid Direct User Input</h3><p>Do not use user-controlled URLs directly for redirection.</p><h3>3. Validate and Normalize URLs</h3><p>Ensure proper decoding and validation before processing.</p><h3>4. Use Indirect References</h3><p>Map user inputs to internal identifiers instead of full URLs.</p><h3>5. Restrict External Redirects</h3><p>Block or warn users before redirecting to external domains.</p><h3>6. Secure Authentication Flows</h3><p>Carefully validate redirect URIs in OAuth and login systems.</p><h3>Best Practices for Developers</h3><ul><li>Implement strict server-side validation</li><li>Avoid relying on client-side checks</li><li>Use frameworks that provide secure redirect handling</li><li>Regularly test applications for URL-based vulnerabilities</li><li>Conduct secure code reviews</li></ul><h3>Conclusion</h3><p>Open redirection vulnerability is a subtle yet powerful security risk that can significantly impact users and organizations when exploited. By understanding how it works and implementing proper validation and control mechanisms, businesses can protect their users from phishing attacks and maintain trust in their platforms.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d5398bbbfbb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Client-Side Template Injection (CSTI)]]></title>
            <link>https://medium.com/@wolfdagger/understanding-client-side-template-injection-csti-a1d83af94018?source=rss-01b1364b7855------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1d83af94018</guid>
            <category><![CDATA[web-application-security]]></category>
            <dc:creator><![CDATA[Mayank Chhabra]]></dc:creator>
            <pubDate>Thu, 03 Apr 2025 12:09:59 GMT</pubDate>
            <atom:updated>2025-04-03T12:10:42.213Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s fast-evolving digital landscape, web applications are becoming increasingly dynamic. Developers use various tools to create rich, interactive user interfaces, and one such tool is templating engines. However, while these tools provide powerful ways to render dynamic content, they can also introduce security vulnerabilities if not handled properly. One of the most common vulnerabilities associated with templating engines is Client-Side Template Injection (CSTI).</p><p><em>In this blog, we will explore what CSTI is, how it works, the risks it poses, and how you can protect your web applications from this dangerous attack.</em></p><h3>What Is Client-Side Template Injection (CSTI)?</h3><p>Client-Side Template Injection (CSTI) is a vulnerability that arises when user-controlled input is incorporated into client-side templates without proper sanitization. In simpler terms, it’s when an attacker can inject their own code into a template that is rendered in the browser.</p><p>Templating engines are commonly used in modern web applications to dynamically generate HTML content. These engines take a template (an HTML structure with placeholders) and inject dynamic data into it (like user names, profile pictures, etc.) when the page is loaded.</p><p>The problem arises when the data being inserted into the template is directly controlled by the user, and the application fails to sanitize it before rendering. This opens up the potential for an attacker to inject malicious code into the template, which will then execute in the user’s browser.</p><h3>How Does CSTI Work?</h3><p>To better understand how CSTI works, let’s break down the process:</p><ol><li><strong>Templating Engine Integration</strong>: Many modern web frameworks and libraries, like Angular, Vue.js, and React, use templating engines to insert dynamic content into HTML pages.</li><li><strong>User Input</strong>: Web applications often take input from users, such as search terms, form data, or query parameters, and incorporate it into templates. If an attacker can manipulate this user input (for example, through URL parameters), they might be able to inject their own content.</li><li><strong>Lack of Sanitization</strong>: If the web application does not properly sanitize or escape the user input, the injected data might be processed as part of the template, potentially executing malicious code on the client side.</li><li><strong>Template Execution</strong>: When the template is rendered in the browser, the malicious code gets executed, either by manipulating the DOM (Document Object Model) or by triggering specific client-side vulnerabilities (like JavaScript execution).</li></ol><h3>Example of CSTI Attack</h3><p>Imagine a web application where a user can search for items by entering a query into a search box. The application uses a templating engine to display the results. For instance, it may take a search query like this:</p><pre>&lt;h1&gt;Search results for: {{ searchQuery }}&lt;/h1&gt;</pre><p><em>Here, </em><em>{{ searchQuery }} is a placeholder that gets replaced by the actual search term entered by the user.</em></p><p>However, if the application fails to sanitize the user input, an attacker could craft a search query like:</p><pre>{{ 7*7 }}</pre><p>This input would cause the templating engine to evaluate the expression 7*7, which could potentially result in arbitrary JavaScript code execution or even a more complex attack that exploits other client-side vulnerabilities.</p><p>In a more dangerous scenario, the attacker could inject malicious JavaScript into the template, potentially stealing cookies or other sensitive data from the user’s browser.</p><h3>Risks of CSTI</h3><p>CSTI can lead to a variety of severe security risks, including:</p><ol><li><strong>Cross-Site Scripting (XSS)</strong>: CSTI is essentially a variant of XSS, where malicious code gets executed in the user’s browser. If the attacker injects JavaScript code into the template, it could execute in the context of the user’s session, stealing sensitive data like authentication tokens or cookies.</li><li><strong>Data Exfiltration</strong>: An attacker can steal sensitive information, such as user data or session tokens, by injecting JavaScript into the template.</li><li><strong>Cross-Site Request Forgery (CSRF)</strong>: CSTI can also be used as a vector for CSRF attacks, where malicious JavaScript on a page sends requests on behalf of an authenticated user without their consent.</li><li><strong>Denial of Service (DoS)</strong>: If the template engine evaluates malicious input in a way that causes excessive computation or infinite loops, an attacker could overload the server, potentially causing a denial of service.</li><li><strong>Privilege Escalation</strong>: If the attacker can inject certain expressions or functions into the template, they could escalate their privileges on the system, gaining unauthorized access to resources.</li></ol><h3>How to Protect Against CSTI</h3><p>Protecting your web applications from Client-Side Template Injection requires a multi-layered approach. Here are some best practices to mitigate this vulnerability:</p><h4>1. Validate and Sanitize User Input</h4><p>One of the most effective ways to prevent CSTI is to <strong>validate</strong> and <strong>sanitize</strong> all user inputs. Ensure that inputs like query parameters, form data, or URL parameters are strictly controlled and only accept expected values.</p><p><em>For example:</em></p><ul><li><em>Reject any input that contains characters like </em><em>&lt;, </em><em>&gt;, or </em><em>{{ }}, which are typically used in templating engines.</em></li><li><em>Use a </em><strong><em>whitelist</em></strong><em> approach by defining exactly what type of input is valid (e.g., alphanumeric characters, no special characters).</em></li></ul><h4>2. Escape User Input</h4><p>If your application needs to display user input in the template, ensure that the input is <strong>properly escaped</strong> to prevent it from being interpreted as part of the template. Many templating engines provide functions or built-in mechanisms to escape characters that could lead to code execution.</p><h4>3. Use Templating Engines with Built-in Protection</h4><p>Choose templating engines that have <strong>automatic escaping</strong> mechanisms to prevent client-side injection. For instance:</p><ul><li><strong>Handlebars</strong> (JavaScript) automatically escapes variables inserted into templates by default.</li><li><strong>Angular</strong> and <strong>React</strong> sanitize data automatically before rendering it to the DOM.</li></ul><p>If you are using a templating engine that does not have automatic sanitization, consider switching to one that does or implementing your own escape mechanisms.</p><h4>4. Content Security Policy (CSP)</h4><p>Implementing a <strong>Content Security Policy (CSP)</strong> can reduce the impact of CSTI attacks. By setting strict CSP headers, you can limit where scripts can be loaded from and what they can do, thus preventing malicious scripts from executing even if they are injected into the page.</p><h3>Conclusion</h3><p>Client-Side Template Injection (CSTI) is a dangerous vulnerability that can lead to a variety of attacks, including Cross-Site Scripting (XSS), data exfiltration, and more. By understanding how CSTI works and following best practices like input validation, escaping user data, and using templating engines with built-in protection, you can significantly reduce the risk of a successful attack.</p><p>As web applications become more complex, security needs to be a top priority. By adopting secure coding practices and continuously auditing your code, you can ensure that your users’ data remains safe and that your application stays protected against evolving threats.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1d83af94018" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Salt Hashing: Enhancing Security in Modern Systems]]></title>
            <link>https://medium.com/@wolfdagger/understanding-salt-hashing-enhancing-security-in-modern-systems-3ce756f72a57?source=rss-01b1364b7855------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ce756f72a57</guid>
            <dc:creator><![CDATA[Mayank Chhabra]]></dc:creator>
            <pubDate>Wed, 22 Jan 2025 19:27:33 GMT</pubDate>
            <atom:updated>2025-01-22T19:28:29.384Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s digital landscape, security is a top concern for developers, especially when it comes to protecting sensitive information like passwords. One of the most critical techniques used to secure passwords is <strong>hashing</strong>. However, on its own, hashing can be vulnerable to various attacks. This is where <strong>salt hashing</strong> comes into play. In this blog post, we will explore what salt hashing is, why it is important, and how it enhances security in modern systems.</p><p><strong>What is Hashing?</strong></p><p>Before diving into salt hashing, it’s important to first understand what hashing is. Hashing is the process of converting a piece of data (like a password) into a fixed-size string of characters, typically using a cryptographic hash function. The output, often referred to as the hash value, is a one-way transformation — meaning it cannot easily be reversed to reveal the original input.</p><p>For example, the password “password123” might be hashed using an algorithm like SHA-256, resulting in a hash like:</p><pre>ef92b778bafe771e89245b6a2f72c8f3b44178e9f81e96bcbb99d2ef54296c22</pre><p>In theory, even if someone gains access to the hash, they cannot easily retrieve the original password.</p><h3>Why Hashing Alone Isn’t Enough</h3><p>While hashing is a powerful technique, there are a few limitations. One significant issue is that if two users have the same password, they will have the same hash value. This makes it easier for attackers to identify users with common passwords in the event of a data breach. Additionally, attackers can use techniques like <strong>rainbow tables</strong> — precomputed lists of hash values for common passwords — to quickly find the corresponding plain-text password.</p><h3>Enter Salt Hashing</h3><p>To address these vulnerabilities, <strong>salt hashing</strong> was introduced. A <strong>salt</strong> is a random value that is added to the input of the hash function before hashing it. The salt ensures that even if two users have the same password, their hashes will be different because the salt values will be different.</p><h3>How Salt Hashing Works</h3><p>The process of salt hashing involves the following steps:</p><ol><li><strong>Generate a random salt</strong>: When a user creates or updates their password, the system generates a random salt. The salt is typically unique for each user.</li><li><strong>Combine the password and the salt</strong>: The password is combined with the salt before it is hashed. This can be done by appending or prepending the salt to the password.</li><li><strong>Hash the salted password</strong>: The salted password (the original password plus the salt) is then passed through a hash function.</li><li><strong>Store the salt and hash</strong>: Both the salt and the resulting hash are stored in the system. When the user logs in, the system retrieves the salt, combines it with the entered password, hashes it, and compares the result with the stored hash.</li></ol><p>For example, if the password is “password123” and the generated salt is “XyZ123”, the salted password would be:</p><pre>password123XyZ123</pre><p>This salted password is then hashed to produce a unique hash value that is stored.</p><h3>Why Salt Hashing Matters</h3><ol><li><strong>Prevents Rainbow Table Attacks</strong>: By adding a unique salt to each password before hashing, attackers cannot use precomputed rainbow tables. Even if two users have the same password, their hashes will differ due to the unique salts.</li><li><strong>Makes Identical Passwords Unique</strong>: Without salt, identical passwords would produce identical hashes, making it easy for attackers to identify common passwords. Salt ensures that even identical passwords result in different hashes, making the system more secure.</li><li><strong>Improves Protection Against Dictionary Attacks</strong>: In dictionary attacks, attackers try to guess a password by hashing common words or phrases. Salt significantly increases the complexity of these attacks by requiring the attacker to hash the salted password combinations individually.</li><li><strong>Better Overall Security</strong>: Salt hashing enhances the security of passwords by making brute-force and other attacks far more time-consuming and resource-intensive, reducing the likelihood of successful unauthorized access.</li></ol><h3>Best Practices for Salt Hashing</h3><p>While salt hashing is an essential security measure, there are several best practices to keep in mind to ensure it is implemented effectively:</p><ol><li><strong>Use a Long, Cryptographically Secure Salt</strong>: The salt should be sufficiently long (typically 16 bytes or more) and generated using a cryptographically secure random number generator. This ensures that the salt cannot be easily predicted.</li><li><strong>Store Salts and Hashes Securely</strong>: Both the salt and the hash must be stored securely in the database. They should be stored in such a way that an attacker cannot access them easily.</li><li><strong>Use a Strong Hashing Algorithm</strong>: Using a strong cryptographic hash function like <strong>bcrypt</strong>, <strong>Argon2</strong>, or <strong>PBKDF2</strong> is important. These algorithms are specifically designed to be computationally expensive, slowing down brute-force attacks.</li><li><strong>Consider Peppering for Added Security</strong>: While salts provide unique randomness, adding an additional layer of complexity (a <strong>pepper</strong>) can enhance security further. A pepper is another secret value that is added to the password before hashing. It’s not stored in the database, which makes it harder for attackers to guess.</li></ol><h3>Common Algorithms for Salt Hashing</h3><p>Several modern algorithms support salt hashing by design, allowing developers to easily implement secure password hashing. Some of the most commonly used include:</p><ul><li><strong>bcrypt</strong>: A popular and secure algorithm that automatically handles salting. It’s designed to be slow, making brute-force attacks more difficult.</li><li><strong>PBKDF2 (Password-Based Key Derivation Function 2)</strong>: Another widely-used method that uses both a salt and multiple iterations of hashing to make the process slower and more resistant to attacks.</li><li><strong>Argon2</strong>: The winner of the Password Hashing Competition (PHC) and known for its resistance to both GPU and side-channel attacks. It’s the most modern and recommended password hashing algorithm.</li></ul><h3>Conclusion</h3><p>Salt hashing is a simple yet powerful technique that significantly improves the security of passwords and other sensitive information. By adding randomness to each password hash, it ensures that even if two users share the same password, their stored hashes will be unique, protecting against common attacks like rainbow tables and dictionary-based brute force.</p><p>As security threats continue to evolve, implementing salt hashing along with strong hash algorithms and secure storage practices will ensure that your system remains resilient to attacks. Whether you’re developing a new application or reviewing an existing system, adopting salt hashing is a critical step in safeguarding user data and maintaining trust.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ce756f72a57" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>