appsec.fyi

SQLi — A Practical Guide

A curated AppSec resource library covering XSS, SQLi, SSRF, IDOR, RCE, XXE, OSINT, and more.

SQLi: A Practical Guide

Curated and synthesized by . Last updated 2026-06-29. Synthesized from 194 of 194 curated resources. Browse all 194 SQLi resources →

Problem Framing

SQL injection (SQLi) remains a persistent and critical threat in application security, consistently appearing in the OWASP Top 10 [1][2]. Despite decades of awareness and well-understood mitigation techniques, SQLi vulnerabilities continue to be prevalent, leading to severe security incidents ranging from sensitive data exfiltration [3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][22][23] to full system compromise and remote code execution (RCE) [24][25][26][27][28][29][30][31][32][33][34][10][35][36][37][38][39][40][41][42][43][44][45][46][47][48][49][50][51][52]. The underlying principle of SQLi is the unintended execution of arbitrary SQL code due to the improper handling of user-supplied input within database queries [1][2][53][54]. This guide is aimed at experienced application security practitioners, providing a deep dive into the mechanics, techniques, detection, and prevention of SQL injection, with a focus on practical application and advanced considerations.

Core Mechanics

At its heart, SQL injection exploits the fundamental way applications interact with databases: by constructing SQL queries using user-provided data. When this data is not properly validated, sanitized, or parameterized, an attacker can insert SQL syntax that alters the intended query execution [1][53]. The primary mechanism is the concatenation of untrusted input directly into SQL statements, allowing malicious SQL code to be interpreted as part of the command rather than just data [1][2][53][54].

A canonical example is an authentication bypass: a query designed to check credentials might look like:

SELECT * FROM users WHERE username = 'USER_INPUT' AND password = 'PASSWORD_INPUT'

An attacker can manipulate this by providing input like ' OR '1'='1' -- for the username. If the application directly concatenates this input, the resulting query becomes:

SELECT * FROM users WHERE username = '' OR '1'='1' --' AND password = ''

The OR '1'='1' clause makes the WHERE condition always true, and the -- comments out the rest of the original query, effectively bypassing authentication [1][53][54][55][56]. This vulnerability has been demonstrated across numerous platforms and languages, including Node.js [2], C# with Entity Framework [53], PHP [57][58], and frameworks like LangGraph [25][59].

SQL injection attacks are broadly categorized based on how the results are obtained:

Notable Techniques

Beyond the fundamental mechanics, attackers employ numerous techniques to discover, exploit, and bypass defenses against SQLi.

Discovering Injection Points

