~/service-snmp

SNMP

CPTS Notes3 min read

TL;DR

SNMP (Simple Network Management Protocol). Monitors and manages network devices. UDP 161 for queries, UDP 162 for traps. v1 and v2c authenticate with a plaintext community string and no encryption. v3 adds real authentication and encryption. The default strings are public (read-only) and private (read-write). The device’s data lives in the MIB (Management Information Base), a tree of objects, each addressed by a numbered OID.

First checks: the community string (try public and private, then brute), then walk the MIB.

Enumeration

Workflow: find the community string, then walk the MIB.

Find the community string. Brute a wordlist fast:

onesixtyone -c /usr/share/seclists/Discovery/SNMP/snmp.txt $TARGET # brute community strings

-c takes a community-string list. SecLists ships one at Discovery/SNMP/snmp.txt.

Walk the MIB.

snmpwalk -v2c -c public $TARGET # walk the whole MIB
snmpbulkwalk -v2c -c public $TARGET # pull records in bulk, quicker than snmpwalk
braa public@$TARGET:.1.3.6.* # query the whole subtree fast, needs a known string

-v2c sets the version, -c the community string.

Formatted enumeration.

snmp-check $TARGET -c public # users, processes, software, and network info, readable

Nmap covers the same ground:

sudo nmap -sU -p161 --script snmp-info,snmp-processes,snmp-win32-software -oA scans/snmp $TARGET # same data through NSE

Grep the walk for these objects:

Object Gives
sysDescr OS and device description.
sysContact Admin name or email, often a username.
hrSWRunName Running process names.
hrSWRunParameters Process command-line arguments, which often leak passwords.
hrSWInstalledName Installed software and versions.

Common misconfigurations

  • Default community strings (public, private).
  • A read-write community (private) reachable from the network.
  • SNMPv1 or v2c on an untrusted network, so the community string crosses in cleartext.
  • A verbose MIB that exposes processes, software, and credentials.

Attack playbook

SNMP’s win is the information it leaks. Search the MIB.

  1. Get the community string. Try public and private, then brute with onesixtyone. Everything else needs it.
  2. Walk and search. snmpwalk the whole MIB. The usual win is a credential in a process command-line argument (hrSWRunParameters) or a config value.
  3. Read users and software. Local accounts feed password spraying. Installed software and versions point at other exploits.
  4. Write with private. A read-write community lets you change device config. Rare on HTB.

Practice boxes

Box Difficulty SNMP’s role
Mischief Easy snmpwalk -c public returns a login credential.
Pit Medium Default public string on SNMPv1 reveals a web path to enumerate.

Everything in SNMP needs the community string. With public, walk the MIB for the host’s processes, software, and config.