当前位置:首页 > 叨叨念念 > Emlog评论Bug可绕过评论审核直接发布

Emlog评论Bug可绕过评论审核直接发布

叨叨念念 / 星之宇 / 2023-8-23 19:54 / 浏览:4927 / 评论:0

Bug描述

Emlog注册会员后台可以通过后台评论回复评论的接口doreply伪造Post数据,可以绕过评论审核,直接发布评论到文章下,包含不存在的文章。


Bug影响

中度影响,如果发布违规信息,会有关站风险。


Bug修复

1、修复评论审核,修改路径admin/comment.php文件。

    if ($hide == 'y') {
        $Comment_Model->showComment($commentId);
        $hide = 'n';
    }
    //下面增加以下语句,大概在101行
    $hide = Option::get('ischkcomment') == 'y' && !User::haveEditPermission() ? 'y' : 'n';


2、修复发布评论到不存在的文章,修改include/model/comment_model.php的replyComment函数如下。(判断文章是否存在)

    function replyComment($blogId, $pid, $content, $hide) {
        $User_Model = new User_Model();
        $user_info = $User_Model->getOneUser(UID);
        $Log_Model = new Log_Model();
        $log_info = $Log_Model->getOneLogForHome($blogId);//获取文章信息
        if (!empty($user_info)&&!empty($log_info)) {
            $name = addslashes($user_info['name_orig']);
            $mail = addslashes($user_info['email']);
            $url = addslashes(BLOG_URL);
            $ipaddr = getIp();
            $utctimestamp = time();
            if ($pid != 0) {
                $comment = $this->getOneComment($pid);
                $content = '@' . addslashes($comment['poster']) . ':' . $content;
            }
            $this->db->query("INSERT INTO " . DB_PREFIX . "comment (date,poster,gid,comment,mail,url,hide,ip,pid)
                    VALUES ('$utctimestamp','$name','$blogId','$content','$mail','$url','$hide','$ipaddr','$pid')");
            $this->updateCommentNum($blogId);
        }
    }

注意:以上为临时方案,等待官方修复。

目前有 0 条评论

    • 昵称
    • 邮箱
    • 网址