Discuz v3.4 排行页面存储型XSS漏洞分析
source link: https://chybeta.github.io/2018/10/15/Discuz-v3-4-%E6%8E%92%E8%A1%8C%E9%A1%B5%E9%9D%A2%E5%AD%98%E5%82%A8%E5%9E%8BXSS%E6%BC%8F%E6%B4%9E%E5%88%86%E6%9E%90/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Discuz v3.4 排行页面存储型XSS漏洞分析
2018年10月12日,Discuz官方修复了一处XSS漏洞:
source/module/misc/misc_ranklist.php:166
Dz在此处获取到$member['note']
后调用了dhtmlspecialchars
进行过滤,在source/function/function_core.php:203 会对’&’, ‘“‘, ‘<’, ‘>’进行实体编码。
从getranklist_members
返回后 source/include/misc/misc_ranklist_index.php:113
进行模板的渲染在 data/template/1_diy_ranklist_ranklist.tpl.php:32
可以看到在tip
属性中输出了$memberlist['0']['note']
。在之前有一个onmouseover
事件,跟入showTip(trhis)
在 static/js/common.js:1062
跟入_showTip
,在 static/js/common_extra.js:912
通过ctrlobj.getAttribute('tip')
获取tip属性的值,由于getAttribute
获取的内容会自动反转义,即前面在dhtmlspecialchars
编码过的内容又被解码了一次。此后拼接到div标签的innerHTML
中,最后输出到页面上造成了xss
关于getAttribute
,可以用下面代码测试:
该CMS中,排行榜功能是默认开启的。在地址 http://127.0.0.1/misc.php?mod=ranklist&type=member 的上榜宣言中输入payload(拒绝伸手党)
在 http://127.0.0.1/misc.php?mod=ranklist 当鼠标移动到头像上触发onmouseover
事件,执行xss
多增加一次dhtmlspecialchars
。
点击图片放大,扫码知识星球【漏洞百出】
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK