├── .gitignore
├── README.md
├── struts-2.3-any-results
├── any-results
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── org
│ │ │ └── apache
│ │ │ └── struts
│ │ │ └── helloworld
│ │ │ └── action
│ │ │ └── MainAction.java
│ │ ├── resources
│ │ ├── log4j2.xml
│ │ └── struts.xml
│ │ └── webapp
│ │ ├── META-INF
│ │ └── MANIFEST.MF
│ │ ├── WEB-INF
│ │ └── web.xml
│ │ ├── confidential.jsp
│ │ └── login.jsp
└── pom.xml
└── struts-2.5-any-results
├── any-results
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── org
│ │ └── apache
│ │ └── struts
│ │ └── helloworld
│ │ └── action
│ │ └── MainAction.java
│ ├── resources
│ ├── log4j2.xml
│ └── struts.xml
│ └── webapp
│ ├── META-INF
│ └── MANIFEST.MF
│ ├── WEB-INF
│ └── web.xml
│ ├── confidential.jsp
│ └── login.jsp
└── pom.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | # IDEA
2 | .idea
3 | *.iml
4 | *.ipr
5 | *.iws
6 |
7 | # Eclipse
8 | .classpath
9 | .project
10 | .settings/
11 |
12 | # Netbeans
13 | nb-configuration.xml
14 |
15 | # OSX
16 | .DS_Store
17 |
18 | # Scripts
19 | *.sh
20 |
21 | # Maven
22 | target
23 |
24 | .java-version
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Struts 2 - Access any results vulnerability
2 |
3 | This is an example project that demonstrates why Dynamic Method Invocation with unrestricted method names (the old default of Struts) is dangerous.
4 |
5 | ### Usage:
6 |
7 | Execute `mvn jetty:run` in the `any-results` directory. You can access the website then at:
8 |
9 | http://localhost:8080/any-results/
10 |
11 | ### Exploitation:
12 |
13 | http://localhost:8080/any-results/index!getAccessCode.action?accessCode=confidential
14 |
--------------------------------------------------------------------------------
/struts-2.3-any-results/any-results/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.apache.struts
8 | struts-examples
9 | 1.0.0
10 |
11 |
12 | any-results
13 | Any Results
14 | Struts 2 example application for the any results vulnerability
15 | war
16 |
17 |
18 |
19 | javax.servlet
20 | javax.servlet-api
21 | 3.0.1
22 | provided
23 |
24 |
25 |
26 |
27 | http-session
28 |
29 |
30 | org.eclipse.jetty
31 | jetty-maven-plugin
32 | ${jetty-plugin.version}
33 |
34 |
35 | /${project.artifactId}
36 |
37 | CTRL+C
38 | 8999
39 | 10
40 |
41 | src/main/webapp/WEB-INF/web.xml
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/struts-2.3-any-results/any-results/src/main/java/org/apache/struts/helloworld/action/MainAction.java:
--------------------------------------------------------------------------------
1 | package org.apache.struts.helloworld.action;
2 |
3 | import com.opensymphony.xwork2.ActionSupport;
4 |
5 | import java.util.Random;
6 |
7 | public class MainAction extends ActionSupport {
8 |
9 | private final static Random rnd = new Random();
10 | private final static String expectedAccessCode = ""+(rnd.nextInt()+100000)+(rnd.nextInt()+100000)+(rnd.nextInt()+100000)+(rnd.nextInt()+100000)+(rnd.nextInt()+100000);
11 |
12 | private String accessCode;
13 | public void setAccessCode(String accessCode) {
14 | this.accessCode = accessCode;
15 | }
16 | public String getAccessCode() {
17 | return accessCode;
18 | }
19 |
20 | public String execute() throws Exception {
21 | if(expectedAccessCode.equals(accessCode))
22 | return "confidential";
23 | else
24 | if(accessCode != null)
25 | this.addActionError("Invalid access code provided!");
26 |
27 | return "login";
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/struts-2.3-any-results/any-results/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/struts-2.3-any-results/any-results/src/main/resources/struts.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | /login.jsp
17 | /confidential.jsp
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/struts-2.3-any-results/any-results/src/main/webapp/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/struts-2.3-any-results/any-results/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | HTTP Session Struts 2
4 |
5 | index.jsp
6 |
7 |
8 |
9 |
10 | struts2
11 | org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
12 |
13 |
14 |
15 | struts2
16 | /*
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/struts-2.3-any-results/any-results/src/main/webapp/confidential.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 | <%@ taglib prefix="s" uri="/struts-tags" %>
3 |
4 |
5 |
6 |
7 | Basic Struts 2 Application - Welcome
8 |
9 |
10 |
11 | This is some very sensitive information that could not be accessed otherwise.
12 |
13 |
14 |
--------------------------------------------------------------------------------
/struts-2.3-any-results/any-results/src/main/webapp/login.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 | <%@ taglib prefix="s" uri="/struts-tags" %>
3 |
4 |
5 |
6 |
7 | Basic Struts 2 Application - Welcome
8 |
9 |
10 | This is an important resource so you need to provide the secret code first to access it.
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/struts-2.3-any-results/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | org.apache.struts
6 | struts-examples
7 | 1.0.0
8 | pom
9 | Struts 2 Examples
10 |
11 | This is the parent pom for the Struts 2 examples that
12 | go with the Struts 2 Getting Started series of tutorials.
13 |
14 |
15 |
16 |
17 | The Apache Software License, Version 2.0
18 | http://www.apache.org/licenses/LICENSE-2.0.txt
19 | repo
20 |
21 |
22 |
23 |
24 |
25 | Apache Software Foundation
26 | http://www.apache.org
27 |
28 |
29 |
30 | scm:git:git://git.apache.org/struts.git
31 | scm:git:https://git-wip-us.apache.org/repos/asf/struts-examples.git
32 | http://git.apache.org/struts-examples.git
33 | HEAD
34 |
35 |
36 |
37 | JIRA
38 | https://issues.apache.org/jira/browse/WW
39 |
40 |
41 |
42 | UTF-8
43 | 2.3.35
44 | 2.9.1
45 | 9.4.11.v20180605
46 |
47 |
48 |
49 |
50 |
51 | org.apache.struts
52 | struts2-core
53 | ${struts2.version}
54 |
55 |
56 |
57 | org.apache.struts
58 | struts2-convention-plugin
59 | ${struts2.version}
60 |
61 |
62 |
63 | org.apache.logging.log4j
64 | log4j-core
65 | ${log4j2.version}
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | org.apache.logging.log4j
75 | log4j-api
76 | ${log4j2.version}
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | org.apache.maven.plugins
86 | maven-compiler-plugin
87 | 3.3
88 |
89 | 1.8
90 | 1.8
91 |
92 |
93 |
94 | org.apache.maven.plugins
95 | maven-javadoc-plugin
96 | 2.10.4
97 |
98 | -Xdoclint:none
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 | apache-public
108 | https://repository.apache.org/content/groups/public/
109 | default
110 |
111 |
112 | apache-staging
113 | https://repository.apache.org/content/groups/staging/
114 | default
115 |
116 |
117 | apache-snapshots
118 | https://repository.apache.org/content/groups/snapshots/
119 | default
120 |
121 | true
122 |
123 |
124 |
125 | oss-snapshots
126 | https://oss.sonatype.org/content/repositories/snapshots/
127 | default
128 |
129 | true
130 |
131 |
132 |
133 |
134 |
135 |
--------------------------------------------------------------------------------
/struts-2.5-any-results/any-results/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.apache.struts
8 | struts-examples
9 | 1.0.0
10 |
11 |
12 | any-results
13 | Any Results
14 | Struts 2 example application for the any results vulnerability
15 | war
16 |
17 |
18 |
19 | javax.servlet
20 | javax.servlet-api
21 | 3.0.1
22 | provided
23 |
24 |
25 |
26 |
27 | http-session
28 |
29 |
30 | org.eclipse.jetty
31 | jetty-maven-plugin
32 | ${jetty-plugin.version}
33 |
34 |
35 | /${project.artifactId}
36 |
37 | CTRL+C
38 | 8999
39 | 10
40 |
41 | src/main/webapp/WEB-INF/web.xml
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/struts-2.5-any-results/any-results/src/main/java/org/apache/struts/helloworld/action/MainAction.java:
--------------------------------------------------------------------------------
1 | package org.apache.struts.helloworld.action;
2 |
3 | import com.opensymphony.xwork2.ActionSupport;
4 |
5 | import java.util.Random;
6 |
7 | public class MainAction extends ActionSupport {
8 |
9 | private final static Random rnd = new Random();
10 | private final static String expectedAccessCode = ""+(rnd.nextInt()+100000)+(rnd.nextInt()+100000)+(rnd.nextInt()+100000)+(rnd.nextInt()+100000)+(rnd.nextInt()+100000);
11 |
12 | private String accessCode;
13 | public void setAccessCode(String accessCode) {
14 | this.accessCode = accessCode;
15 | }
16 | public String getAccessCode() {
17 | return accessCode;
18 | }
19 |
20 | public String execute() throws Exception {
21 | if(expectedAccessCode.equals(accessCode))
22 | return "confidential";
23 | else
24 | if(accessCode != null)
25 | this.addActionError("Invalid access code provided!");
26 |
27 | return "login";
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/struts-2.5-any-results/any-results/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/struts-2.5-any-results/any-results/src/main/resources/struts.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | /login.jsp
17 | /confidential.jsp
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/struts-2.5-any-results/any-results/src/main/webapp/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/struts-2.5-any-results/any-results/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | HTTP Session Struts 2
4 |
5 | index.jsp
6 |
7 |
8 |
9 |
10 | struts2
11 | org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
12 |
13 |
14 |
15 | struts2
16 | /*
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/struts-2.5-any-results/any-results/src/main/webapp/confidential.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 | <%@ taglib prefix="s" uri="/struts-tags" %>
3 |
4 |
5 |
6 |
7 | Basic Struts 2 Application - Welcome
8 |
9 |
10 |
11 | This is some very sensitive information that could not be accessed otherwise.
12 |
13 |
14 |
--------------------------------------------------------------------------------
/struts-2.5-any-results/any-results/src/main/webapp/login.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 | <%@ taglib prefix="s" uri="/struts-tags" %>
3 |
4 |
5 |
6 |
7 | Basic Struts 2 Application - Welcome
8 |
9 |
10 | This is an important resource so you need to provide the secret code first to access it.
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/struts-2.5-any-results/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | org.apache.struts
6 | struts-examples
7 | 1.0.0
8 | pom
9 | Struts 2 Examples
10 |
11 | This is the parent pom for the Struts 2 examples that
12 | go with the Struts 2 Getting Started series of tutorials.
13 |
14 |
15 |
16 |
17 | The Apache Software License, Version 2.0
18 | http://www.apache.org/licenses/LICENSE-2.0.txt
19 | repo
20 |
21 |
22 |
23 |
24 |
25 | Apache Software Foundation
26 | http://www.apache.org
27 |
28 |
29 |
30 | scm:git:git://git.apache.org/struts.git
31 | scm:git:https://git-wip-us.apache.org/repos/asf/struts-examples.git
32 | http://git.apache.org/struts-examples.git
33 | HEAD
34 |
35 |
36 |
37 | JIRA
38 | https://issues.apache.org/jira/browse/WW
39 |
40 |
41 |
42 | UTF-8
43 | 2.5.18
44 | 2.9.1
45 | 9.4.11.v20180605
46 |
47 |
48 |
49 |
50 |
51 | org.apache.struts
52 | struts2-core
53 | ${struts2.version}
54 |
55 |
56 |
57 | org.apache.struts
58 | struts2-convention-plugin
59 | ${struts2.version}
60 |
61 |
62 |
63 | org.apache.logging.log4j
64 | log4j-core
65 | ${log4j2.version}
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | org.apache.logging.log4j
75 | log4j-api
76 | ${log4j2.version}
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | org.apache.maven.plugins
86 | maven-compiler-plugin
87 | 3.3
88 |
89 | 1.8
90 | 1.8
91 |
92 |
93 |
94 | org.apache.maven.plugins
95 | maven-javadoc-plugin
96 | 2.10.4
97 |
98 | -Xdoclint:none
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 | apache-public
108 | https://repository.apache.org/content/groups/public/
109 | default
110 |
111 |
112 | apache-staging
113 | https://repository.apache.org/content/groups/staging/
114 | default
115 |
116 |
117 | apache-snapshots
118 | https://repository.apache.org/content/groups/snapshots/
119 | default
120 |
121 | true
122 |
123 |
124 |
125 | oss-snapshots
126 | https://oss.sonatype.org/content/repositories/snapshots/
127 | default
128 |
129 | true
130 |
131 |
132 |
133 |
134 |
135 |
--------------------------------------------------------------------------------