Friday, June 6, 2008

SNMP Hacking

I've spent a lot of time exploring alternative attacking
methods other than the traditional flaws. One of the routes I've really enjoyed exploring has been SNMP attacks. I thought I'd give an overview for those who are not very familiar with the subject.

Simple Network Management Protocol (SNMP) is an application-layer protocol for managing TCP/IP based networks. SNMP runs over UDP (which runs over IP). Most administrators/security guys fail to understand SNMP and its security impacts.

What is SNMP Used For?
SNMP is a protocol that is simply used to manage multiple devices on enterprise networks; i.e. where the administrative software can contact each device via SNMP and retrieve its status and diagnostic information. This way an administrator can keep an eye on all of his/her devices without much effort. Also with the "write string" mentioned below they can use it to change configuration information over a large number of devices.

Does SNMP Use Authentication?
SNMP uses community strings as a key or password. Provide the right string and gain a different level of access.

By default there is the "public" string that is enabled on most servers and "private" string that is enabled on some servers. It is possible however, to brute-force SNMP community strings.

"public" and "private" strings will generally give you read-only access, however this can be fairly dangerous also (as seen in one of the examples below). Brute-forcing the write access strings is easy as SNMP is over the UDP protocol. The speed of attack can be improved significantly then one that is done over TCP and the Source IP can be easily spoofed.

OID: Is a string (series of numbers, seperated by ".") that is used to tell the device what information you want. Different devices have different OIDs.

The ThreatSNMP "walking" is very dangerous even with read-only access. Windows servers disclosed full list of user-names via SNMP walking the oid "". There exist many tools intended for the purpose of bruteforcing and identifying OIDs once a weak SNMP Server is found. This can be used to identify and modify a lot of sensitive information on the device.

There are many tools that are included in the SNMPWalk kit for different purposes. I will walk through SNScan from Foundstone and SNMPWalk.

SNScanSNMP Scanner that can be used to scan IP ranges for SNMP Servers with weak strings, including a brute-force feature.

The snmpwalk command is designed to perform a sequence of chained GETNEXT requests automatically, rather than having to issue the necessary snmpgetnext requests by hand.

Simply: It is able to identify the various OID strings and retrieve their content.

D:\snmp>snmpwalk test.yash-home public
.iso. = "Linux test.yash-home 2.6.9-023stab046.2 #1 Mon Dec 10 14:51
:29 MSK 2007 i686"
.iso. = OID: .iso.
.iso. = Timeticks: (248307958) 28 days, 17:44:39.58
.iso. = "Root (configure /etc/snmp/
.iso. = "test.yash-home"
.iso. = "Unknown (edit /etc/snmp/snmpd.conf)"
.iso. = Timeticks: (11) 0:00:00.11
.iso. = OID: .iso.
.iso. = OID: .iso.
.iso. = OID: .iso.
.iso. = OID: .iso.
.iso. = OID: .iso.
.iso. = OID: .iso.
.iso. = OID: .iso.
.iso. = OID: .iso.
.iso. = "The MIB module for SNMPv2 entities"
.iso. = "The MIB module for managing TCP implementations"
.iso. = "The MIB module for managing IP and ICMP implementati
.iso. = "The MIB module for managing UDP implementations"
.iso. = "View-based Access Control Model for SNMP."
.iso. = "The SNMP Management Architecture MIB."
.iso. = "The MIB for Message Processing and Dispatching."
.iso. = "The management information definitions for the SNMP
User-based Security Model."
.iso. = Timeticks: (11) 0:00:00.11
.iso. = Timeticks: (11) 0:00:00.11
.iso. = Timeticks: (11) 0:00:00.11
.iso. = Timeticks: (11) 0:00:00.11
.iso. = Timeticks: (11) 0:00:00.11
.iso. = Timeticks: (11) 0:00:00.11
.iso. = Timeticks: (11) 0:00:00.11
.iso. = Timeticks: (11) 0:00:00.11
.iso. = Timeticks: (248309155) 28 days, 17:44:51.55
End of MIB

D:\snmp>snmpwalk testios.yash public
.iso. = "Cisco Internetwork Operating System Software ..IOS (tm)
7200 Software (C7200-IK9O3S-M), Version 12.3(9b), RELEASE SOFTWARE (fc1)..Copyri
ght (c) 1986-2004 by cisco Systems, Inc...Compiled Wed 18-Aug-04 15:31 by dchih"

...... followed by a long list of information such as processes, users, modules, ports, etc.

D:\snmp>snmpwalk hp.yash public
.iso. = "HP-UX gedis1 B.10.20 A 9000/803 2013446997"
.iso. = OID: .iso.
.iso. = Timeticks: (2955823000) 342 days, 2:37:10.00

D:\snmp>snmpwalk snmp.yash public
.iso. = "Sun SNMP Agent, Sun-Fire-480R"
.iso. = OID: .iso.
.iso. = Timeticks: (422632606) 48 days, 21:58:46.06
.iso. = "System administrator"
.iso. = "mu-me01-ns-ctm001"
.iso. = "System administrators office"

D:\snmp>snmpwalk win.yash public
.iso. = "Hardware: x86 Family 15 Model 4 Stepping 1 AT/A
BLE - Software: Windows 2000 Version 5.0 (Build 2195 Uniprocessor Free)"
.iso. = OID: .iso.
.iso. = Timeticks: (466602853) 54 days, 0:07:08.53

Anyway as you can see a LOT of information was revealed via SNMPWalking; and in the case of many other devices much more sensitive information can be disclosed.

For e.g:
Windows servers return the full list of user names by snmwalking the OID

BT Voyager 2000 router leaking the ISP credentials including the password.

HP JetDirect printers leaking the admin password via SNMP read access (using OIDs .iso. and .

Dynamic DNS credentials disclosure on ZyXEL Prestige routers via the OID

SNMP servers contain a lot of information, in many cases revealing passwords and other sensitive information. However most security consultants are unaware of what SNMP Security is and how it can be used by hackers to manipulate your networks and systems.

I am working on a paper on SNMP Security that will be published soon on Security Brigade's Website.


hardwire187 said...

Excellent! Thank you...