Out-of-bounds read in SNMP when decoding a string in Contiki-NG
Description
Contiki-NG is an open-source, cross-platform operating system for IoT devices. An out-of-bounds read of 1 byte can be triggered when sending a packet to a device running the Contiki-NG operating system with SNMP enabled. The SNMP module is disabled in the default Contiki-NG configuration. The vulnerability exists in the os/net/app-layer/snmp/snmp-ber.c module, where the function snmp_ber_decode_string_len_buffer decodes the string length from a received SNMP packet. In one place, one byte is read from the buffer, without checking that the buffer has another byte available, leading to a possible out-of-bounds read. The problem has been patched in Contiki-NG pull request #2936. It will be included in the next release of Contiki-NG. Users are advised to apply the patch manually or to wait for the next release. A workaround is to disable the SNMP module in the Contiki-NG build configuration.
Affected products
1- Range: <= 4.9
Patches
140a5f4585f06Merge pull request #2936 from OwenCochell/snmp-vuln-ber
1 file changed · +4 −8
os/net/app-layer/snmp/snmp-ber.c+4 −8 modified@@ -372,20 +372,16 @@ snmp_ber_decode_string_len_buffer(snmp_packet_t *snmp_packet, const char **str, return 0; } - if((*snmp_packet->in & 0x80) == 0) { + if (snmp_packet->used == 0) { + return 0; + } - if(snmp_packet->used == 0) { - return 0; - } + if((*snmp_packet->in & 0x80) == 0) { *length = (uint32_t)*snmp_packet->in++; snmp_packet->used--; } else { - if(snmp_packet->used == 0) { - return 0; - } - length_bytes = (uint8_t)(*snmp_packet->in++ & 0x7F); snmp_packet->used--;
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
2- github.com/contiki-ng/contiki-ng/pull/2936mitrex_refsource_MISC
- github.com/contiki-ng/contiki-ng/security/advisories/GHSA-qjj3-gqx7-438wmitrex_refsource_CONFIRM
News mentions
0No linked articles in our index yet.