TFTP File Transfer Utility - Metasploit


This page contains detailed information about how to use the auxiliary/admin/tftp/tftp_transfer_util metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: TFTP File Transfer Utility
Module: auxiliary/admin/tftp/tftp_transfer_util
Source code: modules/auxiliary/admin/tftp/tftp_transfer_util.rb
Disclosure date: -
Last modification time: 2021-01-28 10:35:25 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 69
List of CVEs: -

This module will transfer a file to or from a remote TFTP server. Note that the target must be able to connect back to the Metasploit system, and NAT traversal for TFTP is often unsupported. Two actions are supported: "Upload" and "Download," which behave as one might expect -- use 'set action Actionname' to use either mode of operation. If "Download" is selected, at least one of FILENAME or REMOTE_FILENAME must be set. If "Upload" is selected, either FILENAME must be set to a valid path to a source file, or FILEDATA must be populated. FILENAME may be a fully qualified path, or the name of a file in the Msf::Config.local_directory or Msf::Config.data_directory.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


msf > use auxiliary/admin/tftp/tftp_transfer_util
msf auxiliary(tftp_transfer_util) > show targets
    ... a list of targets ...
msf auxiliary(tftp_transfer_util) > set TARGET target-id
msf auxiliary(tftp_transfer_util) > show options
    ... show and set options ...
msf auxiliary(tftp_transfer_util) > exploit

Required Options


  • RHOST: The remote TFTP server

Go back to menu.

Msfconsole Usage


Here is how the admin/tftp/tftp_transfer_util auxiliary module looks in the msfconsole:

msf6 > use auxiliary/admin/tftp/tftp_transfer_util

msf6 auxiliary(admin/tftp/tftp_transfer_util) > show info

       Name: TFTP File Transfer Utility
     Module: auxiliary/admin/tftp/tftp_transfer_util
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  todb <[email protected]>

Available actions:
  Name      Description
  ----      -----------
  Download  Download REMOTE_FILENAME as FILENAME from the server.
  Upload    Upload FILENAME as REMOTE_FILENAME to the server.

Check supported:
  No

Basic options:
  Name             Current Setting  Required  Description
  ----             ---------------  --------  -----------
  FILEDATA                          no        Data to upload in lieu of a real local file.
  FILENAME                          no        The local filename
  LHOST                             no        The local address the TFTP client should bind to
  LPORT                             no        The local port the TFTP client should listen on (default is random)
  MODE             octet            no        The TFTP mode; usual choices are netascii and octet.
  REMOTE_FILENAME                   no        The remote filename
  RHOST                             yes       The remote TFTP server
  RPORT            69               yes       The target port

Description:
  This module will transfer a file to or from a remote TFTP server. 
  Note that the target must be able to connect back to the Metasploit 
  system, and NAT traversal for TFTP is often unsupported. Two actions 
  are supported: "Upload" and "Download," which behave as one might 
  expect -- use 'set action Actionname' to use either mode of 
  operation. If "Download" is selected, at least one of FILENAME or 
  REMOTE_FILENAME must be set. If "Upload" is selected, either 
  FILENAME must be set to a valid path to a source file, or FILEDATA 
  must be populated. FILENAME may be a fully qualified path, or the 
  name of a file in the Msf::Config.local_directory or 
  Msf::Config.data_directory.

References:
  http://www.faqs.org/rfcs/rfc1350.html
  http://www.networksorcery.com/enp/protocol/tftp.htm

Module Options


This is a complete list of options available in the admin/tftp/tftp_transfer_util auxiliary module:

msf6 auxiliary(admin/tftp/tftp_transfer_util) > show options

Module options (auxiliary/admin/tftp/tftp_transfer_util):

   Name             Current Setting  Required  Description
   ----             ---------------  --------  -----------
   FILEDATA                          no        Data to upload in lieu of a real local file.
   FILENAME                          no        The local filename
   LHOST                             no        The local address the TFTP client should bind to
   LPORT                             no        The local port the TFTP client should listen on (default is random)
   MODE             octet            no        The TFTP mode; usual choices are netascii and octet.
   REMOTE_FILENAME                   no        The remote filename
   RHOST                             yes       The remote TFTP server
   RPORT            69               yes       The target port

Auxiliary action:

   Name    Description
   ----    -----------
   Upload  Upload FILENAME as REMOTE_FILENAME to the server.

Advanced Options


Here is a complete list of advanced options supported by the admin/tftp/tftp_transfer_util auxiliary module:

msf6 auxiliary(admin/tftp/tftp_transfer_util) > show advanced

Module advanced options (auxiliary/admin/tftp/tftp_transfer_util):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Auxiliary Actions


This is a list of all auxiliary actions that the admin/tftp/tftp_transfer_util module can do:

msf6 auxiliary(admin/tftp/tftp_transfer_util) > show actions

Auxiliary actions:

   Name      Description
   ----      -----------
   Download  Download REMOTE_FILENAME as FILENAME from the server.
   Upload    Upload FILENAME as REMOTE_FILENAME to the server.

Evasion Options


Here is the full list of possible evasion options supported by the admin/tftp/tftp_transfer_util auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(admin/tftp/tftp_transfer_util) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

Need at least a local file name or file data to upload.


Here is a relevant code snippet related to the "Need at least a local file name or file data to upload." error message:

137:	    case action.name
138:	    when 'Upload'
139:	      if file
140:	        run_upload()
141:	      else
142:	        print_error "Need at least a local file name or file data to upload."
143:	        return
144:	      end
145:	    when 'Download'
146:	      if remote_file
147:	        run_download()

Need at least a remote file name to download.


Here is a relevant code snippet related to the "Need at least a remote file name to download." error message:

144:	      end
145:	    when 'Download'
146:	      if remote_file
147:	        run_download()
148:	      else
149:	        print_error "Need at least a remote file name to download."
150:	        return
151:	      end
152:	    else
153:	      print_error "Unknown action: '#{action.name}'"
154:	    end

Unknown action: '<ACTION.NAME>'


Here is a relevant code snippet related to the "Unknown action: '<ACTION.NAME>'" error message:

148:	      else
149:	        print_error "Need at least a remote file name to download."
150:	        return
151:	      end
152:	    else
153:	      print_error "Unknown action: '#{action.name}'"
154:	    end
155:	    while not @tftp_client.complete
156:	      select(nil,nil,nil,1)
157:	      print_status [rtarget,"TFTP transfer operation complete."].join
158:	      save_downloaded_file() if action.name == 'Download'

No database connected, so not actually saving the data


Here is a relevant code snippet related to the "No database connected, so not actually saving the data" error message:

188:	    print_status "Saving #{remote_file} as '#{file}'"
189:	    fh = @tftp_client.recv_tempfile
190:	    data = File.open(fh,"rb") {|f| f.read f.stat.size} rescue nil
191:	    if data and not data.empty?
192:	      unless framework.db.active
193:	        print_status "No database connected, so not actually saving the data:"
194:	        print_line data
195:	      end
196:	      this_service = report_service(
197:	        :host => rhost,
198:	        :port => rport,

Did not find any data, so nothing to save.


Here is a relevant code snippet related to the "Did not find any data, so nothing to save." error message:

199:	        :name => "tftp",
200:	        :proto => "udp"
201:	      )
202:	      store_loot("tftp.file",datatype,rhost,data,file,remote_file,this_service)
203:	    else
204:	      print_status [rtarget,"Did not find any data, so nothing to save."].join
205:	    end
206:	    fh.unlink rescue nil # Windows often complains about unlinking tempfiles
207:	  end
208:	
209:	  def print_tftp_status(msg)

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • todb

Version


This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.