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-18746 Overview
CVE-2026-18746 is a NULL pointer dereference vulnerability [CWE-476] in the Zephyr RTOS LwM2M client implementation. The flaw resides in parse_write_op() within subsys/net/lib/lwm2m/lwm2m_message_handling.c, which processes inbound CoAP WRITE and CREATE requests carrying a Block1 option. When init_block_ctx() fails to allocate a context entry, it returns -ENOMEM and sets the caller's pointer to NULL. The code stored the peer-selected block size into the context before checking the return code, dereferencing the NULL pointer and crashing the device.
Critical Impact
A remote attacker reaching the LwM2M UDP socket can exhaust the static Block1 context pool and trigger a fatal memory fault, forcing the target device to crash or reset.
Affected Products
- Zephyr RTOS LwM2M subsystem (subsys/net/lib/lwm2m/lwm2m_message_handling.c)
- Deployments using default CONFIG_LWM2M_NUM_BLOCK1_CONTEXT (3 entries)
- NoSec LwM2M deployments without CONFIG_LWM2M_DTLS_SUPPORT enabled
Discovery Timeline
- 2026-09-29 - CVE-2026-18746 published to NVD
- 2026-09-30 - Last updated in NVD database
Technical Details for CVE-2026-18746
Vulnerability Analysis
The defect sits in the Block1 handling path of the LwM2M message parser. On receipt of the first block (block_num == 0) of a WRITE or CREATE transfer, parse_write_op() calls init_block_ctx() to reserve an entry in the block1_contexts[] pool. The function then writes block_ctx->ctx.block_size = block_size before validating the return value. When allocation fails, init_block_ctx() returns -ENOMEM and nulls the caller's pointer, so the store dereferences NULL.
The write targets a fixed low address with a value between 0 and 7. The resulting fault is a BusFault or corrupted low-memory access. This limits the impact to denial of service; confidentiality and integrity are not affected.
Root Cause
The static pool holds CONFIG_LWM2M_NUM_BLOCK1_CONTEXT entries, defaulting to 3. Entries are only reclaimed on transfer completion, failure, or after a 30-second timeout. An attacker starts three block-wise writes on distinct object paths with the CoAP More bit set and leaves them incomplete. A fourth write on a new path then hits the unguarded dereference.
Attack Vector
Reachability depends only on the UDP socket's source-address filter unless CONFIG_LWM2M_DTLS_SUPPORT is enabled, which is not the default. In a NoSec deployment, an on-path or address-spoofing attacker needs no credentials. The same sequence is reachable from a bootstrap server, a lower-trust server, or accidentally from a legitimate server running four concurrent block transfers.
// Patch: subsys/net/lib/lwm2m/lwm2m_message_handling.c
// net: lwm2m: Check block context allocation before use
free_block_ctx(block_ctx);
r = init_block_ctx(&msg->path, &block_ctx);
+ }
+
+ if (block_ctx == NULL) {
+ LOG_ERR("Cannot find block context");
+ return r < 0 ? r : -ENOMEM;
+ }
+
+ if (block_num == 0) {
/* If we have already parsed the packet, we can handle the block size
* given by the server.
*/
block_ctx->ctx.block_size = block_size;
}
- if (r < 0) {
- LOG_ERR("Cannot find block context");
- return r;
- }
-
msg->in.block_ctx = block_ctx;
Source: Zephyr commit e61790f
Detection Methods for CVE-2026-18746
Indicators of Compromise
- Unexpected device resets or BusFault crash logs on Zephyr targets running the LwM2M client
- Log entries containing Cannot find block context emitted before a reset
- Multiple incomplete CoAP Block1 transfers (More bit set) from the same or spoofed peer on distinct object paths
Detection Strategies
- Inspect CoAP traffic to the LwM2M port (default UDP 5683 for NoSec, 5684 for DTLS) for concurrent Block1 transfers exceeding CONFIG_LWM2M_NUM_BLOCK1_CONTEXT
- Correlate device crash telemetry with recent inbound WRITE or CREATE requests targeting new object paths
- Alert on repeated LwM2M sessions from unauthorized source addresses when DTLS is not enforced
Monitoring Recommendations
- Forward Zephyr device serial or syslog output to a centralized log store and monitor for BusFault and Cannot find block context events
- Track LwM2M server behavior for legitimate transfer patterns to distinguish accidental exhaustion from abuse
- Baseline the rate of Block1 initiations per source and alert on bursts of incomplete transfers
How to Mitigate CVE-2026-18746
Immediate Actions Required
- Apply the upstream Zephyr patch from commit e61790f and rebuild affected firmware images
- Enable CONFIG_LWM2M_DTLS_SUPPORT and require mutual authentication on all LwM2M sockets
- Restrict inbound UDP reachability to the LwM2M port so only trusted management servers can connect
Patch Information
The fix moves the block_ctx->ctx.block_size store below the guard and validates the context pointer itself rather than relying on the return code. The context is only touched once it is known to be valid. See the GitHub Security Advisory GHSA-4q9g-2mhh-m7w7 for advisory details.
Workarounds
- Increase CONFIG_LWM2M_NUM_BLOCK1_CONTEXT to reduce the likelihood of accidental exhaustion by legitimate concurrent transfers
- Enforce network-layer filtering so only known LwM2M server addresses can send CoAP traffic to the client
- Disable the LwM2M client on devices that do not require remote management until patched firmware is deployed
# Zephyr Kconfig fragment: require DTLS and expand Block1 pool
CONFIG_LWM2M_DTLS_SUPPORT=y
CONFIG_LWM2M_NUM_BLOCK1_CONTEXT=8
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

