Chybeta

ASISCTF2017-GSA File Server-writeup

ASISCTF2017-GSA File Server-writeup
docx-xxe漏洞

Task

1
2
3
GSA's file server, go find the hole, drill it and grab the flag :)
Note that Scope is 128.199.40.185:*
Alert: No remote brute force and automated scanning are needed.

Solution

查看源代码,发现有 functionds.js

1
2
3
4
5
6
7
8
9
10
11
12
$( document ).ready(function(){
$("#files").click(function(){
$.get('/showFiles', function(data){
var myArray = $.parseJSON(data);
for(var i=0; i<myArray.length; i++) {
console.log(myArray[i])
$("#results").append('<a href="files/'+myArray[i]+'"><img src="/images/file-icon.png" width="50" height="50" alt="" border="0"/></a>');
}
})
})
});

当在页面上的图片(它id为files)点击时,它会向 http://128.199.40.185/showFiles 发送GET请求,并将返回的结果加到页面中。点击后即可下载文件,下载链接为 http://128.199.40.185/files/demo.docx

点击页面的图片(id为files),用burp抓包,查看返回头部;

在Response包中,多了Directory: .,消息主体为["demo.docx"],看上去是指当前目录(即 ./ )下有一个文件名为demo.docx。尝试指定Directory字段为..,这样表示上一级目录(即 ../ ):

不过翻来翻去,好像莫啥用。题目给的网址是 128.199.40.185:* ,注意端口并没有指定,用nmap扫扫:

1
nmap -T4 -A -v 128.199.40.185

扫描结果大致如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Nmap scan report for 128.199.40.185
Host is up (0.20s latency).
Not shown: 995 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh (protocol 2.0)
|_ssh-hostkey: ERROR: Script execution failed (use -d to debug)
80/tcp open http Apache httpd 2.4.25 ((Ubuntu))
|_http-methods: No Allow or Public header in OPTIONS response (status code 200)
|_http-title: GSA File Server
139/tcp open netbios-ssn Samba smbd 3.X (workgroup: WEB-01)
445/tcp open netbios-ssn Samba smbd 3.X (workgroup: WEB-01)
8081/tcp open http Apache httpd 2.4.25 ((Ubuntu))
|_http-methods: No Allow or Public header in OPTIONS response (status code 200)
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).

除了80端口外,8081端口也运行着web服务,访问:http://128.199.40.185:8081/ 没啥信息。
结合前面利用burp探测得到的目录结构,我们访问:http://128.199.40.185:8081/panelManager-0.1/ 。有一个上传功能:

经过初步尝试,结合前面file文件里的demo.docx文件,可以联想到XXE漏洞,关于word的xxe,可以看看exploiting-xml-entity-vulnerabilities-in-file-parsing-functionality。接下来创建包含有xxe-payload的word文档。

(下面还未成功,能请求外部的xxe,但似乎最后没办法发送请求出来。。。我再试试)

微信扫码加入知识星球【漏洞百出】
chybeta WeChat Pay

点击图片放大,扫码知识星球【漏洞百出】

本文标题:ASISCTF2017-GSA File Server-writeup

文章作者:chybeta

发布时间:2017年09月11日 - 16:09

最后更新:2017年09月12日 - 18:09

原始链接:http://chybeta.github.io/2017/09/11/ASISCTF2017-GSA-File-Server-writeup/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。