One Defect in libNSSNMP: A Bounds Check That Wraps, Reached in 23 Bytes

We tested libNSSNMP, an embeddable SNMP agent, and uncovered a defect now published as GHSA-qm39-j7cv-vjcm. A 23-byte datagram declaring a length of 2^64-1 wraps the bounds check in every buffer accessor, and the host application that embeds the library exits. No credential, no registered object, and no configuration is involved. The advisory is public, so the product is named.

libNSSNMP is a small C++ library that embeds an SNMP agent into a host application, so a device or a service can answer management queries without carrying a full SNMP suite.

We tested it as an agent over UDP and uncovered a defect that the maintainer has since published as GHSA-qm39-j7cv-vjcm, rated high at CVSS 7.5. A 23-byte datagram terminates the process that embeds the library.

No credential is used, because the community string is never compared against anything. No registered object is involved, because the agent dies with an empty MIB exactly as it does with a populated one. Nothing has to be configured first.

The product is named here, which the rest of this series does not do. The advisory is public on the project's own repository and carries the reproduction in full, so everything below can be checked against it.

Denial of service: 23 bytes, no credential, and the host application exits

The measurement, against an agent registering the set from the library's own example program verbatim, 14 objects, the standard system group plus the counter examples the library documents:

| request | bytes | result | | --- | ---: | --- | | *control: an ordinary GET of the system description* | *40* | *61-byte reply, agent healthy* | | an OCTET STRING declaring a length of 2^64-1 | **23** | **the process terminates** |

‍

The control line is what makes the second line readable. The agent answers an ordinary request normally, so the termination is the defect rather than a broken test rig.

Re-running the same datagram against an agent with zero registrations kills it identically. That is the stronger statement: no registered value is involved at all, so the MIB a host exposes neither widens nor narrows this.

What exits is not the SNMP thread. The library runs its receive loop inside the host process, and the failure leaves that loop and takes the process with it. For an embedded agent that is an outage of the application the agent was reporting on.

The mechanism: a sum that wraps before anything is allocated

The advisory states the root cause. Every accessor that hands bytes out of the received datagram guards itself by testing whether the current cursor plus the requested length exceeds the size of the buffer.

Both terms are unsigned 64-bit quantities, so that sum wraps. With the cursor at 21 and a requested length of 2^64-1, the sum is 20, which is not greater than the size, the guard passes, and the accessor goes on to allocate the length it was handed.

The wire form is ordinary BER long-form length. One octet declares how many length octets follow, and those octets carry the value:

| octets | meaning | | --- | --- | | `04` | OCTET STRING | | `88` | long form, 8 length octets follow | | `ff ff ff ff ff ff ff ff` | 2^64-1 |

‍

The whole datagram is a well-formed SNMP v1 GetRequest header with that element appended, and it fits in 23 bytes:

30 15 02 01 00 04 06 70 75 62 6c 69 63 04 88 ff ff ff ff ff ff ff ff

The same wrapping form appears in all three accessors and in the substring helper beside them, so the guard fails the same way wherever a declared length reaches it.

Why it ends as a termination rather than a read past the end

The accessor this datagram reaches allocates before it copies, and an allocation of 2^64-1 bytes fails. Under AddressSanitizer the requested size is reported verbatim as 0xffffffffffffffff; in an ordinary build the allocation failure reaches the default handler and the process aborts.

The receive loop catches one error type, and an allocation failure is not of that type, so it leaves the loop uncaught.

The advisory also records what the defect would be with a different caller. The sibling accessor that copies into a buffer the caller supplies carries the same wrapping guard with no allocation in front of it. A caller reaching that one with the same length reads past the end of the datagram instead of aborting, and the allocation is the only reason this is currently a crash rather than a disclosure.

The PDU type is examined after the length has been acted on

One property worth knowing before anyone decides a filter covers this.

The walk through the message reads a tag, reads a length, and takes that many bytes, and only then dispatches on what the tag was. So PDU types the parser rejects still carry their lengths through the accessor first.

A datagram tagged as a GetResponse, a Trap or a Report is rejected by this parser and answered by nothing, and the length inside it has already been consumed by the time that decision is made. Restricting an agent to request PDU types therefore does not bound this surface. The exposure is any datagram that reaches the port.

The state of the fix

The advisory carries a suggested patch, which is to compare the requested length against the bytes actually remaining, a quantity that cannot overflow.

As of 2026-11-18 the public repository is unchanged. The default branch still points at the commit the advisory names as affected, last pushed in April 2026, and the repository carries no tag and no release. The advisory's patched-version field is empty.

So anyone embedding this library today is embedding the version the advisory describes, and the exposure is bounded only by who can send a datagram to the port the host application listens on.

What has not been established

Stated so that none of it has to be inferred from silence.

  • Code execution. The allocation fails rather than succeeding, so termination is the outcome measured here.
  • Transports other than UDP. Every run was a UDP datagram to the agent's listening port.
  • Platforms other than Linux, under an AddressSanitizer build and an ordinary one.
  • Further issues from the same audit were reported to the maintainer and are not described here.

Finding this with Penzzer

SNMP has a protocol-aware target on both address families. Select SNMP Agent - BER encoding under INET4 and give it the agent's address.

| Attack module | What it drives | | --- | --- | | BER length field abuse | Declared lengths against the bytes actually present, in every form including long form, indefinite and negative | | Nested sequence depth | Recursion and stack consumption in the decoder | | OID arc count and subid encoding | Arc counts and multi-octet sub-identifiers against fixed arrays | | Oversized varbind value | A value length against the buffer that receives it | | Varbind list structure abuse | Bindings appended past the end of the declared list | | Community string brute force | The credential path, and where in the parse it sits | | TCP transport framing | The same decoder reached over TCP rather than UDP |

‍

The first of those drives this article's defect directly. A long-form length of 2^64-1 and a length field truncated to fewer octets than it declares both arrive at the same wrapping guard, from opposite ends of the same field.

A run also generates cases from the protocol's own structure, walking each field of the message through the boundaries where decoders break, which is how a length-prefixed encoding is covered without enumerating the shapes by hand.

The oracle is the control request. A healthy agent answers an ordinary GET of the system description with 61 bytes and a terminated one answers nothing, so a 40-byte control before and after each case separates a rejected input from a dead target.

One operational note for anyone driving this against their own build. Restart the agent between cases. The termination is permanent, so every case after the fatal one is sent to a process that is gone, and a run without that control pair reports a column of findings where there is one defect and a dead target.

What this article is, and is not

The defect above is a sample of what this kind of testing surfaces, not a description of Penzzer's SNMP coverage. It is what one embeddable agent happened to get wrong in its length decoder.

The attack library spans defect classes well beyond what this article shows: memory safety, information disclosure, resource exhaustion, availability, hangs and algorithmic complexity, input validation, protocol state logic, type and format handling, and error handling. Across the 106 protocols with a protocol-aware target, a run also generates its test cases from the structure of the protocol itself.

The same limit applies in reverse. What a test looks for is a property of the test, not a claim about your device. A clean result against these modules is a statement about these modules.

If you embed an SNMP agent

Three questions, in the order the parser reaches them.

Is every declared length compared against the bytes remaining in the datagram, rather than added to a cursor and compared against the total? That addition is the whole defect here, and it is the form most bounds checks are written in.

Does the receive loop catch everything that can leave it, including an allocation that fails, or only the error type the parser was expected to raise? An embedded agent shares a process with the application it reports on, so an error escaping that loop is an outage of the application rather than of its management interface.

And is the PDU type examined before the lengths inside the message are acted on? If the slice is taken first, then the types a parser documents as unsupported are reachable code paths rather than rejected ones.

Other Post
Uncover Hidden Vulnerabilities

Identify security flaws before attackers do, automatically and at scale with Penzzer's intelligent fuzzing engine.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.