导航
导航
文章目录
  1. 一、漏洞触发条件
  2. 二、测试
  3. 三、demo

Struts2 Exploit CVE-2016-3081

CVE-2016-3081, 官方为S2-032漏洞。在开启动态方法调用 DMI (Dynamic Method Invocation)的情况下,会被攻击者实现远程代码执行攻击。受影响的版本有2.3.18-2.3.28(除 2.3.20.2 and 2.3.24.2)。

一、漏洞触发条件

1. struts.xml里开启DMI

1
<constant name="struts.enable.DynamicMethodInvocation" value="true">

2. 实现DMI的action类(.java)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
public class HelloWorldAction extends ActionSupport{
private String message;
public String execute() throws Exception{
this.message = "我的第一个struts2应用";
return "success";
}
public String other() throws Exception{
this.message = "第二个方法";
return "success";
}

假设访问上面action的TargetURI路径为:

1
/struts/test/helloworld.action

那么要访问action的other() 方法,我们可以这样调用,action类前加感叹号:

1
/struts/test/helloworld!other.action

二、测试

直接使用源码包里的struts-2.3.28/apps/struts2-showcase.war作为测试对象,部署到Apache-tomcat上。使用github上公开的漏洞源码struts_dmi_exec在Kali Linux2.0 上的测试结果:

Selection_001

三、demo

here.

支持一下
坚持原创技术分享,您的支持将鼓励我继续创作!