lwIP SNMPv3 USM Stack-Based Buffer Overflow (CVE-2026-8836)
by Hunt-Benito · 2026-07-05
- Severity
- Critical
- CVE
- CVE-2026-8836
- Category
- network
- Affected product
- lwIP (lightweight TCP/IP stack) — snmp_parse_inbound_frame() in src/apps/snmp/snmp_msg.c
- Affected versions
- lwIP <= 2.2.1 with LWIP_SNMP_V3 enabled
- Disclosed
- 2026-07-05
- Patch status
- unpatched
References
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-06 |
| Author / Researcher | Hunt-Benito |
| CVE / Advisory | CVE-2026-8836 |
| Category | network |
| Severity | Critical |
| CVSS Score | 9.8 |
| Status | PoC |
| Tags | lwip, snmp, snmpv3, stack-overflow, embedded, rce, asn1, cwe-121 |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | lwIP (lightweight TCP/IP stack) — snmp_parse_inbound_frame() in src/apps/snmp/snmp_msg.c |
| Versions Affected | lwIP <= 2.2.1 with LWIP_SNMP_V3 enabled |
| Language / Platform | C / embedded network stack |
| Authentication Required | No |
| Network Access Required | Yes (SNMPv3, typically UDP/161) |
Summary
lwIP’s SNMPv3 User-based Security Model (USM) handler contains a stack-based buffer overflow in snmp_parse_inbound_frame(). A commented-out bounds check combined with an incorrect buffer-size parameter passed to snmp_asn1_dec_raw() allows an oversized msgAuthenticationParameters OCTET STRING (declared via its ASN.1 TLV length) to overflow the fixed 12-byte msg_authentication_parameters stack buffer (SNMP_V3_MAX_AUTH_PARAM_LENGTH), corrupting adjacent stack memory and enabling remote code execution on embedded devices using lwIP with SNMPv3 enabled.
Vulnerability Details
Root Cause
snmp_asn1_dec_raw() is called with tlv.value_len used as both the amount of data to read from the wire and the destination buffer’s maximum length; because the actual destination buffer (msg_authentication_parameters[12]) is fixed at 12 bytes and the internal bounds check that would normally catch this was commented out, an attacker-controlled TLV length greater than 12 causes a stack buffer overflow (CWE-121).
Attack Vector
- Construct a well-formed SNMPv3 message so it passes initial protocol validation.
- Set the
msgAuthenticationParametersOCTET STRING’s ASN.1 TLV length to a value larger than 12 bytes (the true buffer size). - Send the crafted packet to the target’s SNMP service (UDP/161).
snmp_parse_inbound_frame()copies attacker-controlled data past the 12-byte stack buffer, corrupting the stack and potentially achieving control-flow hijack / remote code execution.
Impact
Remote code execution or denial of service on embedded/IoT devices running lwIP with LWIP_SNMP_V3 enabled, triggerable via a single crafted unauthenticated SNMPv3 packet.
Environment / Lab Setup
Target: Device/firmware built with lwIP <= 2.2.1 and LWIP_SNMP_V3 enabled, SNMP service on UDP/161
Attacker: Any host able to reach the target's SNMP port (Python 3, exploit.py provided)
Proof of Concept
PoC Script
See
exploit.pyandrequirements.txtin this folder.
| |
exploit.py constructs a valid SNMPv3 message with an oversized msgAuthenticationParameters OCTET STRING in the USM security parameters, setting the TLV length beyond the 12-byte buffer to trigger the stack overflow in snmp_parse_inbound_frame().
Detection & Indicators of Compromise
Signs of compromise:
- SNMP service crashes or unexpected reboots on lwIP-based devices.
- Oversized
msgAuthenticationParametersfields in captured SNMPv3 traffic (length > 12 bytes). - Unexpected outbound connections or behavior from embedded devices following SNMP traffic on UDP/161.
Remediation
| Action | Detail |
|---|---|
| Primary fix | Update lwIP to the version containing commit 0c957ec0, which restores the bounds check |
| Interim mitigation | Disable LWIP_SNMP_V3 if not required, or restrict SNMP access to trusted management networks/firewall rules |
References
Notes
Mirrored from https://github.com/Hunt-Benito/lwip-snmpv3-stack-overflow-cve-2026-8836-critical-embedded-rce on 2026-07-05. Original clone URL provided in the source batch (Hunt-Benito/lwip-snmpv3-...-rce) was a truncated/placeholder name; the actual repository slug was resolved via the GitHub API before mirroring.
| |