Use After Free in Emqx Nanomq
CVE-2025-66023
NanoMQ MQTT Broker (NanoMQ) is an all-around Edge Messaging Platform. Versions prior to 0.24.5 have a Heap-Use-After-Free (UAF) vulnerability within the MQTT bridge client component (implemented via the underlying NanoNNG library). The vulnerability is triggered when NanoMQ acts as a bridge connecting to a remote MQTT broker. A malicious remote broker can trigger a crash (Denial of Service) or potential memory corruption by accepting the connection and immediately sending a malformed packet sequence. Version 0.34.5 contains a patch. The patch enforces stricter protocol adherence in the MQTT client SDK embedded in NanoMQ. Specifically, it ensures that CONNACK is always the first packet processed in the line. This prevents the state confusion that led to the Heap-Use-After-Free (UAF) when a malicious server sent a malformed packet sequence immediately after connection establishment. As a workaround, validate the remote broker before bridging.
Vulnerability class: Use-After-Free
Published · last modified .
CVSS v3 metric
CVSS v3 base score 4.9 (Medium). Vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H.
EPSS exploit prediction
EPSS 0.004, 31.2th percentile (scored ); unchanged over 30 days. About EPSS.
Affected products
- Emqx Nanomq
- Nanomq — versions < 0.24.5
Weakness classification (CWE)
References
- https://github.com/nanomq/nanomq/security/advisories/GHSA-24f7-q5hh-27hf (Vendor Advisory)
- https://github.com/nanomq/nanomq/issues/2145 (Issue Tracking)
- https://github.com/nanomq/NanoNNG/pull/1365 (Patch, Issue Tracking)