The initial phase of finding SQLi often involves basic reconnaissance of input fields. A common starting point is submitting a single quote (') to trigger SQL syntax errors [1][60][75][67][76][77][70][71]. Other common characters and characters for testing include double quotes ("), semicolons (;), parentheses (( , )), comments (--, / /, #), and various encodings or character substitutions [78][79][80][81][82][83][84][65][85][56][86][71].

Exploitation Techniques

Detection and Prevention

Preventing SQL injection is paramount, and the industry has developed robust strategies.

Prevention

The most effective and widely recommended defense is parameterized queries (also known as prepared statements) [105][1][2][53][54][106][107][108][67][87][77][70][71]. In this approach, the SQL query structure is separated from the data. The database pre-compiles the query with placeholders, and user input is then safely bound to these placeholders, ensuring it's treated as data, not executable code [105][53].

Other critical prevention methods include:

Detection

Tooling

A robust set of tools aids practitioners in identifying, exploiting, and understanding SQL injection vulnerabilities:

Recent Developments and Trends

The landscape of SQL injection is continually evolving, with new variations and exploitation techniques emerging.

Where to Go Deeper

For practitioners looking to deepen their understanding and practical skills in SQL injection, the following resources are invaluable:

Sources cited in this guide

  1. SQL Injection: Why It Persists and How to Prevent It — latesthackingnews.com
  2. Preventing SQL injection attacks in Node.js — snyk.io
  3. Ghost CMS Under Siege: How a SQL Injection Turned 700 Blogs Into Malware Distribution Networks — securityboulevard.com
  4. SQL Injection in Password Reset: Full Database, One Email — infosecwriteups.com
  5. Ghost CMS Vulnerability Exploited to Hack Over 700 Websites — securityweek.com
  6. Active Exploitation Alert: Ghost CMS CVE-2026-26980 Mass Attack Hijacks 700 Sites for ClickFix Malware Campaigns — rescana.com
  7. Ghost CMS SQL Injection Hits 700 Sites: Harvard DuckDuckGo Serve Fake Cloudflare Malware — techtimes.com
  8. Ghost CMS CVE-2026-26980 Exploited to Hijack 700 Sites for ClickFix Attacks — thehackernews.com
  9. Ghost CMS Users Under Attack: Why Developers Must Act Fast — techgig.com
  10. Drupal Core SQL Injection Bug Actively Exploited Added to CISA KEV — thehackernews.com
  11. CVE-2026-9082: Highly Critical SQL Injection Vulnerability in Drupal Core (SA-CORE-2026-004) — securityboulevard.com
  12. 1 Million WordPress Sites Affected by Avada Builder File Read and SQL Injection Flaws — cybersecuritynews.com
  13. 1 Million WordPress Websites Exposed by Avada Builder Security Vulnerabilities — gbhackers.com
  14. SQL Injection File Read Vulnerability Affect 1M Avada WordPress Sites — cyberpress.org
  15. Critical LiteLLM SQL Injection Vulnerability Exploited in the Wild — cybersecuritynews.com
  16. Critical LiteLLM SQL Injection Vulnerability Exploited in the Wild — cyberpress.org
  17. Critical LiteLLM Flaw Enables Database Attacks Through SQL Injection — gbhackers.com
  18. FortiClient Hit by Severe SQL Injection Vulnerability Enabling Database Intrusion — gbhackers.com
  19. CISA Warns of Fortinet SQL Injection Flaw Actively Exploited in Attacks — cyberpress.org
  20. CISA Warns Fortinet SQL Injection Flaw Is Being Actively Exploited — gbhackers.com
  21. CVE-2026-26116: SQL Server SQL Injection — sentinelone.com
  22. Multiple SonicWall Vulnerabilities Enable SQL Injection and Privilege Escalation Attacks — cybersecuritynews.com
  23. Multiple SonicWall Flaws Enable SQL Injection and Privilege Escalation Attacks — gbhackers.com
  24. Critical Vulnerability Chain in LangGraph Allows Attackers to Gain Full Server Control — cybersecuritynews.com
  25. From SQLi to RCE - Exploiting LangGraphs Checkpointer — research.checkpoint.com
  26. AnonymousPostgreSQL Injection in Drupal Core (CVE-2026-9082) — securityboulevard.com
  27. Exploitation of Critical SQL Injection Vulnerability in Drupal (CVE-2026-9082) — systemtek.co.uk
  28. Drupal bug added to CISA list of known exploited vulnerabilities — scworld.com
  29. CVE-2026-9082: Critical Drupal SQL Injection Vulnerability Affects PostgreSQL Deployments — securityboulevard.com
  30. CISA orders feds to patch actively exploited Drupal vulnerability — bleepingcomputer.com
  31. CISA Warns Drupal Core SQL Injection Vulnerability Is Being Exploited in Attacks — gbhackers.com
  32. Drupal warns of active exploitation attempts targeting critical SQL injection flaw — cyberinsider.com
  33. U.S. CISA adds a flaw in Drupal Core to its Known Exploited Vulnerabilities catalog — securityaffairs.com
  34. CVE-2026-9082: Drupal's Highly Critical SQL Injection Flaw Is Already Under Active Attack — securityaffairs.com
  35. Drupal Vulnerability in Hacker Crosshairs Shortly After Disclosure — securityweek.com
  36. Drupal Core SQL Injection Vulnerability (CVE-2026-9082) — securityboulevard.com
  37. CVE-2026-9082: Critical Drupal Core SQLi Flaw — socprime.com
  38. Drupal: Critical SQL injection flaw now targeted in attacks — bleepingcomputer.com
  39. Drupal Emergency Patch Issued As Critical SQL Injection Bug Hits Open Source Stack - Open Source For You — opensourceforu.com
  40. Drupal Patches Highly Critical Vulnerability Exposing Websites to Hacking — securityweek.com
  41. Critical Drupal Core Vulnerability Exposes Websites to Attacks — cyberpress.org
  42. Drupal admins rushing to patch maximum severity SQL injection vulnerability — csoonline.com
  43. Critical PostgreSQL Vulnerabilities Enables Code Execution and SQL Injections — cybersecuritynews.com
  44. Critical PostgreSQL Flaws Enable Code Execution and SQL Injection — cyberpress.org
  45. PostgreSQL Flaws Expose Databases to Remote Code Execution and SQL Injection — gbhackers.com
  46. ProFTPD SQL Injection Flaw Opens Door To Remote Code Execution Attacks — gbhackers.com
  47. ProFTPD SQL Injection Flaw Enables Remote Code Execution — cyberpress.org
  48. SQL Injection and Postgres: An Adventure to Eventual RCE — pulsesecurity.co.nz
  49. CVE-2025-1094 WebSocket and SQL Injection Exploit Script — github.com
  50. CVE-2025-1094: PostgreSQL psql SQL Injection (Fixed) — Rapid7 — rapid7.com
  51. CVE-2025-25257: Critical SQLi in Fortinet FortiWeb — socprime.com
  52. CVE-2026-27697: Basercms SQLi Vulnerability — sentinelone.com
  53. Preventing SQL injection in C# with Entity Framework — snyk.io
  54. SQL Injection - OWASP — owasp.org
  55. 7 Types of SQL Injection Attacks & How to Prevent Them — sentinelone.com
  56. Advanced SQL Injection Cheatsheet — github.com
  57. Demystifying SQL Injection: A Comprehensive Guide to Understanding SQL Injection Risks — akto.io
  58. SQL Injection in GraphQL — 0xgad.medium.com
  59. Researchers Find Critical Vulnerabilities in LangGraph — letsdatascience.com
  60. SQL Injection Tutorial & Examples - PortSwigger — portswigger.net
  61. https://medium.com/bugbountywriteup/sql-injection-time-and-boolean-based-27239b6a55e8?source=twitterShare-1764222123d3-1576594710&_referrer=twitter&_branch_match_id=732557985002302401 — medium.com
  62. Exploiting Error Based SQL Injections & Bypassing Restrictions — link.medium.com
  63. SQL Injection for Bug Bounty Hunters | YesWeHack — yeswehack.com
  64. SQL Injection Cheatsheet 2021 — hackersonlineclub.com
  65. https://portswigger.net/web-security/sql-injection/cheat-sheet — portswigger.net
  66. TryHackMe | SQHell — tryhackme.com
  67. DVWA 1.9+: Blind SQL Injection with SQLMap — link.medium.com
  68. https://medium.com/bugbountywriteup/sql-injection-time-and-boolean-based-27239b6a55e8?source=twitterShare-1764222123d3-1576594710&_referrer=twitter&_branch_match_id=732557985002302401 — medium.com
  69. Making a Blind SQL Injection a Little Less Blind — medium.com
  70. BSQLinjector – Blind SQL Injection Tool Download in Ruby — darknet.org.uk
  71. Vulnerability analysis, Security Papers, Exploit Tutorials - Part 12975 — exploit-db.com
  72. Second-Order SQL Injection with Stored Procedures and DNS-Based Egress — netspi.com
  73. When the Database Won't Talk: A Deep Dive into Blind SQLi — hadrian.io
  74. SQL Injection Wiki — sqlwiki.netspi.com
  75. SQL Injection Bypassing WAF | OWASP — owasp.org
  76. Identifying & Exploiting SQL Injection: Manual & Automated — link.medium.com
  77. SQL Injection Wiki — sqlwiki.netspi.com
  78. Pentesting PostgreSQL with SQL Injections — onsecurity.io
  79. Advanced Boolean-Based SQLi Filter Bypass Techniques — secjuice.com
  80. WAF Bypass Techniques for SQL Injection — nav1n0x.gitbook.io
  81. Advanced SQL Injection Techniques in Modern Web Apps — gauravsingh-cybersecurity.github.io
  82. SQLi Payloads - Classic, Blind, Error-Based, Time-Based, WAF Bypass — github.com
  83. PayloadsAllTheThings - SQL Injection — github.com
  84. SQL Injection Cheat Sheet by Netsparker — netsparker.com
  85. BChecks/vulnerability-classes/injection at main · PortSwigger/BChecks · GitHub — github.com
  86. Web Attack Cheat Sheet — github.com
  87. SQL Injection 101: Common Defense Methods Hackers Should Be Aware Of — null-byte.wonderhowto.com
  88. How to turn SQL injection into an RCE or a file read? Case study of 128 bug bounty reports — youtube.com
  89. Unauthenticated SQL Injection in GUI — Fortinet PSIRT — fortiguard.fortinet.com
  90. SQL Injection 2025 Advanced Exploitation & Defense Guide — broadchannel.org
  91. Vulnerability analysis, Security Papers, Exploit Tutorials - Part 12975 — exploit-db.com
  92. CVE-2025-1094: PostgreSQL SQL Injection Vulnerability — armosec.io
  93. Exploiting Second-Order SQL Injection to Retrieve the Flag — medium.com
  94. SQLMap Command Generator — acorzo1983.github.io
  95. Exploiting second order blind SQL injection — link.medium.com
  96. SQL injection to RCE — medium.com
  97. SQL Attack (Constraint-based) - Dhaval Kapil — dhavalkapil.com
  98. Bypassing WAF with Adversarial SQL — dl.acm.org
  99. WAF Bypass Using JSON-Based SQL Injection Attacks — picussecurity.com
  100. WAF Testing Guide: How to Validate Web Application Firewalls — picussecurity.com
  101. Bypassing WAFs in 2025: New Techniques and Evasion Tactics — medium.com
  102. Exploiting an SQL Injection with WAF Bypass — vaadata.com
  103. open-appsec ML-based WAF protects against modern SQLi AutoSpear evasion techniques — openappsec.io
  104. Identifying SQL Injections in a GraphQL API — praetorian.com
  105. Getting started with query parameterization — snyk.io
  106. What is SQL Injection? How to Prevent SQL Injection | Fortinet — fortinet.com
  107. https://github.com/yeswehack/vulnerable-code-snippets — github.com
  108. SQL Injection 101: Common Defense Methods Hackers Should Be Aware Of — null-byte.wonderhowto.com
  109. SQL Attack (Constraint-based) - Dhaval Kapil — dhavalkapil.com
  110. 9 SQLi Detection Tools You Need to Know in 2023 — analyticsinsight.net
  111. https://vavkamil.cz/2019/10/09/understanding-the-full-potential-of-sqlmap-during-bug-bounty-hunting/ — vavkamil.cz
  112. DVWA Cheat Sheet (Low & Medium) — infosecwriteups.com
  113. NucleiFuzzer - Powerful Automation Tool For Detecting XSS, SQLi, SSRF, Open — kitploit.com
  114. How I Found multiple SQL Injection with FFUF and Sqlmap in a few minutes — 0xmahmoudjo0.medium.com
  115. Understanding the full potential of sqlmap during bug bounty hunting — vavkamil.cz
  116. Comprehensive Guide to Sqlmap (Target Options) — linkedin.com
  117. https://secnhack.in/website-penetration-testing-and-database-hacking-with-sqlmap/ — secnhack.in
  118. GitHub - danialhalo/SqliSniper: Advanced Time-based Blind SQL Injection fuzzer for HTTP Headers — github.com
  119. SQL Injection Cheat Sheet by Netsparker — netsparker.com
  120. http://www.darknet.org.uk/2017/09/bsqlinjector-blind-sql-injection-tool-download-ruby/ — darknet.org.uk
  121. SQLMap Tamper Collection: Modern WAF Bypass Scripts (Cloudflare, AWS, Azure) — github.com
  122. Vibe-Coding's Hidden Danger: SQL Injection Risks Go Live — techbuzz.ai
  123. Rapid7 Analysis: CVE-2024-12356 — rapid7.com
  124. PostgreSQL CVE-2025-1094: Quoting APIs SQL Injection — postgresql.org
  125. LangChain framework hit by several worrying security issues here's what we know — msn.com
  126. LangChain framework hit by several worrying security issues here's what we know — msn.com
  127. U.S. CISA adds a flaw in BerriAI LiteLLM to its Known Exploited Vulnerabilities catalog — securityaffairs.com
  128. CVE-2026-42208: Pre-Authentication SQL Injection in LiteLLM Exposes API Credentials — securityboulevard.com
  129. CVE-2026-42208: Critical Pre-Auth SQL Injection in LiteLLM Actively Exploited Within 36 Hours of Disclosure — rescana.com
  130. CVE-2026-42208: LiteLLM SQL Injection Leaks Upstream API Keys — abhs.in
  131. CVE-2026-42208: LiteLLM bug exploited 36 hours after its disclosure — securityaffairs.com
  132. LiteLLM exploited within 36 hours of disclosure via SQL injection bug — scworld.com
  133. Fresh LiteLLM Vulnerability Exploited Shortly After Disclosure — securityweek.com
  134. LiteLLM CVE-2026-42208 SQL Injection Exploited within 36 Hours of Disclosure — thehackernews.com
  135. Hackers are exploiting a critical LiteLLM pre-auth SQLi flaw — bleepingcomputer.com
  136. Favorite tweet by @harshbothra_ — twitter.com
  137. SQLMap Cheat Sheet: Commands, Options, and Advanced Features — stationx.net
  138. SQL Injection Cheat Sheet - Invicti — invicti.com
  139. New "LeakyLooker" Flaws in Google Looker Studio Could Enable Cross-Tenant SQL Queries — thehackernews.com
  140. Making A SQLi Lab Is Not Difficult, Build One With Me. — infosecwriteups.com
  141. SQL Injection in 2026: It Took One Apostrophe — udayshelke17-40981.medium.com
  142. How I Found Multiple SQL Injections in 5 Minutes in Bug Bounty — medium.com
  143. pgAdmin 4 Released With Fixes for Seven Security Vulnerabilities and New Features — cybersecuritynews.com
  144. pgAdmin 4 Released with Patches for Seven Vulnerabilities and Feature Enhancements — gbhackers.com
  145. New pgAdmin 4 Version Patches Seven Security Flaws and Adds Features — cyberpress.org
  146. CVE-2026-9082: PostgreSQL SQL Injection in Drupal — yeswehack.com
  147. 700 education and tech websites hijacked in huge ClickFix malware campaign — malwarebytes.com
  148. Critical Roundcube Flaw Allows Attackers to Inject SQL Queries — cyberpress.org
  149. Roundcube Webmail Vulnerability Allows Hackers to Execute Malicious SQL Queries — gbhackers.com
  150. Critical Roundcube Webmail Vulnerability Let Attackers Inject SQL Queries — cybersecuritynews.com
  151. Ghost CMS Vulnerability Exploited to Hack Over 700 Websites — oodaloop.com
  152. CISA Warns of Drupal Core SQL Injection Vulnerability Exploited in Attacks — cybersecuritynews.com
  153. Ghost CMS SQL injection flaw exploited in large-scale ClickFix campaign — bleepingcomputer.com
  154. Ghost CMS Mass Compromised via CVE-2026-26980 Now Fueling ClickFix Attacks — blog.xlab.qianxin.com
  155. Two vulnerabilities found in popular WordPress plugin Avada Builder — scworld.com
  156. Avada Builder Flaws Expose One Million WordPress Sites — infosecurity-magazine.com
  157. Bug hunter tracks down three serious MCP database flaws one left unpatched — theregister.com
  158. SAP Patches Critical SQL injection Vulnerability in SAP S/4HANA — cybersecuritynews.com
  159. SAP Releases Patch for Critical SQL Injection Flaw in S/4HANA — gbhackers.com
  160. SAP Patches Critical SQL Injection Flaw in SAP S/4HANA — cyberpress.org
  161. ProFTPDs SQL Injection Vulnerability Enables Remote Code Execution Attacks — cybersecuritynews.com
  162. 38 Vulnerabilities Found in OpenEMR Medical Software — securityweek.com
  163. LiteLLM Contains Critical SQL Injection Vulnerability — letsdatascience.com
  164. NoSQL Injection: Advanced Exploitation Guide — intigriti.com
  165. Exploits Explained: NoSQL Injection Returns Private Information — synack.com
  166. CVE-2025-52694 PoC: Critical SQL Injection in Advantech IoTSuite/SaaS-Composer — github.com
  167. MCP Vulnerability Case Study: SQL Injection in the Postgres MCP Server — securitylabs.datadoghq.com
  168. BWAFSQLi: Bypassing Web Application Firewall with Adversarial SQL Injections — dl.acm.org
  169. CVE-2025-26794: Blind SQL Injection in Exim 4.98 — Writeup — github.com
  170. April 2026 Patch Tuesday: Critical Vulnerabilities in SAP Adobe Microsoft SharePoint Fortinet and ColdFusion Threaten Enterprise Security — rescana.com
  171. Exploiting SQL Injection Vulnerability - Bug Bounty Writeup — medium.com
  172. SAP Security Patch Day April 2026: Critical Vulnerabilities CVSS 9.9 SQL Injection and Authorization Risks — erp.today
  173. CISA Warns of Fortinet SQL Injection Vulnerability Actively Exploited in Attacks — cybersecuritynews.com
  174. SAP Patch Day Fixes Critical SQL Injection DoS and Code Injection Flaws — gbhackers.com
  175. SAP Patch Day Fixes Critical SQL Injection DoS and Code Injection Flaws — cyberpress.org
  176. SAP Patch Day Fixes Critical SQL Injection DoS and Code Injection Flaws — cyberpress.org
  177. 400K WordPress Sites Exposed by Elementor Ally Plugin SQL Flaw — esecurityplanet.com
  178. SQL Injection Security Vulnerabilities — cvedetails.com
  179. CVE Search: SQL Injection — cve.org
  180. Claude Code Executes SQL Injection via CLAUDE.md — letsdatascience.com
  181. Multiple SonicWall Vulnerabilities Enable SQL Injection and Privilege Escalation — cyberpress.org
  182. SQL Injection (SQLi) Guide - SecPortal — secportal.io
  183. CVE-2026-5197: Student Membership System SQLi Vulnerability — sentinelone.com
  184. Bug Bounty Bootcamp #29: Boolean Blind SQL Injection Part 2 — infosecwriteups.com
📚 This guide is synthesized from the full text of resources curated in the SQLi library, and refreshed as new material is added.