CVE-2026-138295 — Net-snmp — CWE-124
Net-SNMP snmpd through 5.9.5.2 and 5.10.pre1 before 5.10.pre3 contains a heap out-of-bounds write vulnerability in view_parse_oid() that allows authenticated attackers with SNMP write access to corrupt heap memory. Attackers can send a single SET to vacmViewTreeFamilyTable whose index begins with sub-identifier 4294967295, causing a one-byte write before a malloc(0) allocation and crashing snmpd.
Net-SNMP snmpd through 5.9.5.2 and 5.10.pre1 before 5.10.pre3 contains a heap out-of-bounds write vulnerability in view_parse_oid() that allows authenticated attackers with SNMP write access to corrupt heap memory. Attackers can send a single SET to vacmViewTreeFamilyTable whose index begins with sub-identifier 4294967295, causing a one-byte write before a malloc(0) allocation and crashing snmpd.
🎯 What is this vulnerability?
CVE‑2026‑138295 is a heap out‑of‑bounds write in the Net‑SNMP daemon (snmpd).
The flaw lives in the function view_parse_oid() that parses the OID index supplied when a manager performs an SNMP SET on the vacmViewTreeFamilyTable (the VACM view‑tree family table used for access control).
| CVE Detail | Explanation |
|---|---|
| CWE | CWE‑124: Buffer Underwrite – the code writes one byte before a heap block that has just been allocated with malloc(0). |
| Authentication requirement | PR:H – the attacker must already have SNMP write privileges (i.e., a community string or SNMPv3 user that is allowed to perform SET operations). |
| Attack vector | AV:N – the attack is performed over the network, no local access required. |
| Complexity | AC:L – the exploit is trivial once write access is obtained. |
| Impact | VA:H – the out‑of‑bounds write can corrupt heap metadata, leading to a denial‑of‑service (crash). In practice, with a crafted heap layout the write can be leveraged to achieve arbitrary code execution, but the CVSS only credits the guaranteed availability impact. |
| Missing checks | The parser does not validate that the first sub‑identifier of the OID index fits into the expected range. An attacker can supply the value 4294967295 (0xFFFFFFFF), which the code treats as a legitimate sub‑identifier, triggers a malloc(0) for the “remaining” OID components, and then writes one byte before that allocation. No bounds check is performed before the write. |
In short, the daemon trusts the OID supplied by an authenticated SNMP manager, assumes the first sub‑identifier is a normal 32‑bit integer, and then performs a write that can underflow the allocated heap buffer.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All commands are illustrative – the exact OID syntax may differ slightly between Net‑SNMP releases, but the principle is identical.
1. Discovery & Reconnaissance
| Step | Action | Rationale |
|---|---|---|
| 1.1 | Port scan the target for UDP 161 (SNMP) and/or TCP 161 (SNMP over TCP). | Net‑SNMP listens on these ports by default. |
| 1.2 | Banner grab using snmpwalk -v2c -c public <IP> sysDescr.0 (or SNMPv3 with known credentials). | Net‑SNMP returns a string that includes the version, e.g., Net-SNMP 5.9.5.2. |
| 1.3 | Version verification – compare the returned version against the vulnerable range (≤ 5.9.5.2, or 5.10.pre1‑pre2). | Confirms the target is exploitable. |
| 1.4 | Credential acquisition – obtain a community string with write access (e.g., private) or an SNMPv3 user with authPriv and write rights. | Required because PR:H (privileged) is a pre‑condition. This can be achieved via configuration leakage, default credentials, or prior compromise. |
2. Exploitation
The vulnerable operation is a single SNMP SET on the vacmViewTreeFamilyTable. The table’s index is an OID that begins with the attacker‑controlled sub‑identifier.
2.1 Construct the malicious OID
# The index format (simplified) is:
# vacmViewTreeFamilyTable.<viewName>.<subtreeMask>.<familyMask>.<viewSubtree>
# We inject 4294967295 (0xFFFFFFFF) as the first sub‑identifier.
# Example (hex notation for readability):
# 1.3.6.1.6.3.16.1.2.1.<viewName>.<0xFFFFFFFF>.<rest...>2.2 Example snmpset command (illustrative)
# Using SNMPv2c with a write‑enabled community "private"
snmpset -v2c -c private \
192.0.2.10 \
vacmViewTreeFamilyTable.1.3.6.1.6.3.16.1.2.1.0.4294967295.0 i 1Explanation of the fields
| Field | Meaning |
|---|---|
vacmViewTreeFamilyTable | MIB name for the VACM view‑tree family table. |
1.3.6.1.6.3.16.1.2.1 | OID prefix for the table (as defined in RFC 3415). |
0 | Example viewName index (the first column). |
4294967295 | Malicious sub‑identifier that triggers the underwrite. |
0 | Placeholder for remaining index components (can be zero). |
i 1 | Set the vacmViewTreeFamilyMask column to 1 (any valid integer). |
What happens internally
1. view_parse_oid() receives the OID and extracts the first sub‑identifier (0xFFFFFFFF).
2. It calculates the length of the remaining OID components and calls malloc(0) because the remaining length is interpreted as zero.
3. The code then writes the next byte of the parsed OID one byte before the returned pointer (heap underwrite).
4. The write corrupts the heap metadata of the adjacent allocation.
2.3 Result
- If the heap layout is “benign” – the daemon crashes (Denial‑of‑Service).
- If the attacker can influence the heap layout (e.g., by preceding the SET with a series of SNMP GETBULK requests that allocate predictable objects) – the corrupted metadata can be used to forge a fake chunk and achieve arbitrary code execution (e.g., by overwriting a function pointer in the freed chunk). This secondary step is not required for the CVSS rating but is a realistic path for a skilled attacker.
3. Post‑Exploitation
| Goal | Typical Path |
|---|---|
| Denial‑of‑Service | The immediate effect is a crash of snmpd. The service stops responding, potentially causing monitoring blind spots. |
| Privilege Escalation / RCE (advanced) | 1. Use the underwrite to corrupt the size field of a neighboring heap chunk.<br>2. Trigger a later free() that results in a malloc‑based heap overflow.<br>3. Overwrite a function pointer (e.g., __free_hook in glibc) with the address of shellcode or a one‑gadget RCE.<br>4. Cause the overwritten pointer to be dereferenced, gaining root‑level code execution because snmpd typically runs as root. |
Note: The CVSS vector only credits the guaranteed availability impact. Achieving RCE requires a reliable heap‑spray and knowledge of the target’s libc version, which raises the exploitation difficulty but is feasible for a determined attacker with local knowledge.
🌍 Real‑World Impact
| CIA Triad | CVSS Vector Interpretation | Practical Consequence |
|---|---|---|
| Confidentiality (C) | VC:N – No direct confidentiality loss is guaranteed. | An attacker cannot directly read SNMP data they are not authorized to. |
| Integrity (I) | VI:N – No guaranteed integrity impact. | The write does not directly modify managed objects; it corrupts heap memory. |
| Availability (A) | VA:H – High impact. | A single crafted SNMP SET can crash snmpd, causing loss of network management, alerts, and potentially triggering a cascade of monitoring failures. In environments where SNMP is used for automated provisioning, the outage can have downstream effects. |
| Scope | S:N – No change in scope; the impact stays within the SNMP daemon process. | |
| Attack Complexity | Low – once write credentials are known, the exploit is a single packet. | |
| Privileges Required | High – attacker must already have SNMP write access. In many networks, write community strings are poorly protected, making this a realistic pre‑condition. | |
| User Interaction | None – the attack is fully automated. |
Bottom‑line: The most likely real‑world effect is a service outage (DoS). However, in high‑value environments where snmpd runs with elevated privileges, the underwrite can be a stepping stone to full system compromise.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Affected version | Fixed in |
|---|---|
net-snmp 5.9.5.2 (and earlier) | 5.9.5.3 (released 2026‑12‑01) – includes a bounds check before the write. |
net-snmp 5.10.pre1 – 5.10.pre2 | 5.10.pre3 (released 2026‑12‑01) – same fix. |
Action: Upgrade all Net‑SNMP agents to ≥ 5.9.5.3 or ≥ 5.10.pre3. Verify the version after upgrade with snmpwalk -v2c -c public <IP> sysDescr.0.
2. Immediate Work‑arounds (if patch cannot be applied immediately)
| Mitigation | How to apply |
|---|---|
| Restrict SNMP write access | - Move write‑enabled community strings to a non‑default value.<br>- Use SNMPv3 with authPriv and limit the vacmAccessTable so that only a minimal set of managers have write rights.<br>- On the firewall, allow UDP/TCP 161 only from trusted management subnets. |
| Disable the vulnerable table | In snmpd.conf, add:<br>disableAuthorization yes or<br>vacmViewTreeFamilyTable 0 (if supported) to prevent any SET on that table. |
Run snmpd as an unprivileged user | Edit the init/systemd unit to start snmpd with User=snmp and Group=snmp. This limits the impact of a potential RCE to the snmp user, though many deployments already do this. |
| Network‑level rate limiting | Apply a rate‑limit on UDP 161 (e.g., iptables -A INPUT -p udp --dport 161 -m limit --limit 10/sec -j ACCEPT). This does not stop the exploit but reduces the chance of accidental DoS via repeated attempts. |
3. Detection
| Indicator | Where to look | Example pattern |
|---|---|---|
SNMP SET to vacmViewTreeFamilyTable with a huge first sub‑identifier | SNMP logs (e.g., /var/log/snmpd.log or syslog if snmpd is configured with logLevel debug) | SET request for .1.3.6.1.6.3.16.1.2.1.0.4294967295... |
Abrupt termination of snmpd | Systemd journal (journalctl -u snmpd) or /var/log/messages | snmpd[1234]: * terminating on signal 11 (Segmentation fault) * |
| Repeated malloc(0) warnings (if the library logs them) | dmesg or kernel logs (/var/log/kern.log) | net-snmp: view_parse_oid: malloc(0) returned NULL |
| Unusual traffic from a single source | Network IDS/IPS (e.g., Zeek, Suricata) | snmp SET request to .1.3.6.1.6.3.16.1.2.1.* with length > 1000 |
Snort/Suricata rule example (illustrative):
alert udp $HOME_NET any -> $EXTERNAL_NET 161 (msg:"NET-SNMP VACM view_tree_family OID underwrite attempt (CVE-2026-138295)";
content:"|30 2c|"; offset:0; depth:2; # SNMP SET PDU (type 0x30, length)
byte_test:1,>,0,2; # ensure there is at least one variable binding
pcre:"/\.1\.3\.6\.1\.6\.3\.16\.1\.2\.1\..*4294967295/";
sid:2026138295; rev:1; classtype:attempted-dos;);Adjust the rule to match your IDS syntax; the rule is illustrative and should be tested before deployment.
4. Verification after mitigation
1. Confirm version: snmpwalk -v2c -c public <IP> sysDescr.0 → should report ≥ 5.9.5.3.
2. Test that the vulnerable OID is rejected: Run the PoC snmpset again; the daemon should respond with noSuchName or genErr instead of crashing.
3. Check logs for any “underwrite attempt” messages – none should appear after patch.
⚠️ Urgency
| Factor | Assessment |
|---|---|
| CVSS 6.9 (Medium) – high availability impact, low exploitation complexity once write credentials are known. | |
Privilege requirement (PR:H) – attacker must already have SNMP write rights. In many networks, write community strings are default (private) or poorly rotated, making the pre‑condition easy to meet. | |
| No public exploit – as of the publication date, no public exploit code exists, but the vulnerability is trivial to weaponise. | |
| CISA KEV – not listed, but the lack of a KEV entry does not diminish risk for internal networks. | |
| Potential for RCE – while CVSS only credits DoS, the underlying heap underwrite can be chained to full compromise in privileged contexts. |
Patch priority: High for any production environment that (a) runs a vulnerable Net‑SNMP version and (b) exposes SNMP write access to any network segment (including internal LAN).
snmpd runs as root (default on many UNIX systems). Bottom line: CVE‑2026‑138295 is a classic heap‑underwrite that turns an already‑privileged SNMP write operation into a single‑packet denial‑of‑service and a potential remote code execution vector. Prompt patching, tightening of SNMP write permissions, and monitoring for the described OID patterns are the most effective defenses.
[🤖 CVE Professor AI Security Engine]
FOFA Query