网站地图    收藏   

主页 > 后端 > 网站安全 >

cmseasy最新版存储型XSS+代码分析(可绕过xss防护机

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

[导读] cmseasy 5 5 0 20140605bbs ajax php$data = array(); $_POST[ 39;content 39;] = unescape($_POST[ 39;content 39;]); $data[ 39;aid 39;] = isset($_POST[ 39;aid 39;])...

cmseasy 5.5.0.20140605

bbs/ajax.php

 

$data = array();
      $_POST['content'] = unescape($_POST['content']);
      $data['aid'] = isset($_POST['aid']) ? intval($_POST['aid']) : exit(0);
      $data['tid'] = isset($_POST['tid']) ? intval($_POST['tid']) : 0;
      $data['content'] = isset($_POST['content']) ? $_POST['content'] : exit(0);
      $data['username'] = isset($_COOKIE['username']) ? $_COOKIE['username'] : '';
      //$data['userid'] = $admin->userid;
      $data['addtime'] = mktime();
      $data['ip'] = $_SERVER['REMOTE_ADDR'];
      $reply = db_bbs_reply::getInstance();
      $r = $reply->inserData($data);
      if($r){
        $archive = db_bbs_archive::getInstance();
          $archive->updateClickReply($data['aid'],'replynum');
......



看到unescape 函数。
 

function unescape($str) {
$str = rawurldecode($str);
preg_match_all("/%u.{4}|&#x.{4};|&#d+;|.+/U",$str,$r);
$ar = $r[0];
foreach($ar as $k=>$v){
if(substr($v,0,2) == "%u"){
$ar[$k] = iconv("UCS-2","UTF-8",pack("H4",substr($v,-4)));
}elseif(substr($v,0,3) == "&#x"){
$ar[$k] = iconv("UCS-2","UTF-8",pack("H4",substr($v,3,-1))); 
}elseif(substr($v,0,2) == "&#"){
$ar[$k] = iconv("UCS-2","UTF-8",pack("n",substr($v,2,-1)));
}
}
return join("",$ar); 
}



有了 rawurldecode

所以提交 url格式编码数据。绕过remove_xss检测。再rawurldecode还原。即可xss

列如 %3Cscript%3Ealert(1)%3C%2Fscript%3E
 

c11.jpg


 

c5.jpg

修复方案:

修复

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

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

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

添加评论