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 parsepublishvhdr() in os/net/app-layer/mqtt/mqtt.c sets topiclenreceived=1 before checking topiclen against the 64-byte limit, so an over-length topic returns early but leaves the flag set. On the next TCP segment, tcpinput() re-invokes the parser with topicreceived==0, and the persisted topiclenreceived==1 skips the length-reading block containing the guard, falling through directly to a memcpy() that uses the unvalidated 16-bit topiclen as the copy length. The 65-byte topic[] destination overruns into adjacent struct fields including the payloadchunk 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.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-5857?
CVE-2026-5857 has a severity rating of high with a score of 8.1.
What are the risks associated with CVE-2026-5857?
CVE-2026-5857 can result in an out-of-bounds write vulnerability that may lead to memory corruption.
How do I fix CVE-2026-5857?
To fix CVE-2026-5857, ensure you apply the latest patches provided by the Contiki-NG project.
What software is affected by CVE-2026-5857?
CVE-2026-5857 affects the Contiki-NG MQTT client specifically in its parsing logic for incoming TCP segments.
How can CVE-2026-5857 be exploited?
CVE-2026-5857 can be exploited by sending a maliciously crafted PUBLISH packet with an over-length topic that bypasses validation.