一个容易被忽视的技巧—MySQL 绕过防注入
2014-01-04 15:40
609 查看
一个容易被忽视的技巧—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 语句就不执行了。。。哟西,再截一个图:
然后接下来如何操作来填充其他字符来绕过防火墙就看大家的想象力了,抛砖引玉就到这里 了。
这个方法应该我想应该也有很多人知道了,只是没有人写出来,偷偷的告诉你们,这个
方法可以绕过很多 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 语句就不执行了。。。哟西,再截一个图:
然后接下来如何操作来填充其他字符来绕过防火墙就看大家的想象力了,抛砖引玉就到这里 了。
相关文章推荐
- mysql注入绕过的一些技巧
- for循环一个容易被忽视的问题
- MySQL注入技巧性研究
- MySQL注入绕开过滤的技巧总结
- 从偶然的机会发现一个mysql特性到wooyun waf绕过题
- 一个注册表键值HKLM/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters, SearchList项,容易被忽视的设置错误。
- 一个容易被忽视的 strlen 细节(转)
- 一个容易忽视的Oracle安全问题
- mysql无逗号的注入技巧
- mysql注入绕过tips
- 一个容易忽视的存储过程问题
- 一个容易被人遗忘的管理技巧
- C++中一个容易被忽视的名字查找规则
- 在Oracle中建表时容易忽视的一个小问题
- C++中一个容易被忽视的名字查找规则
- 8位单片机中一个容易被忽视的溢出问题
- Wise Installation 9 的一个容易忽视的选项
- 一个容易忽视的存储过程问题
- 网站检测之防注入绕过的十一种技巧
- 一个容易被忽视的 strlen 细节