ThinkSNS某功能平行权限漏洞

基本字段

漏洞编号:
SSV-94263
披露/发现时间:
2014-01-17
提交时间:
2014-01-17
漏洞等级:
漏洞类别:
其他类型
影响组件:
ThinkSNS
漏洞作者:
齐迹
提交者:
Knownsec
CVE-ID:
补充
CNNVD-ID:
补充
CNVD-ID:
补充
ZoomEye Dork:
补充

来源

漏洞详情

贡献者 Knownsec 共获得  0KB

简要描述:

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

共 0  兑换了

PoC

暂无 PoC

参考链接

解决方案

临时解决方案

暂无临时解决方案

官方解决方案

暂无官方解决方案

防护方案

暂无防护方案

人气 734
评论前需绑定手机 现在绑定

暂无评论

※本站提供的任何内容、代码与服务仅供学习,请勿用于非法用途,否则后果自负