Skip to main content
Vulnerability Database/CVE-2026-112062

CVE-2026-112062: lwIP mDNS Buffer Overflow Vulnerability

CVE-2026-112062 is a stack buffer overflow in lwIP mDNS that lets adjacent attackers corrupt memory via malformed responses. This article covers technical details, affected versions, impact, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-112062 Overview

CVE-2026-112062 is a stack out-of-bounds write vulnerability [CWE-121] in the lightweight IP stack (lwIP) through version 2.2.1. The flaw resides in the mdns_handle_response function within the Multicast DNS (mDNS) application code. Adjacent attackers on the local link can send crafted mDNS responses containing invalid domain names to corrupt stack memory. Attackers trigger the condition by sending multicast PTR answers with oversized RDLENGTH values, or SRV answers with RDLENGTH below 6, during an active service search. The malformed data overflows a 256-byte stack buffer and crashes the device running the vulnerable stack.

Critical Impact

Adjacent network attackers can crash embedded devices running lwIP 2.2.1 and earlier by sending malformed mDNS responses, with potential for stack memory corruption affecting IoT and embedded systems availability.

Affected Products

  • lwIP through version 2.2.1
  • Embedded devices and IoT systems using lwIP mDNS application
  • Any firmware integrating src/apps/mdns/mdns.c from affected lwIP releases

Discovery Timeline

  • 2026-10-18 - CVE-2026-112062 published to NVD
  • 2026-10-19 - Last updated in NVD database

Technical Details for CVE-2026-112062

Vulnerability Analysis

The vulnerability exists in mdns_handle_response inside src/apps/mdns/mdns.c. When lwIP parses an incoming mDNS response during a service search, it processes PTR and SRV resource records to extract domain names. The handler reads a domain from the packet using mdns_readname. If parsing fails and returns MDNS_READNAME_ERROR, the fallback path copies raw resource-record data into a fixed data.dom structure containing a 256-byte name buffer.

The fallback uses the attacker-controlled ans.rd_length field directly as the copy length, without bounds checking against the destination buffer size. For SRV records, the code subtracts a 6-byte offset from rd_length. When rd_length is less than 6, the subtraction underflows into a large unsigned value. Both conditions cause memcpy to write past the 256-byte stack buffer, corrupting adjacent stack memory and crashing the device.

Root Cause

The root cause is missing length validation on untrusted network input before memcpy into a fixed-size stack buffer. The code trusts rd_length from the mDNS packet and performs an unchecked arithmetic operation on SRV records. There is no comparison against MDNS_DOMAIN_MAXLEN and no guard against SRV rd_length values below the 6-byte fixed-header size.

Attack Vector

Exploitation requires the attacker to be on the same local link as the target, since mDNS traffic uses link-local multicast and is not routed. The attacker waits for or triggers an mDNS service search on the victim, then responds with a crafted multicast packet. The malicious response contains either a PTR answer with an RDLENGTH greater than 256 bytes or an SRV answer with RDLENGTH less than 6. Either payload causes the vulnerable memcpy to overflow the stack buffer.

c
         u16_t off = (ans.info.type == DNS_RRTYPE_SRV ? 6 : 0);
         u16_t len = mdns_readname(pkt->pbuf, ans.rd_offset + off, &data.dom);
         if (len == MDNS_READNAME_ERROR) {
+          u16_t copy_len = LWIP_MIN(MDNS_DOMAIN_MAXLEN, ans.rd_length - off);
+          if (ans.rd_length < off) {
+            /* Skip packet - SRV rd data shorter than fixed header. */
+            break;
+          }
           /* Ensure result_fn is called anyway, just copy failed domain as is */
-          data.dom.length = ans.rd_length - off;
-          memcpy(&data.dom, (const char *)p->payload + offset + off, data.dom.length);
+          data.dom.length = pbuf_copy_partial(p, data.dom.name, copy_len, offset + off);
         }
         /* Adjust len/off according RR type */
         if (ans.info.type == DNS_RRTYPE_SRV) {

Source: lwIP commit ab2f69c. The patch clamps the copy length to MDNS_DOMAIN_MAXLEN, validates that rd_length is at least the SRV fixed-header size, and replaces the raw memcpy with pbuf_copy_partial.

Detection Methods for CVE-2026-112062

Indicators of Compromise

  • Unexpected reboots or crashes on embedded devices running lwIP shortly after mDNS activity on the local network.
  • Inbound mDNS response packets on UDP port 5353 containing PTR records with RDLENGTH greater than 256 bytes.
  • Inbound mDNS SRV responses on UDP port 5353 with RDLENGTH field values below 6.

Detection Strategies

  • Deploy network sensors on each VLAN or broadcast domain to inspect mDNS traffic for malformed RDLENGTH values.
  • Correlate device availability loss with preceding mDNS multicast traffic from untrusted hosts.
  • Build Zeek or Suricata signatures that flag mDNS responses where RDLENGTH exceeds the domain-name maximum or falls below SRV header requirements.

Monitoring Recommendations

  • Monitor syslog and watchdog telemetry from IoT and embedded devices for repeated unexpected restarts.
  • Track endpoints sending unsolicited mDNS answers to service queries they did not originate.
  • Alert on new or unauthorized hosts generating high volumes of multicast traffic to 224.0.0.251 or ff02::fb.

How to Mitigate CVE-2026-112062

Immediate Actions Required

  • Inventory firmware and embedded products using lwIP and identify versions at or below 2.2.1.
  • Apply the upstream lwIP patch from commit ab2f69c7d8980c01cdd67ed4b23ac61118ed0205 and rebuild affected firmware images.
  • Restrict access to local network segments hosting vulnerable devices to trusted systems only.

Patch Information

The fix is available in the lwIP upstream repository as commit ab2f69c7d8980c01cdd67ed4b23ac61118ed0205, which modifies src/apps/mdns/mdns.c. Downstream integrators must pull the patch into their SDKs and re-flash devices. Reference the VulnCheck advisory for lwIP and the HackMD CVE-2026-112062 analysis for additional technical context.

Workarounds

  • Disable the mDNS application in lwIP builds where service discovery is not required.
  • Segment IoT and embedded devices onto isolated VLANs that block untrusted multicast traffic.
  • Filter inbound UDP port 5353 traffic from untrusted sources at the network boundary where feasible.
bash
# Example: block external mDNS traffic reaching an embedded device segment
iptables -A FORWARD -p udp --dport 5353 -s 0.0.0.0/0 -d 192.0.2.0/24 -j DROP
iptables -A FORWARD -p udp --sport 5353 -s 0.0.0.0/0 -d 192.0.2.0/24 -j DROP

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.