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… (CVE-2026-5857)
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.
AI Analysis
Technical Summary
The vulnerability in Contiki-NG's MQTT client arises because the parse_publish_vhdr() function sets a flag (topic_len_received) before validating the topic length against the 64-byte limit. If the topic length is over the limit, the function returns early but leaves the flag set. When the next TCP segment is processed, the parser skips the length validation block due to the persisted flag and directly performs a memcpy() using the unvalidated 16-bit topic length. This causes a buffer overflow in the 65-byte topic buffer, overwriting adjacent struct fields including a pointer used later by MQTT code. This gives an attacker controlling the broker an arbitrary pointer write primitive. The lack of TLS means the connection is plaintext, increasing exposure. The impact ranges from information disclosure and denial of service to remote code execution on embedded targets without memory protection.
Potential Impact
An attacker controlling the MQTT broker can exploit this vulnerability to perform an arbitrary pointer write on the client device. This can lead to information disclosure, denial of service, or remote code execution on embedded devices running Contiki-NG's MQTT client. The plaintext nature of the connection (no TLS support) increases the risk of interception and exploitation. The vulnerability is critical with a CVSS score of 8.1, indicating high impact on confidentiality, integrity, and availability.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, avoid connecting Contiki-NG MQTT clients to untrusted or attacker-controlled brokers. Consider network-level protections to restrict broker access. Monitor vendor channels for patches or updates addressing this vulnerability.
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… (CVE-2026-5857)
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.
CVSS v3.1
Score 8.1high
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in Contiki-NG's MQTT client arises because the parse_publish_vhdr() function sets a flag (topic_len_received) before validating the topic length against the 64-byte limit. If the topic length is over the limit, the function returns early but leaves the flag set. When the next TCP segment is processed, the parser skips the length validation block due to the persisted flag and directly performs a memcpy() using the unvalidated 16-bit topic length. This causes a buffer overflow in the 65-byte topic buffer, overwriting adjacent struct fields including a pointer used later by MQTT code. This gives an attacker controlling the broker an arbitrary pointer write primitive. The lack of TLS means the connection is plaintext, increasing exposure. The impact ranges from information disclosure and denial of service to remote code execution on embedded targets without memory protection.
Potential Impact
An attacker controlling the MQTT broker can exploit this vulnerability to perform an arbitrary pointer write on the client device. This can lead to information disclosure, denial of service, or remote code execution on embedded devices running Contiki-NG's MQTT client. The plaintext nature of the connection (no TLS support) increases the risk of interception and exploitation. The vulnerability is critical with a CVSS score of 8.1, indicating high impact on confidentiality, integrity, and availability.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, avoid connecting Contiki-NG MQTT clients to untrusted or attacker-controlled brokers. Consider network-level protections to restrict broker access. Monitor vendor channels for patches or updates addressing this vulnerability.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-x5g5-4jq8-vj28
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-5857"]
- Ecosystems
- []
- Database Specific Severity
- CRITICAL
- Cvss Version
- 3.1
Threat ID: 6a75739dbf8831d539d91dfa
Added to database: 08/07/2026, 05:56:45 UTC
Last enriched: 08/07/2026, 07:11:36 UTC
Last updated: 08/08/2026, 00:41:14 UTC
Views: 2
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.