SNMP Enumeration Module - Metasploit


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

Module Overview


Name: SNMP Enumeration Module
Module: auxiliary/scanner/snmp/snmp_enum
Source code: modules/auxiliary/scanner/snmp/snmp_enum.rb
Disclosure date: -
Last modification time: 2020-06-11 13:09:25 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 161
List of CVEs: -

This module allows enumeration of any devices with SNMP protocol support. It supports hardware, software, and network information. The default community used is "public".

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/snmp_enum
msf auxiliary(snmp_enum) > show options
    ... show and set options ...
msf auxiliary(snmp_enum) > set RHOSTS ip-range
msf auxiliary(snmp_enum) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(snmp_enum) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(snmp_enum) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(snmp_enum) > 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


Description


This module performs a detailed enumeration of a host or a range through SNMP protocol. It supports hardware, software, and network information.

Verification Steps


  1. Do: use auxiliary/scanner/snmp/snmp_enum
  2. Do: set RHOSTS [IP]
  3. Do: run

Scenarios


msf > use auxiliary/scanner/snmp/snmp_enum
msf auxiliary(auxiliary/scanner/snmp/snmp_enum) > set RHOSTS 1.1.1.2
RHOSTS => 1.1.1.2
msf auxiliary(auxiliary/scanner/snmp/snmp_enum) > run

[*] System information

Hostname                : Netgear-GSM7224
Description             : GSM7224 L2 Managed Gigabit Switch
Contact                 : dookie
Location                : Basement
Uptime snmp             : 56 days, 00:36:28.00
Uptime system           : -
System date             : -

[*] Network information

IP forwarding enabled   :  no
Default TTL             :  64
TCP segments received   :  20782
TCP segments sent       :  9973
TCP segments retrans.   :  9973
Input datagrams         :  4052407
Delivered datagrams     :  1155615
Output datagrams        :  18261

[*] Network interfaces

Interface [ up ] Unit: 1 Slot: 0 Port: 1 Gigabit - Level

    Id              : 1
    Mac address     : 00:0f:b5:fc:bd:24
    Type            : ethernet-csmacd
    Speed           : 1000 Mbps
    Mtu             : 1500
    In octets       : 3716564861
    Out octets      : 675201778
...snip...
[*] Routing information

     Destination         Next hop             Mask           Metric

         0.0.0.0      5.1.168.192          0.0.0.0                1
       1.0.0.127        1.0.0.127  255.255.255.255                0

[*] TCP connections and listening ports

   Local address       Local port   Remote address      Remote port            State

         0.0.0.0               23          0.0.0.0                0           listen
         0.0.0.0               80          0.0.0.0                0           listen
         0.0.0.0             4242          0.0.0.0                0           listen
       1.0.0.127             2222          0.0.0.0                0           listen

[*] Listening UDP ports

   Local address       Local port

         0.0.0.0                0
         0.0.0.0              161
         0.0.0.0              514

[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(auxiliary/scanner/snmp/snmp_enum) >

Go back to menu.

Msfconsole Usage


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

msf6 > use auxiliary/scanner/snmp/snmp_enum

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

       Name: SNMP Enumeration Module
     Module: auxiliary/scanner/snmp/snmp_enum
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  Matteo Cantoni <[email protected]>

Check supported:
  No

Basic options:
  Name       Current Setting  Required  Description
  ----       ---------------  --------  -----------
  COMMUNITY  public           yes       SNMP Community String
  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)
  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 allows enumeration of any devices with SNMP protocol 
  support. It supports hardware, software, and network information. 
  The default community used is "public".

References:
  http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol
  http://net-snmp.sourceforge.net/docs/man/snmpwalk.html
  http://www.nothink.org/perl/snmpcheck/

Module Options


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

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

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

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   COMMUNITY  public           yes       SNMP Community String
   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)
   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/snmp_enum auxiliary module:

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

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

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

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

Auxiliary actions:

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

Evasion Options


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

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

NotFoundErrors


Here is a relevant code snippet related to the "NotFoundErrors" error message:

