Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2025-62723 Overview
CVE-2025-62723 is a memory leak vulnerability in FlashMQ, an MQTT broker designed for multi-CPU environments. Authenticated users can create sessions that collect Quality of Service (QoS) messages. When these messages are not delivered to a client, FlashMQ fails to release them upon session expiration. The flaw stems from circular references in the QoS packet queue implementation. Repeated abuse exhausts broker memory and degrades availability. Versions prior to 1.23.2 are affected, and the maintainer resolved the issue in release 1.23.2.
Critical Impact
Any authenticated MQTT client can accumulate undelivered QoS messages that persist beyond session expiration, enabling resource exhaustion against the broker [CWE-772].
Affected Products
- FlashMQ versions prior to 1.23.2
- MQTT broker deployments exposing authenticated client access
- Multi-CPU MQTT infrastructure using FlashMQ for IoT or messaging workloads
Discovery Timeline
- 2025-10-24 - CVE-2025-62723 published to NVD
- 2026-10-08 - Last updated in NVD database
Technical Details for CVE-2025-62723
Vulnerability Analysis
FlashMQ maintains a per-session queue of QoS 1 and QoS 2 publish packets awaiting client acknowledgement. The queue is implemented as a doubly linked list where each QueuedPublish node holds std::shared_ptr references to both its predecessor and successor nodes. These bidirectional strong references form a reference cycle. When the broker attempts to release a session or purge queued messages, the reference counts never reach zero. The allocated QueuedPublish objects remain resident in memory indefinitely. An authenticated attacker can repeatedly subscribe, trigger QoS message queuing, and allow sessions to expire. Each cycle leaks memory proportional to the queued payloads.
Root Cause
The root cause is improper reference management in the QoS packet queue data structure [CWE-772: Missing Release of Resource after Effective Lifetime]. Using std::shared_ptr for both prev and next pointers in a doubly linked list creates circular ownership. C++ smart pointers do not perform cycle detection, so cycles must be broken manually using std::weak_ptr for one direction.
Attack Vector
Exploitation requires valid broker credentials. The attacker connects as an MQTT client, subscribes to topics with QoS 1 or QoS 2, and arranges for messages to be queued without acknowledgement. The attacker then disconnects and allows the session to expire. The leaked memory persists until broker restart. Repeated iterations exhaust broker memory and cause denial of service.
// Patch: qospacketqueue.h - break the shared_ptr cycle with weak_ptr
public:
QueuedPublish(Publish &&publish, uint16_t packet_id, const std::optional<std::string> &topic_override);
QueuedPublish(const QueuedPublish &other) = delete;
+ QueuedPublish(QueuedPublish &&other) = delete;
- std::shared_ptr<QueuedPublish> prev;
- std::shared_ptr<QueuedPublish> next;
+ QueuedPublish &operator=(const QueuedPublish&) = delete;
+ QueuedPublish &operator=(QueuedPublish&&) = delete;
+
+ std::weak_ptr<QueuedPublish> prev;
+ std::weak_ptr<QueuedPublish> next;
Source: FlashMQ commit e86c493
// Patch: qospacketqueue.cpp - lock weak_ptr before dereferencing
{
std::shared_ptr<QueuedPublish> &qp = pos->second;
- if (qp->prev)
- qp->prev->next = qp->next;
+ auto _prev = qp->prev.lock();
+
+ if (_prev)
+ _prev->next = qp->next;
if (this->head == qp)
- this->head = qp->prev;
+ this->head = qp->prev.lock();
+
+ auto _next = qp->next.lock();
- if (qp->next)
- qp->next->prev = qp->prev;
+ if (_next)
+ _next->prev = qp->prev;
if (this->tail == qp)
- this->tail = qp->next;
+ this->tail = qp->next.lock();
this->queue.erase(pos);
}
Source: FlashMQ commit e86c493
Detection Methods for CVE-2025-62723
Indicators of Compromise
- Steady growth in FlashMQ resident memory (RSS) without corresponding increase in active client sessions or message throughput.
- Authenticated clients repeatedly connecting, subscribing to QoS 1 or QoS 2 topics, and disconnecting without acknowledging in-flight publishes.
- Session expiration events in FlashMQ logs that are not accompanied by proportional queue size reductions.
Detection Strategies
- Correlate broker process memory metrics against the count of active sessions and queued messages exposed by FlashMQ monitoring endpoints.
- Monitor MQTT broker telemetry for abnormal rates of session create/expire events from a single authenticated identity.
- Alert on sustained memory growth over hours or days without a corresponding workload increase.
Monitoring Recommendations
- Export FlashMQ process metrics to a time-series database and set alerts on memory growth trends.
- Enable broker logging for session lifecycle events and ingest them into a centralized log platform for behavioral analysis.
- Track per-client QoS message queue depths to identify clients queuing but never acknowledging messages.
How to Mitigate CVE-2025-62723
Immediate Actions Required
- Upgrade FlashMQ to version 1.23.2 or later on all broker instances.
- Audit broker credentials and revoke any accounts not required for current workloads.
- Restart affected FlashMQ processes after upgrade to clear leaked memory from prior sessions.
Patch Information
The maintainer released the fix in FlashMQ 1.23.2. The patch replaces std::shared_ptr<QueuedPublish> with std::weak_ptr<QueuedPublish> for the prev and next pointers in the QueuedPublish structure, breaking the reference cycle. Full details are available in the GitHub Security Advisory GHSA-7mhp-22q4-r6vv and the upstream commit e86c493.
Workarounds
- Restrict broker authentication to trusted clients only, reducing the attacker pool able to trigger the leak.
- Reduce the configured maximum QoS queue size per session to cap per-session leaked memory.
- Schedule periodic broker restarts as a short-term mitigation until the upgrade is deployed.
# Verify installed FlashMQ version and upgrade
flashmq --version
# Pull and build the fixed release
git clone --branch v1.23.2 https://github.com/halfgaar/FlashMQ.git
cd FlashMQ && mkdir build && cd build
cmake .. && make -j$(nproc)
# Restart the broker service to clear leaked memory
sudo systemctl restart flashmq
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

