一个容易被忽视的技巧—MySQL 绕过防注入

一个容易被忽视的技巧—MySQL 绕过防注入


这个方法应该我想应该也有很多人知道了,只是没有人写出来,偷偷的告诉你们,这个
方法可以绕过很多 web 防火墙,话说从现在之后能不能绕过我就不知道了,哈哈。但是该方 法的局限就是只适合在 MYSQL 上,其他数据库貌似不支持。转入正题:
首先来看 MySQL 的官方文档
<a href="http://dev.mysql.com/doc/refman/5.1/en/comments.%3Ca%20href=" http:="" www.2cto.com="" kf="" qianduan="" css="" "="" target="_blank" class="keylink" style="color: rgb(51, 51, 51); text-decoration: none;">html">http://dev.mysql.com/doc/refman/5.1/en/comments.html


上面的详细信息大家自己去看了,下面我来讲一些关键的部分:
/*! MySQL-specific code */
一、

In this case, MySQL Server parses and executes the code within the comment as it would any other SQL statement, but other SQL servers will ignore the extensions. For example, MySQL Server recognizes theSTRAIGHT_JOIN keyword in the following statement, but
other servers will not:
SELECT /*! STRAIGHT_JOIN */ col1 FROM table1,table2 WHERE ...
二、

If you add  a version  number  after the “!” character, the syntax within the comment is executed only if the MySQL version is greater than or equal to the specified version number. The TEMPORARY keyword in the following comment is executed only by servers
from MySQL 3.23.02 or higher:
CREATE /*!32302 TEMPORARY */ TABLE t (a INT);

The comment syntax just described applies to how the  mysqld server parses SQL statements. The mysql client program also performs some parsing of statements before sending them to the server. (It does this to determine statement boundaries within a multiple-statement input line.)
Comments in this format, /*!12345 ... */, are not stored on the server. If this format is used to comment stored routines, the comments will not be retained on the server.
The use of short-form  mysql commands such as C within multi-line /* ...

*/ comments is not supported.

 

第一部分主要讲的意思是,MYSQL 在遇到/*!  SQL 语句*/这种格式的时候,里面的 SQL
语句会当正常的语句一样被解析,如图:
 
 \

以上我们可以看到 where id=1 部分被 mysql 解析了。

第二部分: /*!12345 SQL 语句*/
翻译:如果在!之后是一串数字(这串数字就是 mysql 数据库的版本号),如果当前数据库的 版本号大于等于该数字,SQL 语句则执行,否则就不执行,如图:

 \


我用的 MYSQL 是 5.1.57,当我刚好用 50157 这个版本号的时候,where 语句执行了,当版本
 
号大于我使用的版本号时,where 语句就不执行了。。。哟西,再截一个图:

 \

然后接下来如何操作来填充其他字符来绕过防火墙就看大家的想象力了,抛砖引玉就到这里 了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值