For the complete documentation index, see llms.txt. This page is also available as Markdown.

Pentesting SNMP

Overview

  • Ports: UDP 161 (queries), UDP 162 (traps)

  • MIB = Management Information Base — hierarchical database describing the device

  • OID = Object Identifier — address of a value in the MIB tree

  • Commands: read, write, trap, traversal

  • Community strings act like a username/password granting access to managed devices

  • Factory defaults: read-only = public, read-write = private

SNMP Versions

Version
Auth
Encryption
Notes

SNMPv1

Community string

None (plain text)

No real security

SNMPv2c

Community string

None (plain text)

Community-based, still cleartext

SNMPv3

Username/password

Pre-shared key

Auth + encryption, replaces community strings

Configuration

  • Config file: /etc/snmp/snmpd.conf

cat /etc/snmp/snmpd.conf | grep -v "#" | sed -r '/^\s*$/d'

Dangerous Settings

Setting
Description

rwuser noauth

Full OID tree access, no auth needed

rwcommunity <string> <IPv4>

Full OID tree access for community string

rwcommunity6 <string> <IPv6>

Same for IPv6

Enumeration

SNMPwalk

  • Queries MIB values to retrieve info about managed devices

  • Requires a valid read-only community string at minimum

  • SNMPv1 query:

  • Query a single OID (e.g. sysName 1.3.6.1.2.1.1.5.0):

OneSixtyOne

  • Fast SNMP community string brute forcer — exploits the connectionless protocol

  • Provide a wordlist of community strings and a target IP

  • Use -i to provide a list of target IPs

  • Wordlist location:

Braa

  • Mass OID brute force tool

Nmap SNMP Scripts

Last updated