SNMP
CPTS Notes
- Foundations
- Enumeration with Nmap
- Passwords
- Wordlists
- Cracking
- Protected Files
- Spraying and Defaults
- Hunting (Windows)
- Hunting (Linux)
- Hunting (Shares)
- Hunting (Traffic)
- Looting (Windows)
- Looting (Linux)
- File Services
- FTP
- SMB
- NFS
- Rsync
- Network
- DNS
- SNMP
- SMTP
- Mail Retrieval
- Cloud Mail
- Databases
- MySQL
- MSSQL
- Remote Access
- SSH
- R-Services
- RDP
- WinRM
- WMI
- Linux
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- File Transfer
- Choosing a Method
- Serving Files
- Windows Transfers
- Linux Transfers
- Code One-Liners
- Session Transfers
- Protected Transfers
- Detection & Evasion
- Windows
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- Reference
- Port References
- DNS Resolution
- The Mail Pipeline
- SMB & NetBIOS
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 MIBsnmpbulkwalk -v2c -c public $TARGET # pull records in bulk, quicker than snmpwalkbraa 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, readableNmap covers the same ground:
sudo nmap -sU -p161 --script snmp-info,snmp-processes,snmp-win32-software -oA scans/snmp $TARGET # same data through NSEGrep 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.
- Get the community string. Try
publicandprivate, then brute withonesixtyone. Everything else needs it. - Walk and search.
snmpwalkthe whole MIB. The usual win is a credential in a process command-line argument (hrSWRunParameters) or a config value. - Read users and software. Local accounts feed password spraying. Installed software and versions point at other exploits.
- 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.