# SNMP decoded: versions, communities, MIBs, OIDs and traps, byte by byte

> The Simple Network Management Protocol read the way the wire carries it: the three versions and what each puts in the message, the Basic Encoding Rules that turn every field into tag, length and value, a GetRequest for sysDescr.0 decoded byte by byte with its community string visible in the clear, an object identifier encoded by hand, a MIB definition read line by line, a table walked with GetNext and GetBulk, a linkDown trap decoded, the SNMPv3 message with its discovery, key localization and the View-based Access Control Model's decision, and the security record from the 2002 PROTOS findings to the 2023 advisory on APT28. After it you can decode an SNMP packet by hand, predict what a walk returns, and say what an observer on the path learns from each version.

Source: https://ronutz.com/en/learn/snmp-decoded-ber-pdus-oids-and-traps  
Updated: 2026-11-23  
Related tools: https://ronutz.com/en/tools/snmp-counter-wrap-calculator

---

This part of NetFun III picks up where [SNMP on network devices](https://ronutz.com/en/learn/snmp-on-network-devices) leaves off. That article configures the Simple Network Management Protocol (SNMP) on switches and routers, compares its three versions and their algorithms, and ends with a checklist for a fleet; the series itself starts from [the five numbers that name a conversation](https://ronutz.com/en/learn/ports-sockets-and-the-five-tuple) and climbs the stack. This part opens the packets. It shows how a manager's question and an agent's answer are encoded with the Basic Encoding Rules (BER) of Abstract Syntax Notation One (ASN.1), decodes a GetRequest and its Response byte by byte, encodes an object identifier (OID) by hand, reads a management information base (MIB) definition, walks a table, decodes a trap, and then does the same for the third version, where the community string gives way to users, keys and views. After it you should be able to take a hex dump of an SNMP datagram and say what every byte means, predict what a walk will return and where it will stop, and say exactly what an observer on the path can read in each version. The history of how the protocol came to be, and why its security took so long, is told in [the observability family history](https://ronutz.com/en/learn/observability-family-history); it is not repeated here.

## The model in one paragraph

SNMP has one manager and many agents. The agent, on the managed device, answers on [User Datagram Protocol (UDP)](https://ronutz.com/en/learn/udp-the-protocol-that-is-a-header) port 161; notifications travel the other way, to UDP port 162 on the manager. RFC (Request for Comments) 1157 of May 1990, the specification of version 1 by Jeffrey Case, Mark Fedor, Martin Schoffstall and James Davin, says it in one sentence: "A protocol entity receives messages at UDP port 161 on the host with which it is associated for all messages except for those which report traps", and "Messages which report traps should be received on UDP port 162" ([RFC 1157, section 4](https://www.rfc-editor.org/rfc/rfc1157.txt)). Everything the agent can report is a managed object, defined in a MIB and named by an OID, a path of numbers through a tree that the whole industry shares. Each message, the same RFC says, is "entirely and independently represented within a single UDP datagram using the basic encoding rules of ASN.1", and consists of "a version identifier, an SNMP community name, and a protocol data unit (PDU)". The rest of this part is those three things, as bytes.

| | Version 1 | Version 2c | Version 3 |
|---|---|---|---|
| Specification | RFC 1157, May 1990 | RFC 1901, January 1996, Experimental | RFCs 3411 to 3418, December 2002, Internet Standard 62 |
| `version` field on the wire | 0 | 1 | 3 |
| What authorizes a request | a community name, sent in clear | a community name, sent in clear | a user, with optional authentication and encryption |
| Operations added | GetRequest, GetNextRequest, GetResponse, SetRequest, Trap | GetBulkRequest, InformRequest, SNMPv2-Trap, Report | the same PDUs inside a new envelope |

The version values come from the message definitions themselves: version 1 declares `version-1(0)` ([RFC 1157, section 4](https://www.rfc-editor.org/rfc/rfc1157.txt)), community-based version 2 declares `version(1)  -- modified from RFC 1157` ([RFC 1901, section 3](https://www.rfc-editor.org/rfc/rfc1901.txt)), and the version 3 message "is set to snmpv3(3)" ([RFC 3412, section 6.1](https://www.rfc-editor.org/rfc/rfc3412.txt)). So the first INTEGER of any SNMP message tells a receiver which of the three it is reading: 0, 1 or 3. The status of each version in the RFC index, and the algorithms version 3 offers, are in [SNMP on network devices](https://ronutz.com/en/learn/snmp-on-network-devices).

## BER: everything is tag, length, value

ASN.1 describes data structures; BER turns them into bytes. The rules are in the International Telecommunication Union's Recommendation X.690 (here the July 2002 edition, identical to ISO/IEC 8825-1), and they come down to one pattern repeated at every level: an identifier octet, length octets, and contents ([ITU-T X.690 (07/2002), clause 8.1](https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf)).

**The identifier octet.** For tag numbers from 0 to 30, a single octet carries everything: "bits 8 and 7 shall be encoded to represent the class of the tag", "bit 6 shall be a zero or a one" for primitive or constructed, and "bits 5 to 1 shall encode the number of the tag" (X.690, clause 8.1.2.2). The four classes are universal (00), application (01), context-specific (10) and private (11), and "Bit 6 shall be set to zero if the encoding is primitive, and shall be set to one if the encoding is constructed" (clause 8.1.2.5). So one byte tells you what kind of thing follows and whether it contains other things.

**The length octets.** If the contents are 127 octets or fewer, one octet gives the count, "bit 8 is zero and bits 7 to 1 encode the number of octets" (clause 8.1.3.4). Longer contents use the long form: a first octet with bit 8 set and the number of length octets in bits 7 to 1, then the length itself. X.690's own example is a length of 201, encoded as `81 C9` (clause 8.1.3.5). BER also allows an indefinite form ended by two zero octets; SNMP forbids it: "only the definite form is used; use of the indefinite form encoding is prohibited" ([RFC 3417, section 8](https://www.rfc-editor.org/rfc/rfc3417.txt)).

**The contents.** An INTEGER is "a two's complement binary number" in the fewest octets: the first nine bits "shall not all be ones" and "shall not all be zero" (X.690, clauses 8.3.2 and 8.3.3). That rule is why 127 encodes as `02 01 7F` but 128 needs `02 02 00 80`: without the leading zero, `80` would be read as minus 128. An OBJECT IDENTIFIER has its own packing, shown below in full. SNMP adds one more restriction: "the primitive form shall be used for all simple types", and the constructed form "only for structured types, i.e., a SEQUENCE or an IMPLICIT SEQUENCE" (RFC 3417, section 8).

The tags you will meet in SNMP, with the identifier byte each produces:

| Type | Class and form | Tag number | Identifier byte | Defined in |
|---|---|---|---|---|
| INTEGER | universal, primitive | 2 | `02` | X.680, Table 1 |
| OCTET STRING | universal, primitive | 4 | `04` | X.680, Table 1 |
| NULL | universal, primitive | 5 | `05` | X.680, Table 1 |
| OBJECT IDENTIFIER | universal, primitive | 6 | `06` | X.680, Table 1 |
| SEQUENCE | universal, constructed | 16 | `30` | X.680, Table 1 |
| IpAddress | application, primitive | 0 | `40` | RFC 2578 |
| Counter32 | application, primitive | 1 | `41` | RFC 2578 |
| Gauge32 and Unsigned32 | application, primitive | 2 | `42` | RFC 2578 |
| TimeTicks | application, primitive | 3 | `43` | RFC 2578 |
| Opaque | application, primitive | 4 | `44` | RFC 2578 |
| Counter64 | application, primitive | 6 | `46` | RFC 2578 |
| GetRequest to Report PDUs | context-specific, constructed | 0 to 8 | `A0` to `A8` | RFC 3416 |
| noSuchObject, noSuchInstance, endOfMibView | context-specific, primitive | 0, 1, 2 | `80`, `81`, `82` | RFC 3416 |

The universal numbers are Table 1 of Recommendation X.680 ([ITU-T X.680 (07/2002), Table 1](https://www.itu.int/ITU-T/studygroups/com17/languages/X.680-0207.pdf)). The application types are SNMP's own, from the Structure of Management Information version 2 (SMIv2): "IpAddress ::= [APPLICATION 0] IMPLICIT OCTET STRING (SIZE (4))", Counter32 at 1 ("this wraps"), Gauge32 at 2 ("this doesn't wrap"), Unsigned32 also at 2 and "indistinguishable from Gauge32", TimeTicks at 3 ("hundredths of seconds since an epoch"), Opaque at 4 ("for backward-compatibility only") and Counter64 at 6 ("for counters that wrap in less than one hour with only 32 bits") ([RFC 2578, section 2](https://www.rfc-editor.org/rfc/rfc2578.txt)). Application tag 5 is not used in SMIv2. The PDU tags and the three exception values are in the protocol operations document, quoted below. If you have read certificates in Distinguished Encoding Rules (DER), a stricter subset of BER, the pattern is the same one [the X.509 anatomy](https://ronutz.com/en/learn/x509-anatomy) walks; SNMP is the friendlier place to learn it, because its messages are short.

## A GetRequest decoded byte by byte

The request below asks an agent for sysDescr.0, the device's own description, using SNMPv2c and the community `public`, with request identifier 200. It is 41 bytes long, and every byte of it was encoded by hand from the rules above and checked by a short script:

```
30 27 02 01 01 04 06 70 75 62 6c 69 63 a0 1a 02
02 00 c8 02 01 00 02 01 00 30 0e 30 0c 06 08 2b
06 01 02 01 01 01 00 05 00
```

Read it from the outside in:

| Offset | Bytes | Field | What it says |
|---|---|---|---|
| 0 | `30 27` | Message, SEQUENCE | universal, constructed, tag 16; 39 octets follow |
| 2 | `02 01 01` | version, INTEGER | 1, which means SNMPv2c (version 1 would be 0) |
| 5 | `04 06` | community, OCTET STRING | 6 octets follow |
| 7 | `70 75 62 6c 69 63` | the community name | ASCII "public", readable by anyone who sees the datagram |
| 13 | `a0 1a` | GetRequest-PDU, tag [0] | context-specific, constructed; 26 octets follow |
| 15 | `02 02 00 c8` | request-id, INTEGER | 200; the `00` keeps `c8` from being read as negative |
| 19 | `02 01 00` | error-status, INTEGER | 0, as every request must carry |
| 22 | `02 01 00` | error-index, INTEGER | 0 |
| 25 | `30 0e` | variable-bindings, SEQUENCE OF | 14 octets follow |
| 27 | `30 0c` | one VarBind, SEQUENCE | 12 octets follow |
| 29 | `06 08` | name, OBJECT IDENTIFIER | 8 octets follow |
| 31 | `2b 06 01 02 01 01 01 00` | the OID | 1.3.6.1.2.1.1.1.0, sysDescr.0 (decoded in the next section) |
| 39 | `05 00` | value, NULL | a request carries no value |

The structure is the one RFC 3416 defines. Every PDU but one is "[n] IMPLICIT PDU", where PDU is a SEQUENCE of request-id, error-status, error-index and variable-bindings, and the tags run "GetRequest-PDU ::= [0]", "GetNextRequest-PDU ::= [1]", "Response-PDU ::= [2]", "SetRequest-PDU ::= [3]", "-- [4] is obsolete", "GetBulkRequest-PDU ::= [5]", "InformRequest-PDU ::= [6]", "SNMPv2-Trap-PDU ::= [7]" and "Report-PDU ::= [8]" ([RFC 3416, section 3](https://www.rfc-editor.org/rfc/rfc3416.txt)). Tag 4 was version 1's Trap-PDU, whose layout differs; it appears again below. Version 1 had already asked for the NULL: in a request "the value portion of the binding is ignored", and "It is recommended that the ASN.1 value NULL be used" ([RFC 1157, section 4.1.1](https://www.rfc-editor.org/rfc/rfc1157.txt)).

The answer, from an agent whose sysDescr is "Fred Router 1.0" (the name is a nod to the RFCs' own example vendor), is 56 bytes:

```
30 36 02 01 01 04 06 70 75 62 6c 69 63 a2 29 02
02 00 c8 02 01 00 02 01 00 30 1d 30 1b 06 08 2b
06 01 02 01 01 01 00 04 0f 46 72 65 64 20 52 6f
75 74 65 72 20 31 2e 30
```

Four things changed. The PDU tag is `a2`, a Response. The request-id is the same 200: "By use of the RequestID, an SNMP application entity can correlate incoming responses with outstanding requests", and on an unreliable datagram service it "also provides a simple means of identifying messages duplicated by the network" ([RFC 1157, section 4.1.1](https://www.rfc-editor.org/rfc/rfc1157.txt)). The NULL, two octets, became `04 0f` and fifteen ASCII octets, seventeen in all. And every enclosing length grew by the same fifteen octets, `27` to `36`, `1a` to `29`, `0e` to `1d`, `0c` to `1b`, which is why a decoder must always work from the lengths and never from fixed offsets.

The community name sits at offset 7, in the clear, in both directions. That is the whole of version 1 and 2c security. RFC 1157 said as much in 1990: some implementations "may wish to support only a trivial authentication service that identifies all SNMP messages as authentic SNMP messages", while "effective management of administrative relationships" needs authentication "able to identify authentic SNMP messages with a high degree of certainty" ([RFC 1157, section 3.2.5](https://www.rfc-editor.org/rfc/rfc1157.txt)). Twelve years later the standards body called versions 1 and 2c "fundamentally insecure" and declared them Historic ([RFC 3410, section 8.2](https://www.rfc-editor.org/rfc/rfc3410.txt)). The OID in this example is no accident, either: it is the one the Brazilian Network Information Centre (NIC.br) tells operators to query from outside their own network, as `snmpget -v 2c -c public IP_SNMP iso.3.6.1.2.1.1.1.0`, to check whether a device answers strangers ([NIC.br, Programme for a Safer Internet, Amplification (in Portuguese)](https://bcp.nic.br/i+seg/acoes/amplificacao/)). The request it sends is, byte for byte, the 41 bytes above with a different request-id.

## An OID encoded by hand

An OBJECT IDENTIFIER is "an ordered list of non-negative numbers", each a sub-identifier; SMIv2 allows "at most 128 sub-identifiers in a value", each up to "2^32-1 (4294967295 decimal)", and the first is always 0, 1 or 2 ([RFC 2578, section 3.5](https://www.rfc-editor.org/rfc/rfc2578.txt)). X.690 packs them in two steps.

First, the first two arcs become one number: "(X*40) + Y" (X.690, clause 8.19.4). For every SNMP OID that starts 1.3, that is 1 × 40 + 3 = 43, hexadecimal `2B`, which is why every SNMP OID on the wire starts with `2b`. The packing works because "only three values are allocated from the root node, and at most 39 subsequent values from nodes reached by X = 0 and X = 1" (the same clause's note).

Second, every sub-identifier is written in base 128, most significant group first: "Bit 8 of each octet indicates whether it is the last in the series: bit 8 of the last octet is zero; bit 8 of each preceding octet is one", in "the fewest possible octets" (X.690, clause 8.19.2). Numbers below 128 therefore take one octet and look like themselves. sysDescr.0, 1.3.6.1.2.1.1.1.0, becomes `2B 06 01 02 01 01 01 00`: eight octets for ten arcs.

The interesting case is a number of 128 or more. Juniper Networks' private enterprise number is 2636, and IANA's registry of private enterprise numbers, updated on 23 November 2026, lists it beside "ciscoSystems" at 9 and "HUAWEI Technology Co.,Ltd" at 2011, under the prefix 1.3.6.1.4.1 ([IANA, Private Enterprise Numbers](https://www.iana.org/assignments/enterprise-numbers.txt)). Encoding 1.3.6.1.4.1.2636:

1. 2636 ÷ 128 = 20, remainder 76. So the base-128 digits are 20 and 76.
2. 20 is `0x14`; it is not the last group, so set bit 8: `0x14 + 0x80 = 0x94`.
3. 76 is `0x4C`; it is the last group, so bit 8 stays clear: `0x4C`.
4. The whole value: `2B 06 01 04 01 94 4C`, seven octets, and with tag and length `06 07 2B 06 01 04 01 94 4C`.

Cisco's 1.3.6.1.4.1.9 is simply `06 06 2B 06 01 04 01 09`. To decode, run the steps backwards: collect octets until one has bit 8 clear, then compute (0x94 − 0x80) × 128 + 0x4C = 20 × 128 + 76 = 2636. X.690 gives its own test vector, which any decoder should pass: `{2 100 3}` encodes as `06 03 81 34 03`, because 2 × 40 + 100 = 180 = 1 × 128 + 52, and 52 is `0x34` (X.690, clause 8.19.5, example). Note what the arithmetic does to the first octet: an OID under the arc 2 can have a first sub-identifier above 127, and a decoder that assumes the first octet is always one byte will break on it.

The registry these numbers come from is large: its entries run from 0 to 67,764 in the copy read on 23 November 2026 (IANA, as above). Every vendor's private MIB hangs from one of them, and it is that number in sysObjectID, "allocated within the SMI enterprises subtree (1.3.6.1.4.1)", that tells a manager "`what kind of box' is being managed" ([RFC 3418, section 2](https://www.rfc-editor.org/rfc/rfc3418.txt)).

## Reading a MIB definition

A MIB module is ASN.1 text that a compiler turns into the names and types a manager displays. Here is sysDescr as RFC 3418 defines it:

```
sysDescr OBJECT-TYPE
    SYNTAX      DisplayString (SIZE (0..255))
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
            "A textual description of the entity.  This value should
            include the full name and version identification of
            the system's hardware type, software operating-system,
            and networking software."
    ::= { system 1 }
```

Each clause answers one question. SYNTAX is the type on the wire: DisplayString is a textual convention for printable text, carried as an OCTET STRING, which is why the Response above held tag `04`. MAX-ACCESS says what may be done with it; read-only means a SetRequest will fail. STATUS says whether the definition is still in force. The last line is the name: object 1 under `system`, which RFC 3418 defines as `{ mib-2 1 }` ([RFC 3418, section 2](https://www.rfc-editor.org/rfc/rfc3418.txt)). Following the parents up the tree gives the full path, every link of which is in RFC 2578: `internet` is `{ dod 1 }` under `{ org 6 }` under `{ iso 3 }`, `mgmt` is `{ internet 2 }` and `mib-2` is `{ mgmt 1 }`. So sysDescr is iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).system(1).sysDescr(1), that is 1.3.6.1.2.1.1.1 ([RFC 2578, section 2](https://www.rfc-editor.org/rfc/rfc2578.txt)). The other branches under `internet` matter too: `private` is `{ internet 4 }` with `enterprises` at `{ private 1 }`, and `snmpV2` is `{ internet 6 }`, where the SNMP framework's own modules live.

Why the extra `.0` in the request? Because the OID of an object type names the type, not a value. "For leaf objects which are not columnar objects (i.e., not contained within a conceptual table), instances of the object are identified by appending a sub-identifier of zero to the name of that object. Otherwise, the INDEX clause of the conceptual row object superior to a columnar object defines instance identification information" ([RFC 2578, section 7](https://www.rfc-editor.org/rfc/rfc2578.txt)). A scalar has one instance, `.0`. A column has one instance per row, named by the row's index. In the Interfaces Group MIB, `interfaces` is `{ mib-2 2 }`, `ifTable` is `{ interfaces 2 }`, `ifEntry` is `{ ifTable 1 }` and its columns follow: `ifIndex` is `{ ifEntry 1 }`, `ifDescr` `{ ifEntry 2 }`, `ifAdminStatus` `{ ifEntry 7 }`, `ifOperStatus` `{ ifEntry 8 }` ([RFC 2863, section 6](https://www.rfc-editor.org/rfc/rfc2863.txt)). The description of the interface whose ifIndex is 5 is therefore 1.3.6.1.2.1.2.2.1.2.5: the column's OID, then the index.

Some objects carry arithmetic in their definition. sysServices is "a sum": "for each layer, L, in the range 1 through 7, that this node performs transactions for, 2 raised to (L - 1) is added to the sum". RFC 3418 gives two examples, a node that only routes, with 4 (2 to the power 2), and "a host offering application services", with 72, which is 8 for layer 4 plus 64 for layer 7 ([RFC 3418, section 2](https://www.rfc-editor.org/rfc/rfc3418.txt)). A layer 3 switch that bridges and routes would report 2 + 4 = 6; a value of 78 means 2 + 4 + 8 + 64, a box that bridges, routes, terminates transport connections and offers applications. It is a seven-bit field, and reading it is a quick way to see what a device claims to be.

## Walking: GetNext and the order of the tree

A manager rarely knows every instance in advance. It walks. GetNextRequest asks not for the object named but for the one after it: the agent returns "that object whose name is, in the lexicographical ordering of the names of all objects available for get operations in the relevant MIB view, together with the value of the name field of the given component, the immediate successor to that value" ([RFC 1157, section 4.1.3](https://www.rfc-editor.org/rfc/rfc1157.txt)).

Lexicographic order on OIDs compares arc by arc, as numbers, not as text. RFC 1157's own example shows why that matters. It walks a routing table of three entries, 10.0.0.99, 9.1.2.3 and 10.0.0.51, indexed by destination address, asking for three columns at once (`ipRouteDest`, `ipRouteNextHop`, `ipRouteMetric1`). The answers come back in this order: first the row indexed 9.1.2.3, then 10.0.0.51, then 10.0.0.99; and the fourth request, starting after 10.0.0.99, gets back "those objects that are next in the lexicographical ordering of the known object names", which "signals the end of the routing table to the management station" ([RFC 1157, section 4.1.3.1](https://www.rfc-editor.org/rfc/rfc1157.txt)). Compared as strings, "10.0.0.51" would sort before "9.1.2.3"; compared arc by arc, 9 is less than 10 and wins. And between 10.0.0.51 and 10.0.0.99 the first three arcs tie and 51 is less than 99.

The same procedure walks a subtree. Starting a walk of the system group at 1.3.6.1.2.1.1 produces, on an agent that implements the group:

| Request (GetNext of) | Response name | Object |
|---|---|---|
| 1.3.6.1.2.1.1 | 1.3.6.1.2.1.1.1.0 | sysDescr.0 |
| 1.3.6.1.2.1.1.1.0 | 1.3.6.1.2.1.1.2.0 | sysObjectID.0 |
| 1.3.6.1.2.1.1.2.0 | 1.3.6.1.2.1.1.3.0 | sysUpTime.0 |
| 1.3.6.1.2.1.1.3.0 | 1.3.6.1.2.1.1.4.0 | sysContact.0 |
| 1.3.6.1.2.1.1.4.0 | 1.3.6.1.2.1.1.5.0 | sysName.0 |
| 1.3.6.1.2.1.1.5.0 | 1.3.6.1.2.1.1.6.0 | sysLocation.0 |
| 1.3.6.1.2.1.1.6.0 | 1.3.6.1.2.1.1.7.0 | sysServices.0 |
| 1.3.6.1.2.1.1.7.0 | the next object after the group | the walk has left the subtree and stops |

The objects and their numbers 1 to 7 are RFC 3418's ([RFC 3418, section 2](https://www.rfc-editor.org/rfc/rfc3418.txt)); what follows sysServices.0 depends on what else the agent implements, often the sysORTable at 1.3.6.1.2.1.1.8 or the interfaces group at 1.3.6.1.2.1.2. That is the stopping rule a walking tool applies: Net-SNMP's `snmpwalk`, "an SNMP application that uses SNMP GETNEXT requests to query a network entity for a tree of information", queries "All variables in the subtree below the given OID" and, with no OID given, searches "the subtree rooted at SNMPv2-SMI::mib-2" ([Net-SNMP, snmpwalk manual page](http://www.net-snmp.org/docs/man/snmpwalk.html)). It stops when the name in a response no longer starts with the OID it was given.

Version 2 added a cleaner end. When there is nothing after the requested name, the agent returns the special value `endOfMibView` instead of an object from elsewhere, and when a Get names something that does not exist it answers `noSuchObject` or `noSuchInstance`; these are the context-specific primitive tags 0, 1 and 2 in the VarBind's value, "noSuchObject [0] IMPLICIT NULL, noSuchInstance [1] IMPLICIT NULL, endOfMibView [2] IMPLICIT NULL", encoded `80 00`, `81 00` and `82 00` ([RFC 3416, section 3](https://www.rfc-editor.org/rfc/rfc3416.txt)). Version 1 had only the error-status `noSuchName(2)` for all three cases, and an error that failed the whole request.

## GetBulk: N + M × R

One GetNext per object is slow over a long round trip, and version 2 added GetBulkRequest to ask for many successors at once. Its PDU reuses the two zero fields of a request as `non-repeaters` and `max-repetitions`. RFC 3416 gives the arithmetic: the response carries up to "N + (M * R)" bindings, where N is the smaller of non-repeaters and the number of bindings in the request, M is max-repetitions, and R is the number of remaining bindings ([RFC 3416, section 4.2.3](https://www.rfc-editor.org/rfc/rfc3416.txt)). The first N bindings are treated as single GetNexts; each of the other R is repeated M times.

RFC 3416's example asks with non-repeaters 1 and max-repetitions 2 for `sysUpTime`, `ipNetToMediaPhysAddress` and `ipNetToMediaType`. N = 1, R = 2, M = 2, so the answer holds 1 + 2 × 2 = 5 bindings: sysUpTime.0, then two rows of the address table, each with its physical address and type. The second request, starting from the last row returned, again gets five bindings, but two of them come from outside the table, `ipNetToMediaNetAddress.1.9.2.3.4` from the next column and `ipRoutingDiscards.0` from the next object, which "signals the end of the table to the command generator application" ([RFC 3416, section 4.2.3.1](https://www.rfc-editor.org/rfc/rfc3416.txt)). Net-SNMP's `snmpbulkwalk` does this "to query a network entity efficiently for a tree of information" ([Net-SNMP, snmpbulkwalk manual page](http://www.net-snmp.org/docs/man/snmpbulkwalk.html)).

The same RFC warns about the cost. Large responses may exceed the path's maximum transmission unit (MTU) and be fragmented, "Fragmentation is generally considered to be harmful", and so "under conditions of network stress, only small values should be used for max-repetitions" ([RFC 3416, section 2.3](https://www.rfc-editor.org/rfc/rfc3416.txt)). An attacker reads the same arithmetic the other way: a small request that names a large M produces a large answer, sent to whatever source address the request claimed. The security record below comes back to it.

## Errors: what the agent says when it says no

Every response carries an error-status and an error-index. Version 1 had six statuses: "noError(0), tooBig(1), noSuchName(2), badValue(3), readOnly(4) genErr(5)" (the missing comma is in the RFC) ([RFC 1157, section 4.1.1](https://www.rfc-editor.org/rfc/rfc1157.txt)). Version 2 extended the list to 18, adding precise reasons for failed writes: `noAccess(6)`, `wrongType(7)`, `wrongLength(8)`, `wrongEncoding(9)`, `wrongValue(10)`, `noCreation(11)`, `inconsistentValue(12)`, `resourceUnavailable(13)`, `commitFailed(14)`, `undoFailed(15)`, `authorizationError(16)`, `notWritable(17)` and `inconsistentName(18)`, and marked 2 to 4 as kept "for proxy compatibility" ([RFC 3416, section 3](https://www.rfc-editor.org/rfc/rfc3416.txt)). When both fields are non-zero, the index points into the request: "The first variable binding in a request's variable-binding list is index one" ([RFC 3416, section 4.2.4](https://www.rfc-editor.org/rfc/rfc3416.txt)). A Response with status 2 and index 3 therefore says that the third name in the request was the problem, not the first.

`tooBig(1)` deserves a note. Version 1 only promised that an implementation "need not accept messages whose length exceeds 484 octets", while recommending larger datagrams "whenever feasible" ([RFC 1157, section 4](https://www.rfc-editor.org/rfc/rfc1157.txt)). When the answer would exceed "a local constraint" or "the maximum message size of the originator", the agent sends instead a Response with "error-status field set to "tooBig", the value of its error-index field set to zero, and an empty variable-bindings field" ([RFC 3416, section 4.2.1](https://www.rfc-editor.org/rfc/rfc3416.txt)). The cure is a smaller request, not a retry.

## Traps and informs on the wire

**Version 1 traps** have their own PDU, tag [4], with a different layout from every other PDU: `enterprise` (an OID, the type of object that generated it), `agent-addr` (its address), `generic-trap` (an INTEGER from "coldStart(0)" to "enterpriseSpecific(6)"), `specific-trap` (a vendor's code, "present even if generic-trap is not enterpriseSpecific"), `time-stamp` (TimeTicks since the entity was re-initialized) and the variable bindings ([RFC 1157, section 4.1.6](https://www.rfc-editor.org/rfc/rfc1157.txt)). The seven generic codes are coldStart(0), warmStart(1), linkDown(2), linkUp(3), authenticationFailure(4), egpNeighborLoss(5) and enterpriseSpecific(6). Two details from the definitions are still useful: a linkDown or linkUp trap carries "as the first element of its variable-bindings, the name and value of the ifIndex instance for the affected interface", and implementations must be able to suppress authenticationFailure traps, which a scan of wrong community strings would otherwise turn into a flood (RFC 1157, sections 4.1.6.3 to 4.1.6.5).

**Version 2 traps** reuse the ordinary PDU layout with tag [7], and move the trap's identity into the bindings: "The first two variable bindings in the variable binding list of an SNMPv2-Trap-PDU are sysUpTime.0 [RFC3418] and snmpTrapOID.0 [RFC3418]" ([RFC 3416, section 4.2.6](https://www.rfc-editor.org/rfc/rfc3416.txt)). The coexistence rules translate one form into the other: if the version 1 trap is enterpriseSpecific, snmpTrapOID is "the concatenation of the SNMPv1 enterprise parameter and two additional sub-identifiers, '0', and the SNMPv1 specific-trap parameter"; otherwise it is one of six fixed OIDs ([RFC 3584, section 3.1](https://www.rfc-editor.org/rfc/rfc3584.txt)):

| Version 1 generic-trap | Version 2 snmpTrapOID.0 |
|---|---|
| 0 | 1.3.6.1.6.3.1.1.5.1 (coldStart) |
| 1 | 1.3.6.1.6.3.1.1.5.2 (warmStart) |
| 2 | 1.3.6.1.6.3.1.1.5.3 (linkDown) |
| 3 | 1.3.6.1.6.3.1.1.5.4 (linkUp) |
| 4 | 1.3.6.1.6.3.1.1.5.5 (authenticationFailure) |
| 5 | 1.3.6.1.6.3.1.1.5.6 (egpNeighborLoss) |

So a vendor trap with enterprise 1.3.6.1.4.1.9 and specific-trap 1 becomes 1.3.6.1.4.1.9.0.1 in version 2. snmpTrapOID itself is `{ snmpTrap 1 }` under 1.3.6.1.6.3.1.1.4 ([RFC 3418, section 2](https://www.rfc-editor.org/rfc/rfc3418.txt)), so its instance is 1.3.6.1.6.3.1.1.4.1.0.

Here is a complete SNMPv2c linkDown trap for the interface with ifIndex 5, sent 1,234.56 seconds after the agent started, 120 bytes:

```
30 76 02 01 01 04 06 70 75 62 6c 69 63 a7 69 02
02 00 c9 02 01 00 02 01 00 30 5d 30 0f 06 08 2b
06 01 02 01 01 03 00 43 03 01 e2 40 30 17 06 0a
2b 06 01 06 03 01 01 04 01 00 06 09 2b 06 01 06
03 01 01 05 03 30 0f 06 0a 2b 06 01 02 01 02 02
01 01 05 02 01 05 30 0f 06 0a 2b 06 01 02 01 02
02 01 07 05 02 01 01 30 0f 06 0a 2b 06 01 02 01
02 02 01 08 05 02 01 02
```

| Bytes | Meaning |
|---|---|
| `a7 69` | SNMPv2-Trap-PDU, 105 octets follow |
| `02 02 00 c9` | request-id 201 (unused by the receiver, but present) |
| `30 0f 06 08 2b 06 01 02 01 01 03 00 43 03 01 e2 40` | sysUpTime.0 = TimeTicks (tag `43`) `01 e2 40` = 123,456 hundredths of a second |
| `30 17 06 0a 2b 06 01 06 03 01 01 04 01 00 06 09 2b 06 01 06 03 01 01 05 03` | snmpTrapOID.0 = 1.3.6.1.6.3.1.1.5.3, linkDown |
| `30 0f 06 0a ... 01 01 05 02 01 05` | ifIndex.5 = 5 |
| `30 0f 06 0a ... 01 07 05 02 01 01` | ifAdminStatus.5 = 1, up |
| `30 0f 06 0a ... 01 08 05 02 01 02` | ifOperStatus.5 = 2, down |

The three bindings after the trap OID are the ones the linkDown definition lists, `OBJECTS { ifIndex, ifAdminStatus, ifOperStatus }`, with the trap itself defined as `{ snmpTraps 3 }` ([RFC 2863, section 6](https://www.rfc-editor.org/rfc/rfc2863.txt)); the values 1 and 2 are `up(1)` and `down(2)` in both status columns (RFC 2863, same section). Administratively up but operationally down is what a pulled cable looks like. And sysUpTime is not a date: it counts "hundredths of a second since the network management portion of the system was last re-initialized" ([RFC 3418, section 2](https://www.rfc-editor.org/rfc/rfc3418.txt)), so placing this trap on a clock needs the receiver's own time of arrival, which is one more reason the series puts [time](https://ronutz.com/en/learn/ntp-family-history) before logs.

**Informs** are traps with an answer. The InformRequest-PDU, tag [6], has the same layout; the receiver replies with a Response, and the sender retransmits until it gets one or gives up. The mechanics and the cost of informs on a busy device are in [SNMP on network devices](https://ronutz.com/en/learn/snmp-on-network-devices).

## SNMPv3 on the wire

Version 3 keeps every PDU above and wraps it in a new envelope. RFC 3412 defines it:

```
SNMPv3Message ::= SEQUENCE {
    msgVersion INTEGER ( 0 .. 2147483647 ),
    msgGlobalData HeaderData,
    msgSecurityParameters OCTET STRING,
    msgData  ScopedPduData
}
```

The version sits "in same position as in SNMPv1 and SNMPv2c, allowing recognition", so a receiver reads the first INTEGER and knows how to parse the rest ([RFC 3412, section 6](https://www.rfc-editor.org/rfc/rfc3412.txt)). `msgGlobalData` holds four fields: `msgID`, which plays the role the request-id played; `msgMaxSize`, with a floor of 484 octets; `msgFlags`, one octet whose bits are `authFlag` (1), `privFlag` (2) and `reportableFlag` (4), with the combination "privacy without authentication" marked "reserved, MUST NOT be used"; and `msgSecurityModel` (same section). The security model values are 1 for SNMPv1, 2 for SNMPv2c and 3 for the User-based Security Model (USM) ([RFC 3411, section 6.1](https://www.rfc-editor.org/rfc/rfc3411.txt)). `msgData` is either a plaintext `ScopedPDU`, which adds a context engine identifier and a context name in front of the PDU, or an `encryptedPDU`, an OCTET STRING whose contents only the keyholder can read.

For USM, the security parameters are themselves a BER SEQUENCE wrapped in that OCTET STRING: `msgAuthoritativeEngineID`, `msgAuthoritativeEngineBoots`, `msgAuthoritativeEngineTime`, `msgUserName` (up to 32 octets), `msgAuthenticationParameters` and `msgPrivacyParameters` ([RFC 3414, section 2.4](https://www.rfc-editor.org/rfc/rfc3414.txt)). Read the list as an observer would: with authPriv, the scoped PDU is unreadable, but the engine ID, the boot count, the engine time and the user name travel in clear in every message. An observer learns which user is polling which device, and how often, even when the content is sealed.

**Discovery.** A manager cannot authenticate to an engine whose identifier it does not know, because the keys depend on it. So the first exchange is unauthenticated: "a Request message with a securityLevel of noAuthNoPriv, a msgUserName of zero-length, a msgAuthoritativeEngineID value of zero length, and the varBindList left empty", answered by "a Report message containing the snmpEngineID of the authoritative SNMP engine" and "a Report PDU with the usmStatsUnknownEngineIDs counter". A second, authenticated request with boots and time set to zero returns a Report carrying the engine's current boot count and time, and the counter usmStatsNotInTimeWindows ([RFC 3414, section 4](https://www.rfc-editor.org/rfc/rfc3414.txt)). In a capture, a version 3 conversation therefore starts with two Reports before the first real answer; seeing them repeat is the signature of a manager whose cached engine ID or clock is wrong.

**Authentication.** To authenticate an outgoing message, the engine first fills `msgAuthenticationParameters` with "an OCTET STRING containing 12 zero octets", then computes the Hash-based Message Authentication Code (HMAC) over the whole serialized message: it extends the key to 64 octets, derives K1 by XOR with "the octet 0x36" repeated 64 times and K2 with "the octet 0x5C", hashes K1 with the message, hashes K2 with that result, and takes "the first 12 octets of the final digest" as the code, which it then writes over the twelve zeros ([RFC 3414, section 6.3.1](https://www.rfc-editor.org/rfc/rfc3414.txt)). That is HMAC with Message Digest 5 (MD5) truncated to 96 bits; the Secure Hash Algorithm (SHA) variant in section 7 is the same procedure with SHA-1, and RFC 7860 adds the SHA-2 family ([RFC 7860](https://www.rfc-editor.org/rfc/rfc7860.txt)). Because the code covers the whole message, a single changed byte anywhere, version, flags, user name or PDU, fails the check.

**Key localization, with the RFC's own vectors.** A password becomes a key in two steps. First it is repeated to fill 1,048,576 octets, one megabyte, which is hashed; then that intermediate key is hashed again with the engine ID on both sides of it, so that "the actual secrets shared between the user and each authoritative SNMP engine will be different" ([RFC 3414, sections 2.6 and A.2](https://www.rfc-editor.org/rfc/rfc3414.txt)). RFC 3414 publishes test vectors, and they reproduce exactly:

| Step | MD5 | SHA-1 |
|---|---|---|
| password | `maplesyrup` | `maplesyrup` |
| key from password | `9f af 32 83 88 4e 92 83 4e bc 98 47 d8 ed d9 63` | `9f b5 cc 03 81 49 7b 37 93 52 89 39 ff 78 8d 5d 79 14 52 11` |
| engine ID | `00 00 00 00 00 00 00 00 00 00 00 02` | the same |
| localized key | `52 6f 5e ed 9f cc e2 6f 89 64 c2 93 07 87 d8 2b` | `66 95 fe bc 92 88 e3 62 82 23 5f c7 15 1f 12 84 97 b3 8f 3f` |

([RFC 3414, sections A.3.1 and A.3.2](https://www.rfc-editor.org/rfc/rfc3414.txt).) The consequence for operations is the one [SNMP on network devices](https://ronutz.com/en/learn/snmp-on-network-devices) draws: change a device's engine ID and every localized key on it is wrong. The consequence for security is the opposite one: a key stolen from one device does not open another, even when the same password was used for both.

## VACM: how the agent decides

Authentication answers "who is asking". The View-based Access Control Model (VACM) answers "may they see this". RFC 3415 describes the decision as five steps, each with its own failure ([RFC 3415, section 3.2](https://www.rfc-editor.org/rfc/rfc3415.txt)):

1. Look up the context in the `vacmContextTable`; if absent, `noSuchContext`.
2. Map the security model and security name (the user, or for version 1 and 2c the community's mapping) to a group in the `vacmSecurityToGroupTable`; if absent, `noGroupName`.
3. Find the access entry for that group, context, security model and security level in the `vacmAccessTable`; if absent, `noAccessEntry`.
4. Pick the read, write or notify view the request needs; if it is empty, `noSuchView`.
5. Check the variable against the view; if it is outside, `notInView`, and otherwise `accessAllowed`.

The view check is a longest match over subtrees. Each view is a set of included and excluded subtrees, and when several match, the object is included or excluded "according to the value of vacmViewTreeFamilyType in the entry whose value of vacmViewTreeFamilySubtree has the most sub-identifiers"; a mask can make individual sub-identifiers wildcards ([RFC 3415, section 4, vacmViewTreeFamilyTable](https://www.rfc-editor.org/rfc/rfc3415.txt)). Worked through for a view that includes 1.3.6.1.2.1 (all of MIB-2) and excludes 1.3.6.1.2.1.4.21 (the old routing table):

| Requested instance | Matching entries | Longest | Result |
|---|---|---|---|
| 1.3.6.1.2.1.1.1.0 (sysDescr.0) | include 1.3.6.1.2.1 | include, 6 arcs | in view |
| 1.3.6.1.2.1.4.21.1.1.10.0.0.99 | include 1.3.6.1.2.1; exclude 1.3.6.1.2.1.4.21 | exclude, 8 arcs | not in view |
| 1.3.6.1.4.1.9.2.1.3.0 | none | none | not in view, since "If none match, then the object instance is not in the MIB view" |

That last row is the practical value of views. The United States Cybersecurity and Infrastructure Security Agency (CISA) put it in 2017: "Simply using SNMPv3 is not enough to prevent abuse of the protocol. A safer approach is to combine SNMPv3 with management information base (MIB) whitelisting using SNMP views", because then "even with exposed credentials, information cannot be read from or written to the device unless the information is needed" ([CISA, Alert TA17-156A, Reducing the Risk of SNMP Abuse, 5 June 2017](https://www.cisa.gov/news-events/alerts/2017/06/05/reducing-risk-snmp-abuse)). The 2017 Cisco vulnerabilities below show why: their workaround was to exclude the affected MIBs from every view.

## The security record

**Community strings in the clear.** The bytes at offset 7 above are the whole story of versions 1 and 2c. CISA's 2017 alert names the consequence: "an adversary could sniff network traffic to determine the community string", which "could enable a man-in-the-middle or replay attack" (CISA, TA17-156A, as above). The standards had already given up on them in 2002 (RFC 3410, as above).

**2002: the parsers.** On 13 February 2002 the Common Vulnerabilities and Exposures (CVE) list published two entries for SNMP: CVE-2002-0012, "Vulnerabilities in a large number of SNMP implementations allow remote attackers to cause a denial of service or gain privileges via SNMPv1 trap handling", and CVE-2002-0013, the same for "(1) GetRequest, (2) GetNextRequest, and (3) SetRequest messages", both "as demonstrated by the PROTOS c06-SNMPv1 test suite" ([NIST National Vulnerability Database, CVE-2002-0012](https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2002-0012); [CVE-2002-0013](https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2002-0013)). The entries name no single vendor: they record flaws in "a large number" of implementations, triggered by the suite's test messages, with denial of service or privilege gain as the result. Every length field in the tables above is a number an attacker chooses; a decoder that trusts one is the bug.

**Amplification.** A small UDP request with a forged source address that produces a larger response turns an open agent into a weapon against a third party. CISA's table of bandwidth amplification factors lists "SNMPv2 | 6.3 | GetBulk request", beside 556.9 for the Network Time Protocol (NTP) and 28 to 54 for DNS ([CISA, Alert TA14-017A, UDP-Based Amplification Attacks, last revised 18 December 2019](https://www.cisa.gov/news-events/alerts/2014/01/17/udp-based-amplification-attacks)). The GetBulk arithmetic above is the reason: M is chosen by the sender. How networks absorb such floods is in [what actually absorbs a DDoS attack](https://ronutz.com/en/learn/ddos-what-actually-absorbs-an-attack).

**2017: the agent as a way in.** On 29 June 2017 Cisco published an advisory for nine vulnerabilities, CVE-2017-6736 to CVE-2017-6744, "due to a buffer overflow condition in the SNMP subsystem" of IOS and IOS XE. They "affect all versions of SNMP - Versions 1, 2c, and 3"; to exploit them "via SNMP Version 2c or earlier, the attacker must know the SNMP read-only community string", and via version 3 "the attacker must have user credentials"; success "could allow the attacker to execute arbitrary code and obtain full control of the affected system". The advisory lists the vulnerable MIBs and offers excluding them from the views as the workaround ([Cisco, cisco-sa-20170629-snmp, first published 29 June 2017, last updated 30 July 2025](https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20170629-snmp)). Note the order of conditions: a read-only community, the weakest credential SNMP has, was enough to run code.

**2018: SNMP as a trigger.** In April 2018 the United States Department of Homeland Security, the Federal Bureau of Investigation (FBI) and the United Kingdom's National Cyber Security Centre (NCSC) described Russian state-sponsored actors scanning network devices on "Simple Network Management Protocol (SNMP, ports 161/162)", among other services, and "specially crafted SNMP and SMI packets that trigger the scanned device to send its configuration file to a cyber-actor-controlled host via Trivial File Transfer Protocol (TFTP)"; when a network blocked external SNMP, "cyber actors spoof the source address of the SNMP UDP datagram as coming from inside the targeted network". The configuration files they obtained contained "SNMP community strings and other network information" ([CISA, Alert TA18-106A, Russian State-Sponsored Cyber Actors Targeting Network Infrastructure Devices, 16 April 2018](https://www.cisa.gov/news-events/alerts/2018/04/16/russian-state-sponsored-cyber-actors-targeting-network-infrastructure-devices)). The same alert tells defenders to review "netflow data for indications of UDP SNMP traffic directed at port 161/162" and to treat "inbound or spoofed SNMP closely followed by outbound TFTP" as cause for alarm. [TFTP](https://ronutz.com/en/learn/tftp) has its own part in NetFun II; [flow telemetry](https://ronutz.com/en/learn/flow-telemetry-netflow-sflow-and-ipfix) is the next part of this one.

**2021, published 2023: the default community.** On 18 April 2023 the NCSC, the National Security Agency (NSA), CISA and the FBI published a joint advisory on <Claim status="attributed" by="NCSC, NSA, CISA and FBI, joint advisory of 18 April 2023">APT28, which the NCSC assesses is "almost certainly" Unit 26165 of Russia's General Staff Main Intelligence Directorate (GRU)</Claim>. In 2021 the group "used infrastructure to masquerade Simple Network Management protocol (SNMP) access into Cisco routers worldwide", including "approximately 250 Ukrainian victims". "Weak SNMP community strings, including the default 'public', allowed APT28 to gain access to router information"; "The compromised routers were configured to accept SNMP v2 requests", which send "all data, including community strings" unencrypted; and on some routers the group exploited CVE-2017-6742 to deploy malware ([NCSC, APT28 exploits known vulnerability to carry out reconnaissance and deploy malware on Cisco routers, 18 April 2023](https://www.ncsc.gov.uk/news/apt28-exploits-known-vulnerability-to-carry-out-reconnaissance-and-deploy-malware-on-cisco-routers); [CISA, alert of 18 April 2023](https://www.cisa.gov/news-events/alerts/2023/04/18/apt28-exploits-known-vulnerability-carry-out-reconnaissance-and-deploy-malware-cisco-routers)). CISA's catalogue of Known Exploited Vulnerabilities (KEV) records CVE-2017-6742 from 19 April 2023, and CVE-2017-6736 from 3 March 2022 ([NVD, CVE-2017-6742](https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2017-6742); [CVE-2017-6736](https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2017-6736)). A vulnerability fixed in 2017 was still being used four years later, through the default community string 'public'.

**The management plane, exposed.** In June 2023 CISA's Binding Operational Directive (BOD) 23-02 required United States federal civilian agencies to take "networked management interfaces" of routers, switches, firewalls and similar devices off the internet, naming SNMP among the protocols in scope, and recommended "an isolated management network" ([CISA, BOD 23-02, 13 June 2023](https://www.cisa.gov/news-events/directives/binding-operational-directive-23-02)). In December 2024, after the campaign against telecommunications providers, six agencies of four countries told network engineers: "If using Simple Network Management Protocol (SNMP), ensure only SNMP v3 with encryption and authentication is used, along with ACL protections against unnecessary public exposure", and to disable "SNMP v1/v2c" ([CISA and partners, Enhanced Visibility and Hardening Guidance for Communications Infrastructure, 4 December 2024](https://www.cisa.gov/resources-tools/resources/enhanced-visibility-and-hardening-guidance-communications-infrastructure)). The access control list (ACL) side is [its own article](https://ronutz.com/en/learn/access-control-lists-on-switches-and-routers); the separate management network is the last part of this module, [out-of-band management](https://ronutz.com/en/learn/out-of-band-management-and-the-console).

**A transport with real security.** There is a standards-track alternative to USM: the Transport Layer Security (TLS) Transport Model, which runs SNMP over TLS or its datagram form (DTLS) and registers port 10161 for requests and 10162 for notifications, over TCP and UDP ([RFC 6353, section 10](https://www.rfc-editor.org/rfc/rfc6353.txt)). It reuses certificates instead of SNMP's own key machinery; support depends on the platform.

## Where SNMP stops

In 2002 the Internet Architecture Board (IAB) held a workshop on network management, and operators' verdict on SNMP was mixed. It "works reasonably well for device monitoring", and "Some core MIB modules, such as the IF-MIB [RFC2863], are implemented on most networking devices". But "router equipment is usually not fully configurable via SNMP", retrieving "large amounts of data (such as routing tables)" is slow, and "Lexicographic ordering is sometimes artificial with regard to internal data structures" ([RFC 3535, sections 2.1 and 4](https://www.rfc-editor.org/rfc/rfc3535.txt)). The workshop's recommendations led to the Network Configuration Protocol ([NETCONF](https://ronutz.com/en/glossary/netconf)) and the YANG data modelling language ([YANG](https://ronutz.com/en/glossary/yang)) for configuration, and later to streaming telemetry, where the device pushes instead of being polled; the [BIG-IP Telemetry Streaming article](https://ronutz.com/en/learn/bigip-telemetry-streaming-ts) is one vendor's version. SNMP remains the protocol that every device on the shelf still answers, which is exactly why its security matters.

## The Brazilian angle

The Brazilian Computer Emergency Response Team (CERT.br), part of NIC.br, notifies the holders of autonomous systems (AS) allocated to Brazil that have devices with UDP services open to abuse for amplification. Its statistics page groups the services by how many addresses it has notified, and SNMP on 161/UDP is in the first group, with DNS, Portmap and NTP: the "services with the most IP addresses in Brazil" (our translation here and below) ([CERT.br, Notifications of devices allowing amplification, updated monthly (in Portuguese)](https://stats.cert.br/amplificadores/)). Its notification template for these cases names the service in a line that reads "SNMP (UDP/161) open to the Internet" and asks the network's owner to fix the configuration "or disable it completely, if it has no actual use" ([CERT.br, Recommendations for incident notifications, templates (in Portuguese)](https://cert.br/docs/notificacoes/)).

NIC.br's guidance page for the case is short and concrete: if SNMP is not used, disable it; if it is used on the local network, make it available only there; "Avoid using public communities and, if possible, use authentication when available"; and test from the internet with the `snmpget` command quoted earlier (NIC.br, Amplification, as above). The figures it reports show the effect of the campaign. In a release of 28 March 2019 NIC.br wrote that the awareness actions of its Programa por uma Internet mais Segura (Programme for a Safer Internet) "contributed to a 73% fall in IP addresses abusable through the SNMP protocol, in the period from January to December 2018" ([NIC.br, CERT.br publishes data on the 2018 security incident landscape, 28 March 2019 (in Portuguese)](https://nic.br/noticia/releases/cert-br-divulga-dados-sobre-cenario-de-incidentes-de-seguranca-em-2018/)). A NIC.br presentation to regional providers at ABRINT in São Paulo, 5 to 7 June 2019, still showed Brazil "in third place among IP addresses with an open SNMP service", citing the Shadowserver Foundation's scans ([NIC.br, Security for regional providers, ABRINT 2019 (in Portuguese)](https://bcp.nic.br/i+seg/assets/pdfs/ProgramaInternetSeguraABRINT_SPO_v23_169.pdf)). A current ranking was not published in what was read for this article.

## What defenders can do

- **Read your own bytes.** Capture one poll from your manager and find the community string in it. If you can read it at offset 7, so can anyone on that path.
- **Move pollers to SNMPv3 with authPriv,** and give every user a view that includes only what the poller reads; CISA's alert and the December 2024 guidance both say so (CISA, TA17-156A; CISA and partners, 2024).
- **Exclude what you do not use.** A view that never includes a vendor's MIB makes that MIB's parser unreachable, which was the workaround for the 2017 Cisco vulnerabilities (Cisco, cisco-sa-20170629-snmp).
- **Filter by source at the device.** Only the management stations' addresses should reach UDP 161, and the agent should never answer the internet; test it from outside as NIC.br describes (NIC.br, Amplification).
- **Watch for the pair.** Inbound or spoofed SNMP followed by outbound TFTP from a network device is the pattern of 2018 (CISA, TA18-106A); flow records show it without a packet capture.
- **Keep authenticationFailure traps on, and rate-limited.** They are the agent's report of a community or user guess (RFC 1157, section 4.1.6.5).
- **Patch the agent like any other server.** CVE-2017-6742 was in KEV in 2023 for a 2017 fix (NVD, as above).
- **Treat the manager as a crown jewel.** It holds every community and every SNMPv3 key for the fleet; CISA's 2017 alert notes that many managers keep credentials on disk to receive traps, and asks for separate read and write roles (CISA, TA17-156A).

## What to remember

- Every SNMP message is BER: identifier, length, contents, nested. Work from the lengths, never from fixed offsets.
- `30` is a SEQUENCE, `02` an INTEGER, `04` an OCTET STRING, `05` a NULL, `06` an OID, `A0` to `A8` the PDUs, `40` to `46` SNMP's own types.
- Every SNMP OID starts `2B` (1 × 40 + 3). Sub-identifiers of 128 or more take several octets, bit 8 set on all but the last: 2636 is `94 4C`.
- Scalars end in `.0`; table cells end in the row's index.
- GetNext order is arc by arc: 9.1.2.3 comes before 10.0.0.51. A walk ends when the answer leaves the subtree, or with endOfMibView.
- GetBulk returns up to N + M × R bindings; M is chosen by the sender, which is also why it amplifies.
- In versions 1 and 2c the community string is readable on the wire. In version 3 the PDU can be encrypted, but the engine ID and user name never are.
- USM keys are localized: the same password gives a different key on every engine (`maplesyrup` gives `526f5eed...` with MD5 for engine `...02`).
- VACM decides by the longest matching subtree; an object in no included subtree is not in the view.

<ReaderQuestions>
- In the 41-byte GetRequest, which bytes would change if the request-id were 127, and which if it were 128? Why does one of those requests come out one byte longer?
- Encode 1.3.6.1.4.1.2011 by hand. How many octets does the sub-identifier take, and what are they?
- A walk of ifDescr on a switch returns rows indexed 1, 2, 3, 1001 and 1002. In what order will GetNext deliver them, and what would a string sort have done?
- A GetBulk with non-repeaters 0 and max-repetitions 50 names three columns. How many bindings can the response carry, and why might the agent answer tooBig instead?
- An attacker captures a week of SNMPv3 authPriv polls. List what they can learn without breaking any key.
</ReaderQuestions>

## Sources

- [J. Case, M. Fedor, M. Schoffstall and J. Davin, RFC 1157, A Simple Network Management Protocol (SNMP), IETF, May 1990, text: ports 161 and 162, the 484-octet minimum, the message and PDU definitions, error statuses, GetNext and the routing table traversal, the Trap-PDU and its generic codes, the trivial authentication service (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc1157.txt)
- [J. Case, K. McCloghrie, M. Rose and S. Waldbusser, RFC 1901, Introduction to Community-based SNMPv2, IETF, January 1996, Experimental, text: the version(1) message (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc1901.txt)
- [J. Case, R. Mundy, D. Partain and B. Stewart, RFC 3410, Introduction and Applicability Statements for Internet-Standard Management Framework, IETF, December 2002, text: versions 1 and 2c fundamentally insecure and Historic (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc3410.txt)
- [D. Harrington, R. Presuhn and B. Wijnen, RFC 3411, An Architecture for Describing SNMP Management Frameworks, IETF, December 2002, STD 62, text: the security model values (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc3411.txt)
- [J. Case, D. Harrington, R. Presuhn and B. Wijnen, RFC 3412, Message Processing and Dispatching for SNMP, IETF, December 2002, STD 62, text: the SNMPv3Message and HeaderData definitions, msgFlags (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc3412.txt)
- [U. Blumenthal and B. Wijnen, RFC 3414, User-based Security Model (USM) for SNMPv3, IETF, December 2002, STD 62, text: UsmSecurityParameters, discovery, HMAC-MD5-96 procedure, key localization, the maplesyrup test vectors (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc3414.txt)
- [B. Wijnen, R. Presuhn and K. McCloghrie, RFC 3415, View-based Access Control Model (VACM) for SNMP, IETF, December 2002, STD 62, text: the isAccessAllowed procedure and the view tree family rule (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc3415.txt)
- [R. Presuhn (ed.), RFC 3416, Version 2 of the Protocol Operations for SNMP, IETF, December 2002, STD 62, text: PDU tags, error statuses, exception values, GetBulk arithmetic and example, fragmentation warning, the SNMPv2-Trap-PDU (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc3416.txt)
- [R. Presuhn (ed.), RFC 3417, Transport Mappings for SNMP, IETF, December 2002, STD 62, text: section 8, the BER restrictions (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc3417.txt)
- [R. Presuhn (ed.), RFC 3418, Management Information Base (MIB) for SNMP, IETF, December 2002, STD 62, text: the system group, sysServices arithmetic, snmpTrapOID (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc3418.txt)
- [R. Frye, D. Levi, S. Routhier and B. Wijnen, RFC 3584, Coexistence between Version 1, Version 2, and Version 3 of the Internet-standard Network Management Framework, IETF, August 2003, BCP 74, text: the trap translation table (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc3584.txt)
- [K. McCloghrie, D. Perkins and J. Schoenwaelder (eds.), RFC 2578, Structure of Management Information Version 2 (SMIv2), IETF, April 1999, STD 58, text: the OID tree, application types and tags, sub-identifier limits, instance identification (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc2578.txt)
- [K. McCloghrie and F. Kastenholz, RFC 2863, The Interfaces Group MIB, IETF, June 2000, text: ifTable columns, status values, the linkDown notification (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc2863.txt)
- [U. Blumenthal, F. Maino and K. McCloghrie, RFC 3826, The AES Cipher Algorithm in the SNMP User-based Security Model, IETF, June 2004, text: consulted for the privacy protocol (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc3826.txt)
- [J. Merkle and M. Lochter, RFC 7860, HMAC-SHA-2 Authentication Protocols in User-Based Security Model (USM) for SNMPv3, IETF, April 2016, text: the SHA-2 authentication protocols (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc7860.txt)
- [W. Hardaker, RFC 6353, Transport Layer Security (TLS) Transport Model for the Simple Network Management Protocol (SNMP), IETF, July 2011, text: ports 10161 and 10162 (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc6353.txt)
- [J. Schoenwaelder, RFC 3535, Overview of the 2002 IAB Network Management Workshop, IETF, May 2003, text: SNMP's strengths and weaknesses as operators saw them (accessed 23 November 2026)](https://www.rfc-editor.org/rfc/rfc3535.txt)
- [ITU-T, Recommendation X.690 (07/2002), ASN.1 encoding rules: Specification of BER, CER and DER, Geneva, 2002, PDF: clauses 8.1.2, 8.1.3, 8.3, 8.8 and 8.19, the OID example (accessed 23 November 2026)](https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf)
- [ITU-T, Recommendation X.680 (07/2002), ASN.1: Specification of basic notation, Geneva, 2002, PDF: Table 1, universal class tag assignments (accessed 23 November 2026)](https://www.itu.int/ITU-T/studygroups/com17/languages/X.680-0207.pdf)
- [IANA, Private Enterprise Numbers, last updated 23 November 2026, text: entries 9, 2011 and 2636, the 1.3.6.1.4.1 prefix, the highest number (accessed 23 November 2026)](https://www.iana.org/assignments/enterprise-numbers.txt)
- [Net-SNMP project, snmpwalk manual page, HTML: the GETNEXT walk and the default subtree (accessed 23 November 2026)](http://www.net-snmp.org/docs/man/snmpwalk.html)
- [Net-SNMP project, snmpbulkwalk manual page, HTML: the GETBULK walk (accessed 23 November 2026)](http://www.net-snmp.org/docs/man/snmpbulkwalk.html)
- [CISA, Alert TA17-156A, Reducing the Risk of SNMP Abuse, 5 June 2017, archived web page: community sniffing, SNMPv3 with views, separate management network (accessed 23 November 2026)](https://www.cisa.gov/news-events/alerts/2017/06/05/reducing-risk-snmp-abuse)
- [CISA, Alert TA14-017A, UDP-Based Amplification Attacks, last revised 18 December 2019, archived web page: the bandwidth amplification factor table (accessed 23 November 2026)](https://www.cisa.gov/news-events/alerts/2014/01/17/udp-based-amplification-attacks)
- [CISA, Alert TA18-106A, Russian State-Sponsored Cyber Actors Targeting Network Infrastructure Devices, 16 April 2018, web page: SNMP scanning, spoofed SNMP, configuration by TFTP, detection with flow data (accessed 23 November 2026)](https://www.cisa.gov/news-events/alerts/2018/04/16/russian-state-sponsored-cyber-actors-targeting-network-infrastructure-devices)
- [NCSC, APT28 exploits known vulnerability to carry out reconnaissance and deploy malware on Cisco routers, London, 18 April 2023, web page: the 2021 campaign, default community, CVE-2017-6742, the attribution (accessed 23 November 2026)](https://www.ncsc.gov.uk/news/apt28-exploits-known-vulnerability-to-carry-out-reconnaissance-and-deploy-malware-on-cisco-routers)
- [CISA, APT28 Exploits Known Vulnerability to Carry Out Reconnaissance and Deploy Malware on Cisco Routers, 18 April 2023, web page: release date and summary (accessed 23 November 2026)](https://www.cisa.gov/news-events/alerts/2023/04/18/apt28-exploits-known-vulnerability-carry-out-reconnaissance-and-deploy-malware-cisco-routers)
- [Cisco, SNMP Remote Code Execution Vulnerabilities in Cisco IOS and IOS XE Software, cisco-sa-20170629-snmp, first published 29 June 2017, version 1.11 of 30 July 2025, web page: the nine CVEs, conditions, affected MIBs and workarounds (accessed 23 November 2026)](https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20170629-snmp)
- [NIST National Vulnerability Database, CVE-2017-6742, API record (JSON): description and KEV date (accessed 23 November 2026)](https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2017-6742)
- [NIST National Vulnerability Database, CVE-2017-6736, API record (JSON): description and KEV date (accessed 23 November 2026)](https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2017-6736)
- [NIST National Vulnerability Database, CVE-2002-0012, API record (JSON): the PROTOS trap-handling entry (accessed 23 November 2026)](https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2002-0012)
- [NIST National Vulnerability Database, CVE-2002-0013, API record (JSON): the PROTOS request-handling entry (accessed 23 November 2026)](https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2002-0013)
- [CISA, Binding Operational Directive 23-02, Mitigating the Risk from Internet-Exposed Management Interfaces, 13 June 2023, web page: scope, protocols, required actions (accessed 23 November 2026)](https://www.cisa.gov/news-events/directives/binding-operational-directive-23-02)
- [CISA, NSA, FBI, ASD's ACSC, CCCS and NCSC-NZ, Enhanced Visibility and Hardening Guidance for Communications Infrastructure, 4 December 2024, web page: SNMPv3 only, disabling v1 and v2c (accessed 23 November 2026)](https://www.cisa.gov/resources-tools/resources/enhanced-visibility-and-hardening-guidance-communications-infrastructure)
- [CERT.br, Notificações de Dispositivos Permitindo Amplificação, São Paulo, updated monthly, web page: the notification programme and the service groups (accessed 23 November 2026)](https://stats.cert.br/amplificadores/)
- [CERT.br, Recomendações para notificações de incidentes de segurança, web page: the DRDoS notification template naming SNMP (accessed 23 November 2026)](https://cert.br/docs/notificacoes/)
- [NIC.br, Programa por uma Internet mais Segura, Amplificação, web page: SNMP guidance and the snmpget test (accessed 23 November 2026)](https://bcp.nic.br/i+seg/acoes/amplificacao/)
- [NIC.br, CERT.br divulga dados sobre cenário de incidentes de segurança em 2018, São Paulo, 28 March 2019, press release: the 73% fall in SNMP-abusable addresses (accessed 23 November 2026)](https://nic.br/noticia/releases/cert-br-divulga-dados-sobre-cenario-de-incidentes-de-seguranca-em-2018/)
- [Gilberto Zorello, NIC.br, Segurança para provedores regionais: conheça as melhores práticas, ABRINT Nacional, São Paulo, 5 to 7 June 2019, PDF slides: Brazil third in open SNMP addresses, citing Shadowserver (accessed 23 November 2026)](https://bcp.nic.br/i+seg/assets/pdfs/ProgramaInternetSeguraABRINT_SPO_v23_169.pdf)
