当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2015-0164546

漏洞标题:ThinkSAAS最新版2.4 Xss漏洞 指谁打谁

相关厂商:thinksaas.cn

漏洞作者: 麦兜

提交时间:2015-12-28 16:39

修复时间:2016-02-09 23:29

公开时间:2016-02-09 23:29

漏洞类型:XSS 跨站脚本攻击

危害等级:高

自评Rank:15

漏洞状态:厂商已经确认

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-12-28: 细节已通知厂商并且等待厂商处理中
2015-12-28: 厂商已经确认,细节仅向厂商公开
2016-01-07: 细节向核心白帽子及相关领域专家公开
2016-01-17: 细节向普通白帽子公开
2016-01-27: 细节向实习白帽子公开
2016-02-09: 细节向公众公开

简要描述:

thinksaas2.4+php2.6+apache2 未过滤
感谢@xfkxfk

详细说明:

先看消息写入代码:
/var/www/html/thinksaas/app/user/action/message.php

case "do":

$msg_userid = $userid;
$msg_touserid = intval($_POST['touserid']);
$msg_content = tsFilter($_POST['content']); //用tsFilter过滤

aac('system')->antiWord($msg_content); //过滤垃圾词

aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content);

//发送消息
public function sendmsg($userid,$touserid,$content){

$userid = intval($userid);

$touserid = intval($touserid);

$content = str_replace(SITE_URL,'[SITE_URL]',$content);

$content = addslashes(trim($content));

if($touserid && $content){

$messageid = $this->create('message',array(
'userid' => $userid,
'touserid' => $touserid,
'content' => $content,
'addtime' => time(),
));

}
}


}
×/
header("Location: ".tsUrl('message','my'));

break;
}


/var/www/html/thinksaas/thinksaas/tsFunction.php

function tsFilter($value) {
$value = trim($value);
//定义不允许提交的SQl命令和关键字
$words = array();
$words[] = "add ";
$words[] = "and ";
$words[] = "count ";
$words[] = "order ";
$words[] = "table ";
$words[] = "by ";
$words[] = "create ";
$words[] = "delete ";
$words[] = "drop ";
$words[] = "from ";
$words[] = "grant ";
$words[] = "insert ";
$words[] = "select ";
$words[] = "truncate ";
$words[] = "update ";
$words[] = "use ";
$words[] = "--";
$words[] = "#";
$words[] = "group_concat";
$words[] = "column_name";
$words[] = "information_schema.columns";
$words[] = "table_schema";
$words[] = "union ";
$words[] = "where ";
$words[] = "alert";
$value = strtolower($value);
//转换为小写
foreach ($words as $word) {
if (strstr($value, $word)) {
$value = str_replace($word, '', $value);
}
}
return $value;
}


可以看到只过滤了一些sql注入关键字,问题是仅仅过滤了一遍。继续来看取出有没有过滤
/var/www/html/thinksaas/app/message/action/my.php

<?php
defined('IN_TS') or die('Access Denied.');
$arrMsg = $new['message']->findAll('message',array(
'touserid'=>$strUser['userid'],
'isread'=>'0',
));
foreach($arrMsg as $key=>$item){ //可以看到没编码也没过滤
$arrMsg[$key]['content'] = str_replace('[SITE_URL]',SITE_URL,$item['content']);
if($item['userid']){
$arrMsg[$key]['user'] = aac('user')->getOneUser($item['userid']);
}
}
$title = '我的消息盒子';
include template("my");


漏洞证明:

th1.png


th2.png


th4.png


th5.png

修复方案:

编码过滤

版权声明:转载请注明来源 麦兜@乌云


漏洞回应

厂商回应:

危害等级:中

漏洞Rank:10

确认时间:2015-12-28 23:03

厂商回复:

感谢反馈,已经修复。

最新状态:

暂无