您的位置:首页 > 编程语言 > Java开发

Struts S2-052漏洞利用方式实验解析(附EXP)

2017-09-08 20:10 316 查看
靶机:101.200.58.* (win2008x64+tomcat8.5+Struts 2.5.12)

漏洞地址:

http://101.200.58.*:8080/struts2-rest-showcase/orders.xhtml

        


<img alt="Clipboard Image.png" src="http://image.3001.net/images/20170907/15047245718998.png!small" width="690" height="515"></p>

一、判断操作系统及端口开放:

本机使用nmap识别一下操作系统(重要):

nmap -o 101.200.58.* 

根据下图目标开放的端口(135.139.445.3389)可以知道:目标使用的是windows系统。




<img alt="1.png" src="http://image.3001.net/images/20170907/15047244518467.png!small" width="659" height="424"></p>

二、环境要求及EXP下载:

因为EXP是用go语言编写的,如果你没有go环境的话,需要搭建一下。

Go1.9下载地址:

https://www.golangtc.com/static/go/1.9/go1.9.windows-386.zip (32位)

https://www.golangtc.com/static/go/1.9/go1.9.windows-amd64.zip(64位)

Exp 下载地址:https://github.com/luc10/struts-rce-cve-2017-9805

三、漏洞证明:

EXP使用方法:

go run main.go -u URL -c “command”

因为这个EXP脚本没实现回显功能,其实我们可以把命令结果输出文件到网站目录下面,这样我们使用浏览器访问这个文件就可以看到回显内容了

执行(windows环境下):

go run main.go -u http://101.200.58.*:8080/struts2-rest-showcase/orders.xhtml -c "cmd /c  whoami >>.\webapps\ROOT\cmd.txt"




<img alt="Clipboard Image.png" src="http://image.3001.net/images/20170907/15047249367639.png!small" width="690" height="109"></p>
执行后,我们访问地址:http://101.200.58.*:8080/cmd.txt




<img alt="2.png" src="http://image.3001.net/images/20170907/15047254201836.png!small" width="571" height="234"></p>
发现命令的执行成功的结果已经写入到网站根目录下的cmd.txt,并且权限是最高权限。

四、控制服务器:

*为防止恶意利用,此实验具体内容隐藏

漏洞影响

Struts 2.5 – Struts 2.5.12 版本,可能影响到 2.3.33 版本。

解决方案

1.建议尽快升级到 2.5.13版本。

2.在不使用时删除 Struts REST插件,或仅限于服务器普通页面和JSONs:

<constant name=”struts.action.extension” value=”xhtml,,json” />
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: