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-18416 Overview
CVE-2026-18416 is an out-of-bounds read [CWE-125] in the Zephyr RTOS Contrained Application Protocol (CoAP) link-format helper match_path_uri() located in subsys/net/lib/coap/coap_link_format.c. The function compares a registered resource path against a URI carried in a Uri-Query href= option. The inner character loop advances its index without checking against the option length, allowing a read past the end of the option value when a registered path segment is longer than the supplied URI and the URI is a prefix of it.
Critical Impact
An unauthenticated attacker can trigger a bounded one-byte out-of-bounds read on the stack by sending a crafted GET /.well-known/core?href=/<prefix> request. The consequence is undefined behaviour, not information disclosure.
Affected Products
- Zephyr RTOS CoAP server subsystem with CONFIG_COAP_SERVER_WELL_KNOWN_CORE enabled (default y)
- Devices serving /.well-known/core with resources that declare struct coap_core_metadata attributes
- ZoAP library versions v1.8.0 through v1.9.x (where the over-read extended into the received packet buffer)
Discovery Timeline
- 2026-09-28 - CVE-2026-18416 published to NVD
- 2026-09-30 - Last updated in NVD database
Technical Details for CVE-2026-18416
Vulnerability Analysis
The defect resides in match_path_uri() within subsys/net/lib/coap/coap_link_format.c. The function iterates through registered resource paths and compares each character to the caller-supplied URI. The inner loop increments the URI index k once per path character but never validates k against the option length len. When the registered path is longer than the URI and the URI matches as a prefix, the loop dereferences uri[k] past the end of the option value.
The call chain reaches this code from coap_well_known_core_get_len() and coap_well_known_core_get() via match_queries_resource(). Any unauthenticated GET /.well-known/core?href=/<prefix> request against a vulnerable device reaches the flawed comparison.
In the current Zephyr code, the option value is copied into a stack-local struct coap_option whose value field is a fixed array of 12 bytes, or CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE bytes. The over-read therefore touches the uninitialized tail of that array or adjacent stack bytes. In the older ZoAP library (v1.8.0 to v1.9.x), the option value was a pointer into the received packet, and the over-read ran into the packet buffer.
Root Cause
The inner loop lacks a bounds check on the URI index before dereferencing uri[k]. Each additional byte is only read if it equals the next path character, so in practice the over-read is limited to one byte per invocation.
Attack Vector
An unauthenticated remote attacker sends a CoAP GET /.well-known/core?href=/<prefix> request where <prefix> matches the leading characters of a longer registered resource path. Returning a match requires the final compared index to be len - 1 or len, both in bounds, so the out-of-bounds bytes only steer the loop to the next candidate resource and cannot influence the response content.
// Patch from Zephyr commit ef5b303dc88fb5159850623a2b51b590c36fa5bc
k = i;
for (j = 0; j < plen; j++) {
+ if (k >= len) {
+ goto next;
+ }
+
if (uri[k] == '*') {
if ((k + 1) == len) {
return true;
Source: Zephyr commit ef5b303. The fix adds a k >= len guard at the top of the inner loop, ensuring every uri[k] dereference remains within the option value while still allowing a trailing * wildcard to match a longer path.
Detection Methods for CVE-2026-18416
Indicators of Compromise
- Inbound CoAP requests to /.well-known/core with a Uri-Query option of the form href=/<prefix> where the prefix matches the leading characters of a longer registered resource path.
- Unexpected crashes, memory faults, or watchdog resets on Zephyr-based devices shortly after receiving CoAP discovery traffic.
Detection Strategies
- Inspect CoAP traffic on UDP port 5683 (or DTLS on 5684) for repeated GET /.well-known/core queries carrying href= parameters with unusual short prefixes.
- Correlate CoAP query patterns with device stability telemetry to surface potential probing.
Monitoring Recommendations
- Log CoAP option contents at network sensors capable of parsing CoAP framing.
- Alert on high volumes of .well-known/core discovery requests from single sources against embedded fleets.
- Track firmware versions of Zephyr-based devices to identify unpatched builds still exposing CONFIG_COAP_SERVER_WELL_KNOWN_CORE.
How to Mitigate CVE-2026-18416
Immediate Actions Required
- Apply the upstream Zephyr fix from commit ef5b303dc88fb5159850623a2b51b590c36fa5bc to subsys/net/lib/coap/coap_link_format.c.
- Rebuild and redeploy firmware for all Zephyr-based devices that enable CONFIG_COAP_SERVER_WELL_KNOWN_CORE.
- Review deployments of the legacy ZoAP library (v1.8.0 through v1.9.x) and prioritize replacement since the over-read there extends into the packet buffer.
Patch Information
The fix is published in the Zephyr Security Advisory GHSA-m3mv-vvm4-h58g and merged via commit ef5b303dc88fb5159850623a2b51b590c36fa5bc. The patch adds a k >= len bounds check inside match_path_uri() before every uri[k] dereference.
Workarounds
- Disable the CoAP well-known core discovery endpoint by setting CONFIG_COAP_SERVER_WELL_KNOWN_CORE=n in the Zephyr build configuration when discovery is not required.
- Restrict network reachability of CoAP endpoints (UDP 5683/5684) to trusted management segments using firewall or ACL rules.
- Remove struct coap_core_metadata attributes from resources that do not require link-format advertisement.
# Disable the vulnerable well-known core discovery in prj.conf
CONFIG_COAP_SERVER_WELL_KNOWN_CORE=n
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

