SNMP Enumeration

Overview

Simple Network Management Protocol (SNMP) is a network protocol used for monitoring and managing network devices. SNMP can reveal extensive information about network infrastructure, system configuration, and running processes, making it valuable for both administration and penetration testing.

Key Characteristics:

  • Port 161: SNMP (UDP) - Queries and commands

  • Port 162: SNMP Traps (UDP) - Unsolicited notifications

  • Versions: SNMPv1, SNMPv2c, SNMPv3

  • Authentication: Community strings (v1/v2c), user-based (v3)

  • Data Structure: Management Information Base (MIB)

SNMP Communication:

  • Traditional: Client actively requests information from server

  • Traps: Server sends data packets to client without explicit request

  • Addressing: Uses Object Identifiers (OIDs) for unique addressing

MIB (Management Information Base)

MIB is an independent format for storing device information in a standardized tree hierarchy. It contains:

  • Object Identifier (OID): Unique address for each object

  • Name: Human-readable identifier

  • Type: Data type specification

  • Access Rights: Read/write permissions

  • Description: Object functionality description

Key MIB Characteristics:

  • Written in Abstract Syntax Notation One (ASN.1) format

  • ASCII text-based

  • Explains where to find information and data types

  • Does not contain actual data, only structure definitions

OID (Object Identifier)

OIDs represent nodes in a hierarchical namespace using dot notation:

  • Structure: Sequence of numbers (e.g., 1.3.6.1.2.1.1.1.0)

  • Hierarchy: Longer chains = more specific information

  • Universal: Standardized across vendors and systems

  • Registry: Many OIDs documented in Object Identifier Registry

SNMP Versions

Version
Security
Authentication
Description

SNMPv1

None

Community string

Original version, no encryption, no built-in authentication

SNMPv2c

None

Community string

Improved performance, community-based, no encryption

SNMPv3

Yes

User-based

Username/password authentication, encryption via pre-shared key, high complexity

Detailed Version Analysis:

  • SNMPv1: First version, still used in small networks, supports information retrieval, device configuration, and traps, but lacks authentication and encryption

  • SNMPv2c: Extended version with additional functions, community string transmitted in plain text, no built-in encryption

  • SNMPv3: Significantly increased security with authentication and encryption, but also increased complexity requiring more configuration

Default Configuration

The default SNMP daemon configuration defines basic settings including IP addresses, ports, MIB, OIDs, authentication, and community strings.

Example SNMP Daemon Config (/etc/snmp/snmpd.conf)

Key Configuration Parameters:

  • sysLocation: Physical location description

  • sysContact: Administrative contact (often contains email)

  • sysServices: Services provided by the entity

  • agentaddress: IP addresses and ports for SNMP agent

  • rocommunity: Read-only community string configuration

  • rouser: Read-only user configuration for SNMPv3

Dangerous Settings

Some dangerous settings that administrators can configure with SNMP:

Setting
Description
Risk Level

rwuser noauth

Provides access to full OID tree without authentication

Critical

rwcommunity <community> <IPv4>

Provides access to full OID tree regardless of request source

Critical

rwcommunity6 <community> <IPv6>

Same as rwcommunity but for IPv6 addresses

Critical

High-Risk Configuration Examples:

Community Strings

Community strings act as passwords that determine whether requested information can be viewed or not. They are transmitted in plain text, making them vulnerable to interception.

Key Issues with Community Strings:

  • Lack of encryption in SNMPv1/v2c

  • Transmitted over network in plain text

  • Can be intercepted and read

  • Many organizations still use default values

  • Often bound to specific IP addresses but with predictable patterns

Common Default Community Strings

Community String Patterns:

  • Often named with hostname of the host

  • Sometimes include symbols to make identification harder

  • In large networks (100+ servers), labels follow patterns

  • Can be brute-forced using custom wordlists

Enumeration Techniques

1. Service Detection

2. Community String Brute Force

3. SNMP Walking

4. Specific Information Gathering

5. Using Braa for OID Brute Forcing

6. Detailed SNMP Walking with Real Output

Important OIDs (Object Identifiers)

System Information OIDs

Network Information OIDs

Process and Service OIDs

Advanced Enumeration

Using Nmap NSE Scripts

Custom OID Queries

Information Extraction

System Administrator Contact

Custom Version Information

Running Processes and Scripts

Practical Examples

HTB Academy Style Enumeration

HTB Academy Lab Questions Examples

Real Output Analysis from HTB Academy

Information Parsing

Security Assessment

Common Vulnerabilities

  1. Default Community Strings: Using default "public" or "private"

  2. Information Disclosure: Excessive information exposure

  3. Weak Community Strings: Easily guessable strings

  4. SNMPv1/v2c Usage: Unencrypted protocols

  5. Write Access: Unauthorized configuration changes

Community String Testing

Enumeration Checklist

Initial Discovery

Information Gathering

Detailed Analysis

Security Testing

Tools and Techniques

Essential SNMP Tools

Tool Installation and Usage

Custom Scripts

Defensive Measures

Secure SNMP Configuration

Best Practices

  1. Use SNMPv3: Implement encryption and authentication

  2. Strong Community Strings: Use complex, unique strings

  3. Access Controls: Limit SNMP access by IP/network

  4. Minimal Exposure: Only expose necessary information

  5. Regular Audits: Monitor SNMP access and configuration

Detection and Monitoring

Common Attack Vectors

1. Information Gathering

  • Network topology discovery

  • System configuration extraction

  • User account enumeration

  • Process and service identification

2. Credential Harvesting

  • Extract stored passwords

  • Identify service accounts

  • Discover configuration files

  • Find backup credentials

3. Network Reconnaissance

  • ARP table analysis

  • Routing table examination

  • Interface configuration review

  • Network device identification

Last updated