2014-01-17: 细节已通知厂商并且等待厂商处理中 2014-01-21: 厂商已经确认,细节仅向厂商公开 2014-01-24: 细节向第三方安全合作伙伴开放 2014-03-17: 细节向核心白帽子及相关领域专家公开 2014-03-27: 细节向普通白帽子公开 2014-04-06: 细节向实习白帽子公开 2014-04-17: 细节向公众公开
ThinkSNS某功能平行权限
问题发生在微吧模块代码apps\weiba\index.action.phppublic 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).' '; $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
判断一下权限!
危害等级:中
漏洞Rank:10
确认时间:2014-01-21 14:34
非常感谢这位认真的白帽,临近假期响应慢了!
暂无