503:	          iis["BGIRequests"] = http_totalBGIRequests
504:	        end
505:	
506:	        http_totalNotFoundErrors = snmp.get_value('1.3.6.1.4.1.311.1.7.3.1.22.0')
507:	        if http_totalNotFoundErrors.to_s !~ /Null/
508:	          iis["NotFoundErrors"] = http_totalNotFoundErrors
509:	        end
510:	
511:	        if not iis.empty?
512:	          output_data["IIS server information"] = iis
513:	        end

<IP> SNMP request timeout.


Here is a relevant code snippet related to the "<IP> SNMP request timeout." error message:

856:	
857:	      print_line(line)
858:	      print_line('')
859:	
860:	    rescue SNMP::RequestTimeout
861:	      print_error("#{ip} SNMP request timeout.")
862:	    rescue Rex::ConnectionError
863:	      print_error("#{ip} Connection refused.")
864:	    rescue SNMP::InvalidIpAddress
865:	      print_error("#{ip} Invalid IP Address. Check it with 'snmpwalk tool'.")
866:	    rescue SNMP::UnsupportedVersion

<IP> Connection refused.


Here is a relevant code snippet related to the "<IP> Connection refused." error message:

858:	      print_line('')
859:	
860:	    rescue SNMP::RequestTimeout
861:	      print_error("#{ip} SNMP request timeout.")
862:	    rescue Rex::ConnectionError
863:	      print_error("#{ip} Connection refused.")
864:	    rescue SNMP::InvalidIpAddress
865:	      print_error("#{ip} Invalid IP Address. Check it with 'snmpwalk tool'.")
866:	    rescue SNMP::UnsupportedVersion
867:	      print_error("#{ip} Unsupported SNMP version specified. Select from '1' or '2c'.")
868:	    rescue ::Interrupt

<IP> Invalid IP Address. Check it with 'snmpwalk tool'.


Here is a relevant code snippet related to the "<IP> Invalid IP Address. Check it with 'snmpwalk tool'." error message:

860:	    rescue SNMP::RequestTimeout
861:	      print_error("#{ip} SNMP request timeout.")
862:	    rescue Rex::ConnectionError
863:	      print_error("#{ip} Connection refused.")
864:	    rescue SNMP::InvalidIpAddress
865:	      print_error("#{ip} Invalid IP Address. Check it with 'snmpwalk tool'.")
866:	    rescue SNMP::UnsupportedVersion
867:	      print_error("#{ip} Unsupported SNMP version specified. Select from '1' or '2c'.")
868:	    rescue ::Interrupt
869:	      raise $!
870:	    rescue ::Exception => e

<IP> Unsupported SNMP version specified. Select from '1' or '2c'.


Here is a relevant code snippet related to the "<IP> Unsupported SNMP version specified. Select from '1' or '2c'." error message:

862:	    rescue Rex::ConnectionError
863:	      print_error("#{ip} Connection refused.")
864:	    rescue SNMP::InvalidIpAddress
865:	      print_error("#{ip} Invalid IP Address. Check it with 'snmpwalk tool'.")
866:	    rescue SNMP::UnsupportedVersion
867:	      print_error("#{ip} Unsupported SNMP version specified. Select from '1' or '2c'.")
868:	    rescue ::Interrupt
869:	      raise $!
870:	    rescue ::Exception => e
871:	      print_error("Unknown error: #{e.class} #{e}")
872:	      elog(e)

Unknown error: <E.CLASS> <E>


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

866:	    rescue SNMP::UnsupportedVersion
867:	      print_error("#{ip} Unsupported SNMP version specified. Select from '1' or '2c'.")
868:	    rescue ::Interrupt
869:	      raise $!
870:	    rescue ::Exception => e
871:	      print_error("Unknown error: #{e.class} #{e}")
872:	      elog(e)
873:	    ensure
874:	      disconnect_snmp
875:	    end
876:	  end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


Matteo Cantoni <goony[at]nothink.org>

Version


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

Go back to menu.