Catfish(鲶鱼) Blog V1.3.15存储型 xss

Catfish(鲶鱼) Blog前台文章评论处存在 存储型xss漏洞。
application\index\controller\index.php 文件第 692

public function pinglun()
{
$beipinglunren = Db::name('posts')->where('id',Request::instance()-
>post('id'))->field('post_author')->find();
$comment = Db::name('options')->where('option_name','comment')-
>field('option_value')->find();
$plzt = 1;
if($comment['option_value'] == 1)
{
$plzt = 0;
} $
uid = 0;
if(Session::has($this->session_prefix.'user_id'))
{
$uid = Session::get($this->session_prefix.'user_id');
} $
data = [
'post_id' => Request::instance()->post('id'),
'url' => 'index/Index/article/id/'.Request::instance()->post('id'),
'uid' => $uid,
'to_uid' => $beipinglunren['post_author'],
'createtime' => date("Y-m-d H:i:s"),
'content' => $this->filterJs(Request::instance()->post('pinglun')),
'status' => $plzt
];
Db::name('comments')->insert($data);
Db::name('posts')
->where('id', Request::instance()->post('id'))
->update([
'post_comment' => date("Y-m-d H:i:s"),
'comment_count' => ['exp','comment_count+1']
]);
$param = '';
Hook::add('comment_post',$this->plugins);
Hook::listen('comment_post',$param,$this->ccc);
}

跟走filterjs函数

    protected function filterJs($str)
    {
        while(stripos($str,'<script') !== false || stripos($str,'<style') !== false || stripos($str,'<iframe') !== false || stripos($str,'<frame') !== false || stripos($str,'onclick') !== false)
        {
            $str = preg_replace(['/<script[\s\S]*?<\/script[\s]*>/i','/<style[\s\S]*?<\/style[\s]*>/i','/<iframe[\s\S]*?[<\/iframe|\/][\s]*>/i','/<frame[\s\S]*?[<\/frame|\/][\s]*>/i','/on[A-Za-z]+[\s]*=[\s]*[\'|"][\s\S]*?[\'|"]/i'],'',$str);
        }
        return $str;
    }

看一下这里的逻辑,判断字符串是否存在 <script <style <iframe <frame onclick
果存在就进行替换。那么我们提交的payload 只要不存在 上面判断的几个字符串就可以绕过。
漏洞复现: 前台页面找一篇文章,进行评论。评论加入超链接,这里因为有前端过滤所以不能直接输入
payload,随便填写,然后F12修改超链接地址为 xsspayload <a target="_self"
href="javascript:onmouseover=alert(123)">http://javascript:onmouseover=alert(123).c
</a> 这样就绕过了前端认证,提交评论。

 

 访问文章点击触发xss

 

 直接传入javascript:onmouseover=alert('123')的话会被加入<p>标签,所以插入a标签构造超链接

 

posted @ 2021-08-29 21:36  C10ud  阅读(129)  评论(0编辑  收藏  举报