Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Bug]: anzhiyu主题开启algolia搜索功能存在xss漏洞 #200

Open
fatboyer opened this issue Feb 9, 2024 · 1 comment
Open

[Bug]: anzhiyu主题开启algolia搜索功能存在xss漏洞 #200

fatboyer opened this issue Feb 9, 2024 · 1 comment

Comments

@fatboyer
Copy link

fatboyer commented Feb 9, 2024

使用的 AnZhiYu 版本? | What version of AnZhiYu are you use?

1.6.12

使用的浏览器? || What browse are you using?

Chrome

是否修改过主题文件? || Has the theme files been modified?

不是 (No)

使用的系统? || What operating system are you using?

Windows

问题描述 | Describe the bug

1、hexo博客搭建

  • 安装node.js和git

image-20240209185304043

  • hexo博客框架安装

    npm install hexo-cli -g
    hexo init blog
    cd blog
    npm install
    hexo server

2、更换anzhiyu主题

  • 下载anzhiyu主题到themes目录

    git clone https://github.com/anzhiyu-c/hexo-theme-anzhiyu.git ./themes/anzhiyu

  • 更改配置文件,将themes/anzhiyu/目录下的__config.yml文件名修改为_config.anzhiyu.yml。并将修改后的_config.anzhiyu.yml移动到blog目录下(和themes目录同级)。
    image-20240209191312330

  • 修改_config.yml文件中的theme为anzhiyu
    image-20240209191421389

  • 如果你没有 pug 以及 stylus 的渲染器,请下载安装:

    npm install hexo-renderer-pug hexo-renderer-stylus --save

  • 保存,启动hexo server

3、开启algolia评论系统

根据官方文档中的搜索系统配置,开启algolia配置。官方链接:

https://vcl-docs.anheyu.com/advanced/#%E6%90%9C%E7%B4%A2%E7%B3%BB%E7%BB%9F
image-20240209192052895

4、漏洞复现

image-20240209192334069
image-20240209193059206

在多个使用anzhiyu主题及开启algolia搜索的博主网站中都有此xss漏洞。 <img src=1 onerror=alert(132)>
即可触发漏洞,如下:

https://blog.anheyu.com/

https://ichika.cc/

https://www.fomal.cc/

https://zoulicheng.cn/

https://zhsher.cn/

…………

几乎所有使用algolia搜索的网站中都有次xss漏洞。

5、漏洞分析

原因在于algolia.js中对于搜索结果的回显没有过滤。
image-20240209194148822

也就是说不管输入什么内容都在在结果区域回显。动态调试下js代码:
image-20240209195655327

image-20240209195955415

修补建议:针对搜索输出进行的过滤

出现问题的网站 | Website

https://blog.anheyu.com/ https://ichika.cc/ https://www.fomal.cc/ https://zoulicheng.cn/ https://zhsher.cn/ …………

@W1ndys
Copy link

W1ndys commented Feb 9, 2024

同网安
大佬,好强,学习一下

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants