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

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

缺陷编号:wooyun-2014-060133

漏洞标题:ThinkSNS水平权限问题

相关厂商:ThinkSNS

漏洞作者: Ano_Tom

提交时间:2014-05-10 10:03

修复时间:2014-08-05 10:04

公开时间:2014-08-05 10:04

漏洞类型:设计缺陷/逻辑错误

危害等级:中

自评Rank:10

漏洞状态:漏洞已经通知厂商但是厂商忽略漏洞

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2014-05-10: 细节已通知厂商并且等待厂商处理中
2014-05-15: 厂商主动忽略漏洞,细节向第三方安全合作伙伴开放
2014-07-09: 细节向核心白帽子及相关领域专家公开
2014-07-19: 细节向普通白帽子公开
2014-07-29: 细节向实习白帽子公开
2014-08-05: 细节向公众公开

简要描述:

ThinkSNS某处存在水平权限问题,未对用户的操作进行权限认证,导致越权访问,删除任意用户信息

详细说明:

看过之前乌云白帽子发的关于水平权限的问题,貌似很多。重新看了下,好多都没修复。发个没有重复的。测试版本:4.18号官网下载的版本。
漏洞文件:/thinksns/apps/weba/Lib/Action/GroupAction.class.php
说明,index文件应该是group文件的完善更新版?
代码:

/**
* 执行编辑帖子
* @return void
*/
//水平权限缺陷02
public function doPostEdit(){
// echo 2;die;
$checkContent = str_replace(' ', '', $_POST['content']);
$checkContent = str_replace('<br />', '', $checkContent);
$checkContent = str_replace('<p>', '', $checkContent);
$checkContent = str_replace('</p>', '', $checkContent);
$checkContents = preg_replace('/<img(.*?)src=/i','img',$checkContent);
$checkContents = preg_replace('/<embed(.*?)src=/i','img',$checkContents);
if(strlen(t($_POST['title']))==0) $this->error('帖子标题不能为空');
if(strlen(t($checkContents))==0) $this->error('帖子内容不能为空');
preg_match_all('/./us', t($_POST['title']), $match);
if(count($match[0])>30){ //汉字和字母都为一个字
$this->error('帖子标题不能超过30个字');
}
$post_id = intval($_POST['post_id']);
$data['title'] = t($_POST['title']);
$data['content'] = h($_POST['content']);
$res = D('weiba_post')->where('post_id='.$post_id)->save($data);//直接提交post_id即可编辑任意帖子,未进行权限认证
if($res!==false){
$post_detail = D('weiba_post')->where('post_id='.$post_id)->find();
if(intval($_POST['log'])==1){
D('log')->writeLog($post_detail['weiba_id'],$this->mid,'编辑了帖子“<a href="'.U('weiba/Index/postDetail',array('post_id'=>$post_id)).'" target="_blank">'.$post_detail['title'].'</a>”','posts');
}
//同步到微博
$feedInfo = D('feed_data')->where('feed_id='.$post_detail['feed_id'])->find();
$datas = unserialize($feedInfo['feed_data']);
$datas['content'] = '【'.$data['title'].'】'.getShort(t($checkContent),100).' ';
$datas['body'] = $datas['content'];
$data1['feed_data'] = serialize($datas);
$data1['feed_content'] = $datas['content'];
$feed_id = D('feed_data')->where('feed_id='.$post_detail['feed_id'])->save($data1);
model('Cache')->rm('fd_'.$post_detail['feed_id']);
return $this->ajaxReturn($post_id, '编辑成功', 1);
}else{
$this->error('编辑失败');
}
}


其中doPostEdit操作未对权限认证,导致可以修改微吧里的任意帖子
起始状态如下

4a32db82-5beb-4b4d-92bc-ec3dcf2724bc.png


数据库信息为

3d360691-fab6-4f95-831a-44b176454bcf.png


post_id=5内容为test02的,post_id=4内容为test01的
test02修改自己的帖子,拦截post请求如下

463f10fa-81bd-48ee-8954-893cd81568b6.png


修改test01的帖子,即post_id=4如图

212c021c-3c89-4168-b6f8-e1d687573743.png


结果为

2cdb4753-10a7-4b22-ba02-052d1c9c83fa.png


同时有删除任意帖子的漏洞(白帽之前提交的未修复, WooYun: ThinkSNS SQL注入及越权
代码:

/**
* 删除帖子
* @return void
*/
public function postDel(){
$post_id = intval($_POST['post_id']);//修复了注入问题
// 水平权限缺陷01

if(D('weiba_post')->where('post_id='.$post_id)->setField('is_del',1)){
if(intval($_POST['log'])==1){
$post_detail = D('weiba_post')->where('post_id='.$post_id)->find();
D('log')->writeLog($post_detail['weiba_id'],$this->mid,'删除了帖子“'.$post_detail['title'].'”','posts');
}
D('weiba')->where('weiba_id='.intval($_POST['weiba_id']))->setDec('thread_count');
echo 1;
}
}


初始状态:

4d3a04d0-61bf-4eb9-99c3-b2cafbcf40fd.png


越权删除test01的帖子

7b26c96c-b689-4b6a-98fc-a715904f6f87.png


结果为

5972993a-9f53-420a-9a91-01d0ebcab7b5.png

漏洞证明:

如上详细描述。
同时/thinksns/apps/weba/Lib/Action/LogAction.class.php文件中多处,也未修复(之前白帽白帽提交的 WooYun: ThinkSNS某功能平行权限3 )。

修复方案:

分清楚用户有哪些action,在执行该私有的action时,是否进行了check permission:)

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


漏洞回应

厂商回应:

危害等级:无影响厂商忽略

忽略时间:2014-08-05 10:04

厂商回复:

最新状态:

暂无