CVE-2026-5857

Contiki-NG MQTT Client Out-of-Bounds Write in PUBLISH Topic Parser via Persistent State Between TCP Segments

Published Aug 6, 2026 CVSS 4.0 · 9.2 Critical EPSS < 1% KEV · Not listed
Description
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.

Analysis

AI-generated

Technical impact

Contiki-NG’s MQTT client contains a parsing flaw that allows an attacker to craft a publish packet with a topic longer than the allowed 64-byte limit. The parser incorrectly handles the length field between TCP segments, resulting in an out-of-bounds write to the topic buffer and inadvertently overwriting a pointer in the message structure. This provides the attacker with an arbitrary-pointer-write primitive that can be leveraged to read or modify critical data, and ultimately execute arbitrary code on the target device.

Affected Systems

The vulnerability affects all Contiki-NG implementations that use the current MQTT client code. The specific commit that introduced the issue is recorded in the project’s repository. Versions of Contiki-NG prior to the merge of the fix in pull‑request 3163 are susceptible; precise version ranges are not listed, so any build that includes the unpatched mqtt.c module is at risk.

Risk and Exploitability

The flaw is high severity, with a CVSS score of 9.2. No EPSS data is available and the vulnerability is not in the KEV catalog, but the lack of TLS and the embedded nature of the software mean that an attacker who can act as a broker or otherwise send crafted MQTT packets stands a strong chance of exploiting it. The attack vector is via plain‑text MQTT traffic and does not require privileged access to the device; as such, the risk is substantial for exposed or poorly isolated deployments.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Contiki‑NG to the latest version that includes the patch from commit a34a2dbdc8bea784bd2ae5079aa4be520cd74f2d
  • If an immediate update is not possible, disable the MQTT client on the device or restrict connections to trusted brokers only
  • Apply network segmentation and firewall rules to prevent untrusted MQTT traffic from reaching devices running vulnerable Contiki‑NG

Generated by OpenCVE AI on August 7, 2026 at 00:34 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
CPEs cpe:2.3:o:contiki-ng:contiki-ng:*:*:*:*:*:*:*:*
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Contiki-ng
Contiki-ng contiki-ng
Vendors & Products Contiki-ng
Contiki-ng contiki-ng
Type Values Removed Values Added
Description 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.
Title Contiki-NG MQTT Client Out-of-Bounds Write in PUBLISH Topic Parser via Persistent State Between TCP Segments
Weaknesses CWE-787
References
Metrics cvssV3_1

{'score': 8.1, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 9.2, 'vector': 'CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
VulnCheck
Published
Updated
Nov 8, 2026, 2:07 PM
Reserved
Apr 8, 2026, 7:29 PM
Status
Deferred
Published
Aug 6, 2026, 10:18 PM
Modified
Sep 24, 2026, 8:06 PM