SNMP

Enumeration techniques on SNMP

NMap

We can use default nmap scripts to enumerate SNMP:

nmap -p 161 -sCV -sU 10.129.230.96 -v

As you can see it gives much information:

PORT    STATE SERVICE VERSION
161/udp open  snmp    SNMPv1 server; net-snmp SNMPv3 server (public)
| snmp-netstat: 
|   TCP  0.0.0.0:22           0.0.0.0:0
|   TCP  0.0.0.0:389          0.0.0.0:0
|   TCP  127.0.0.1:25         0.0.0.0:0
|   TCP  127.0.0.1:3306       0.0.0.0:0
|   TCP  127.0.0.1:5432       0.0.0.0:0
|   TCP  127.0.0.1:7878       0.0.0.0:0
|   TCP  127.0.0.1:44184      127.0.1.1:80
|   TCP  127.0.0.1:44188      127.0.1.1:80
|   UDP  0.0.0.0:68           *:*
|   UDP  0.0.0.0:123          *:*
|   UDP  0.0.0.0:161          *:*
|   UDP  0.0.0.0:162          *:*
|   UDP  10.129.230.96:123    *:*
|_  UDP  127.0.0.1:123        *:*
| snmp-interfaces: 
|   lo
|     IP address: 127.0.0.1  Netmask: 255.0.0.0
|     Type: softwareLoopback  Speed: 10 Mbps
|     Status: up
|     Traffic stats: 462.86 Kb sent, 462.86 Kb received
|   VMware VMXNET3 Ethernet Controller
|     IP address: 10.129.230.96  Netmask: 255.255.0.0
|     MAC address: 00:50:56:94:4d:43 (VMware)
|     Type: ethernetCsmacd  Speed: 4 Gbps
|     Status: up
|_    Traffic stats: 17.52 Mb sent, 9.14 Mb received
| snmp-sysdescr: Linux monitored 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64
|_  System uptime: 1h11m22.25s (428225 timeticks)
| snmp-info: 
|   enterprise: net-snmp
|   engineIDFormat: unknown
|   engineIDData: 6f3fa7421af94c6500000000
|   snmpEngineBoots: 36
|_  snmpEngineTime: 1h11m22s
| snmp-win32-software: 
|   adduser_3.118+deb11u1_all; 2023-11-09T10:00:55
|   alsa-topology-conf_1.2.4-1_all; 2023-11-09T10:03:58
|   alsa-ucm-conf_1.2.4-2_all; 2023-11-09T10:03:58
|   anacron_2.3-30_amd64; 2023-11-09T10:03:58
|   analog_2:6.0-22+b1_amd64; 2023-11-09T10:04:01
|   ansible_2.10.7+merged+base+2.10.8+dfsg-1_all; 2023-11-09T10:18:59
|   apache2-bin_2.4.56-1~deb11u2_amd64; 2023-11-09T10:03:45
|   apache2-data_2.4.56-1~deb11u2_all; 2023-11-09T10:03:46
|   apache2-doc_2.4.56-1~deb11u2_all; 2023-11-09T10:04:02
|   apache2-utils_2.4.56-1~deb11u2_amd64; 2023-11-09T10:03:46
|   apache2_2.4.56-1~deb11u2_amd64; 2023-11-09T10:03:46
|   apparmor_2.13.6-10_amd64; 2023-11-09T09:57:17
|   apt-listchanges_3.24_all; 2023-11-09T10:03:51
. . . [SNIP] . . 

Or scripts specific for SNMP:

snmpwalk

SNMPWALK is a command-line tool used to retrieve information from network devices using the Simple Network Management Protocol (SNMP). It's essential for network monitoring and management.

What is SNMPWALK?

SNMPWALK queries SNMP-enabled devices by traversing the Management Information Base (MIB) tree structure. Instead of requesting individual values, it walks through the entire MIB or a specified subtree, retrieving multiple related values in sequence.

How SNMP Works

SNMP operates on a manager-agent architecture. The SNMP manager (your computer running snmpwalk) sends requests to SNMP agents (running on network devices like routers, switches, servers). These agents respond with information stored in their MIB databases.

Basic Syntax

AGENT: The target device's IP address or hostname OID: Object Identifier specifying where to start the walk (optional)

Common Options

-v: SNMP version (1, 2c, or 3) -c: Community string (password for SNMPv1/v2c) -u: Username (for SNMPv3) -l: Security level (noAuthNoPriv, authNoPriv, authPriv) -a: Authentication protocol (MD5 or SHA) -A: Authentication password -x: Privacy protocol (DES or AES) -X: Privacy password -O: Output format options

Practical Examples

Basic SNMPv2c query:

bash

Query specific OID (system information):

bash

SNMPv3 with authentication:

bash

Get interface information:

bash

Troubleshooting Common Issues

Timeout errors: Check firewall rules (UDP port 161), verify the device has SNMP enabled, confirm correct community string or credentials

Permission denied: Community string may be read-only, or you may lack permissions for certain OIDs

Unknown OIDs: Install additional MIB files, use numeric OIDs instead of names

Readability

Understanding MIBs (Management Information Bases)

MIBs are hierarchical databases that define the structure of data that can be retrieved from network devices via SNMP. Think of them as dictionaries that translate between human-readable names and numeric Object Identifiers (OIDs).

Switching mibs to all in snmpwalk:

But before it, we need to edit snmp config file:

And uncomment last string:

And install mibs downloader:

After that you can see human-readable output:

OneSixtyOne

What is onesixtyone?

Onesixtyone is a fast, efficient SNMP scanner designed specifically for brute-forcing SNMP community strings. Unlike snmpwalk which queries devices with known credentials, onesixtyone helps discover which devices have SNMP enabled and what community strings they're using.

Why onesixtyone?

Traditional SNMP scanners are slow because they wait for timeouts on each failed attempt. Onesixtyone uses asynchronous I/O, allowing it to send hundreds of requests simultaneously without waiting for responses. This makes it significantly faster than tools like snmpwalk for scanning multiple hosts.

Speed Comparison

  • snmpwalk: Sequential, waits for each timeout (~5 seconds per failed attempt)

  • onesixtyone: Parallel, can scan 65,536 hosts in under 13 minutes

  • Typical use: Scan entire subnets in seconds to minutes

Command-Line Options

-c <file>: File containing community strings to try (one per line) -i <file>: File containing IP addresses/hosts to scan (one per line) -o <file>: Output results to file -d: Enable debugging output -w <n>: Wait n milliseconds between packets (default: 10) -q: Quiet mode (minimal output) -p <port>: SNMP port (default: 161) -l: Log devices that don't respond

Practical Examples

Single Host, Single Community String

bash

Run the scan:

bash

Multiple Hosts, Single Community String

bash

Run comprehensive scan:

bash

Scan Entire Subnet

bash

Save Results to File

bash

Quiet Mode with Output

bash

Adjust Scan Speed

bash

Download Pre-Made Lists

SecLists repository has extensive SNMP community string lists:

bash

Advanced Techniques

Scan Multiple Subnets

bash

Combine with Other Tools

Chain with snmpwalk for detailed enumeration:

bash

Integration with nmap:

bash

Parse and Format Results

bash

Last updated