CVE-2026-14368: bounds in zephyrproject zephyr
Description
The LwM2M JSON content formatter's get_string() in subsys/net/lib/lwm2m/lwm2m_rw_json.c copies a parsed JSON string into a caller-supplied buffer and NUL-terminates it. The length guard used if (string_length > buflen), which accepts a string whose length is exactly buflen. After memcpy() fills the whole buffer, buf[string_length] = '\0' then writes one byte past the end of the buffer (CWE-787). The string value and its length are taken directly from the incoming CoAP payload during a LwM2M WRITE: do_write_op_json() parses the payload obtained from coap_packet_get_payload(), and get_string() is invoked from lwm2m_write_handler() (engine_get_string() in subsys/net/lib/lwm2m/lwm2m_message_handling.c) for a LWM2M_RES_TYPE_STRING resource. The destination buf/buflen is either the resource instance's fixed data buffer (res_inst->data_ptr/max_data_len) or the engine validation buffer (msg->ctx->validate_buf). A LwM2M server (the client's DTLS peer) can therefore write a string resource with a value whose length equals the target buffer size and force a one-byte overflow. The overflow is a single out-of-bounds write of the constant byte 0x00 immediately past the resource or validation buffer, corrupting the adjacent byte in memory. It is not an information leak and the written value is fixed, so it is not a direct code-execution primitive, but it can corrupt adjacent state (an adjacent resource value, a length/flag field, or a struct field) and cause data corruption or a crash. Triggering the write is deterministic; the resulting impact depends on memory layout. The fix changes the guard to string_length >= buflen, rejecting the exact-length case and aligning the JSON formatter with the other content formatters (lwm2m_rw_plain_text.c, lwm2m_rw_oma_tlv.c, lwm2m_rw_senml_json.c, lwm2m_rw_cbor.c, lwm2m_rw_senml_cbor.c), which already used the correct boundary check.
CVSS v3.1
Score 5.4medium
Affected software
zephyrproject
zephyr
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability exists in the get_string() function of the LwM2M JSON content formatter in Zephyr (subsys/net/lib/lwm2m/lwm2m_rw_json.c). The function uses an incorrect length guard condition (if string_length > buflen) that allows a string with length equal to the buffer size to be copied fully, followed by a null terminator write one byte beyond the buffer boundary (CWE-787). This off-by-one overflow occurs during LwM2M WRITE operations when the string value is taken directly from the CoAP payload. The overflow writes a single 0x00 byte past the buffer, which can corrupt adjacent memory such as resource values or struct fields, potentially causing crashes or data corruption. The fix involves changing the guard to reject strings with length equal to the buffer size (string_length >= buflen), aligning it with other content formatters in Zephyr.
Potential Impact
The vulnerability results in a single-byte out-of-bounds write immediately past the target buffer, which can corrupt adjacent memory. While it does not leak information or directly enable code execution, it can cause data corruption or application crashes depending on memory layout. The impact is limited to integrity and availability, with no confidentiality loss. Exploitation requires a LwM2M server to send a crafted WRITE request to a vulnerable client.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. The described fix changes the boundary check to reject strings whose length equals the buffer size, preventing the overflow. Until an official patch or update is available, avoid accepting untrusted LwM2M WRITE requests or apply network-level controls to restrict access to the LwM2M client. Monitor vendor communications for an official fix.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- zephyr
- Date Reserved
- 2026-07-01T19:30:21.245Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 6a95cd85acd9273b49762f7d
Added to database: 08/31/2026, 18:52:53 UTC
Last enriched: 09/07/2026, 14:56:21 UTC
Last updated: 10/15/2026, 18:48:17 UTC
Views: 97
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.