hinesboy / mavonEditor

mavonEditor - A markdown editor based on Vue that supports a variety of personalized features
http://www.mavoneditor.com/
MIT License
6.45k stars 918 forks source link

[Bug] 存在xss漏洞 #672

Closed YouXam closed 2 years ago

YouXam commented 3 years ago

Bug 报告

编辑器在编辑模式下存在xss漏洞, 尚不清楚预览模式是否存在。

直接使用 markdown-it 渲染不会出现此漏洞, 可能是 markdown-it 版本过低

重现

编辑模式下, 在编辑框输入

<img src="xss" onerror="alert('xss')"></img>

将会出现弹窗

可能的解决方案

更新 markdown-it

希望尽快修复

YouXam commented 3 years ago

可行的解决办法:关闭 html 显示

将 src\lib\mixins\markdown.js 的第6行从html: true,修改为html: false,

漏洞出现的原因可能是没有做好 xss 过滤

ygj6 commented 3 years ago

默认不开启XSS防御,可以参考如下方式启动: https://github.com/hinesboy/mavonEditor/issues/472#issuecomment-758533523

ygj6 commented 2 years ago

v2.10.0版本已经默认开启,该漏洞在2.8.2就已经修复,关闭issue