精选国内外互联网行业最新文章及报告,让网友获得最新的海内外互联网动态
当前位置:主页 > 互联网 > 网络安全 >

cmseasy最新版(20140718)存储型XSS盲打后台

2015-01-20 11:41 来源: 编辑:admin
CmsEasy

存储型XSS可以盲打后台~

/lib/table/stats.php 13行getbot函数:

 

public static function getbot() {
        $ServerName = $_SERVER["SERVER_NAME"];
        $ServerPort = $_SERVER["SERVER_PORT"];
        $ScriptName = $_SERVER["SCRIPT_NAME"];
        $QueryString = $_SERVER["QUERY_STRING"];
        $serverip = $_SERVER["REMOTE_ADDR"];
        $GetLocationURL=self::geturl();
        $agent1 = $_SERVER["HTTP_USER_AGENT"];
        $agent=strtolower($agent1);
        $Bot="";
        if(strpos($agent,"googlebot")>-1) {
            $Bot = "Google";
        }
        if(strpos($agent,"mediapartners-google")>-1) {
            $Bot = "Google Adsense";
        }
        if(strpos($agent,"baiduspider")>-1) {
            $Bot = "Baidu";
        }
        if(strpos($agent,"sogou")>-1) {
            $Bot = "Sogou";
        }
        if(strpos($agent,"yahoo")>-1) {
            $Bot = "Yahoo!";
        }
        if(strpos($agent,"msn")>-1) {
            $Bot = "MSN";
        }
        if(strpos($agent,"soso")>-1) {
            $Bot = "Soso";
        }
        if(strpos($agent,"iaarchiver")>-1) {
            $Bot = "Alexa";
        }
        if(strpos($agent,"sohu")>-1) {
            $Bot = "Sohu";
        }
        if(strpos($agent,"sqworm")>-1) {
            $Bot = "AOL";
        }
        if(strpos($agent,"yodaobot")>-1) {
            $Bot = "Yodao";
        }
        if(strpos($agent,"iaskspider")>-1) {
            $Bot = "Iask";
        }
        if(strlen($Bot)>0 &&!front::get('admin_dir')) {
            $stats = self::getInstance();
            $insert = $stats->rec_insert(array('bot'=>$Bot,'url'=>$GetLocationURL,'ip'=>$serverip,'time'=>date('Y-m-d H:i:s')));
        }
    }



直接将$GetLocationURL插入数据库,我们看看$GetLocationURL从哪来的,geturl()函数:
 

public static function geturl() {
        if(!empty($_SERVER["REQUEST_URI"])) {
            $scrtName = $_SERVER["REQUEST_URI"];
            $nowurl = $scrtName;
        }else {
            $scrtName = $_SERVER["PHP_SELF"];
            if(empty($_SERVER["QUERY_STRING"])) {
                $nowurl = $scrtName;
            }else {
                $nowurl = $scrtName."?".$_SERVER["QUERY_STRING"];
            }
        }
        return (isset($_SERVER["HTTPS"])&&$_SERVER["HTTPS"] == "on")?'https://':'http://'.$_SERVER['HTTP_HOST'].$nowurl;
    }



直接获取的PHP_SELF和QUERY_STRING,没有进行过滤。

前面的360webscan也只是过滤了$_GET和$_POST等变量,没有过滤$_SERVER,可造成XSS盲打后台。

向index.php发送数据包:

 

07.jpg



注意要设置User-Agent为百度蜘蛛或其他robot。

然后后台管理员浏览“营销”->“蜘蛛统计”时即会中招:
 

08.jpg



可进行后台盲打!

修复方案:

过滤

标签
返回首页
扫描微信
返回顶部