漏洞详情

披露状态:

2014-01-17: 细节已通知厂商并且等待厂商处理中
2014-01-21: 厂商已经确认,细节仅向厂商公开
2014-01-24: 细节向第三方安全合作伙伴开放
2014-01-31: 细节向核心白帽子及相关领域专家公开
2014-02-10: 细节向普通白帽子公开
2014-03-02: 细节向实习白帽子公开
2014-04-17: 细节向公众公开

简要描述:

ThinkSNS某功能平行权限

详细说明:

问题发生在微吧模块

代码apps\weiba\index.action.php



public function postEdit() 这个方法有判断权限

不过到了代码

行561这里并没有判断被编辑的帖子是否是当前用户发的!

public function doPostEdit(){
$weiba = D('weiba_post')->where('post_id='.intval($_POST['post_id']))->field('weiba_id,attach')->find();
if ( !CheckWeibaPermission( '' , $weiba['weiba_id'] ,'weiba_edit') ){
if ( !CheckPermission('weiba_normal','weiba_edit') ){
$this->error('对不起,您没有权限进行该操作!',true);
}
}
$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('帖子标题不能为空',true);
if(strlen(t($checkContents))==0) $this->error('帖子内容不能为空',true);
preg_match_all('/./us', t($_POST['title']), $match);
if(count($match[0])>30){ //汉字和字母都为一个字
$this->error('帖子标题不能超过30个字',true);
}
$post_id = intval($_POST['post_id']);
$data['title'] = t($_POST['title']);
$data['content'] = h($_POST['content']);
$data['attach'] = '';
if ( $_POST['attach_ids'] ){
$attach = explode('|', $_POST['attach_ids']);
foreach ( $attach as $k=>$a){
if ( !$a ){
unset($attach[$k]);
}
}
$attach = array_map( 'intval' , $attach);
$data['attach'] = serialize($attach);
}
$res = D('weiba_post')->where('post_id='.$post_id)->save($data);
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).'&nbsp;';
$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('编辑失败',true);
}
}



漏洞证明:

第一步 用普通帐号

发布一个帖子

然后编辑

访问

/index.php?app=weiba&mod=Index&act=postEdit&post_id=1

thinksns_pxqx_1.jpg





thinksns_pxqx_2.jpg

修复方案:

判断一下权限!

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


漏洞回应

厂商回应:

危害等级:中

漏洞Rank:10

确认时间:2014-01-21 14:34

厂商回复:

非常感谢这位认真的白帽,临近假期响应慢了!

最新状态:

暂无


漏洞评价: