CVE-2026-5857: Contiki-NG MQTT Client Out-of-Bounds Write in PUBLISH Topic Parser via Persistent State Between TCP Segments
Contiki-NG's MQTT client parse_publish_vhdr() in os/net/app-layer/mqtt/mqtt.c sets topic_len_received=1 before checking topic_len against the 64-byte limit, so an over-length topic returns early but leaves the flag set. On the next TCP segment, tcp_input() re-invokes the parser with topic_received==0, and the persisted topic_len_received==1 skips the length-reading block containing the guard, falling through directly to a memcpy() that uses the unvalidated 16-bit topic_len as the copy length. The 65-byte topic[] destination overruns into adjacent struct fields including the payload_chunk pointer, which subsequent MQTT code dereferences, giving a compromised or attacker-controlled broker an arbitrary-pointer-write primitive. Contiki-NG's MQTT implementation has no TLS support so the connection is plaintext. Impact ranges from information disclosure and denial of service to remote code execution on embedded targets without memory protection.
Security readout for executives and security teams
Plain-English summary
A malicious or compromised MQTT broker can abuse fragmented network traffic to make a Contiki-NG device overwrite memory. This can crash the device, expose data, or potentially execute code. MQTT traffic is plaintext in this implementation, increasing concern on untrusted networks. The supplied version information is insufficient to define the full affected range.
Executive priority
Prioritize identification and remediation of exposed Contiki-NG MQTT devices, especially operational or safety-relevant systems. Potential code execution and device disruption justify urgent action, but the reported high attack complexity and absence of documented active exploitation make immediate emergency shutdown unwarranted unless suspicious failures are already occurring.
Technical view
Persistent parser state across TCP segments can bypass the 64-byte topic-length guard in parse_publish_vhdr(). A later memcpy uses the unvalidated 16-bit length against a 65-byte buffer, corrupting adjacent structure fields, including a subsequently dereferenced pointer. Reported consequences include information disclosure, denial of service, and possible remote code execution on targets lacking memory protection.
Likely exposure
Exposure is most likely where embedded devices use Contiki-NG's MQTT client and communicate with attacker-controlled or compromised brokers. Plaintext MQTT also exposes connections to interference on untrusted networks. The bundle identifies Contiki-NG as affected but provides only version "0," so organizations must verify deployed source revisions rather than rely on that version field.
Exploitation context
The CVSS 4.0 score is 9.2, with network reachability, high attack complexity, no privileges, and no user interaction. The supplied sources do not establish active exploitation, and the CVE is not listed as KEV in the bundle. Exploitation depends on specially segmented broker traffic and vulnerable persistent parser state.
Researcher notes
The flaw is a CWE-787 out-of-bounds write caused by incorrect ordering and persistence of topic_len_received. The adjacent payload_chunk pointer reportedly turns corruption into a powerful memory-write condition. Actual exploitability will vary by architecture, compiler layout, and memory protections. The supplied affected-version metadata is incomplete, so source-level verification is essential.
Mitigation direction
Apply a vendor release containing commit a34a2dbdc8bea784bd2ae5079aa4be520cd74f2d after compatibility testing.
If no fixed release exists, assess backporting the referenced patch through the device vendor.
Restrict devices to trusted MQTT brokers and tightly control broker administration.
Isolate plaintext MQTT traffic on trusted networks until patched.
Monitor vendor guidance for clarified affected versions and supported releases.
Validation and detection
Inventory firmware using Contiki-NG and determine the exact mqtt.c source revision.
Confirm whether commit a34a2dbdc8bea784bd2ae5079aa4be520cd74f2d is present.
Review configurations for MQTT client use and broker destinations.
Test the patched parser with oversized, segmented PUBLISH topics in an isolated environment.
Monitor devices and brokers for unexplained MQTT-related crashes or resets.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-787: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references code or command execution, so execution technique review may help defensive triage. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-787 · source CWE mapping
Out-of-bounds Write
Out-of-bounds Write represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.