Deep dive: MQTT and Eclipse Mosquitto for drone and IoT systems
A deep dive into MQTT publish-subscribe and Eclipse Mosquitto for drones and IoT: closing vulnerabilities with TLS and the Dynamic Security Plugin, use with ROS 2, the connection point with ChirpStack, and the MQTT.fx testing tool
This document builds on the security issue raised in the document 'Deep dive: coordinating drone swarms over a LoRa mesh network', which pointed out that at the application layer of drone swarm systems 'unencrypted MQTT is a major vulnerability', because robotics frameworks such as ROS were designed primarily for research and did not emphasise security from the outset. In response to the request to review and incorporate Eclipse Mosquitto (at github.com/eclipse-mosquitto/mosquitto) into the content, this document explains what MQTT is, what role Mosquitto plays in this ecosystem and, most importantly, how it helps close the vulnerability identified earlier.
1. What is MQTT: the publish-subscribe architecture
MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol designed for IoT devices and networks with limited bandwidth. At its heart is the Publish-Subscribe communication pattern, which differs from the point-to-point connections commonly used.

In this system there is an intermediary called a Broker , which receives messages from publishers and distributes them to subscribers, without either side needing to know about or connect to each other directly. Each message is sent to a 'topic', which has a hierarchical structure similar to a file path, such as drone/1/telemetry or drone/3/battery . Subscribers can use wildcards such as + (matching one level) or # (matching all remaining levels) to receive data from many drones at once without writing separate code for each aircraft. The protocol also defines three quality of service (QoS) levels, ranging from sending once with no guarantee to guaranteeing that a message reaches its destination exactly once, which is very important for control commands that must not be duplicated or lost.
2. Eclipse Mosquitto: the reference broker of the MQTT world
Eclipse Mosquitto is one of the most widely accepted open-source broker software packages in the MQTT world. Developed under the Eclipse Foundation, it supports MQTT versions 5.0, 3.1.1 and 3.1, and has more than 11,200 stars on GitHub and has been forked more than 2,600 times, reflecting widespread real-world use in industry. Besides the main broker, the project also provides a comprehensive set of supporting tools, including client libraries for C/C++ and command-line tools such as mosquitto_pub and mosquitto_sub for quickly testing sending and receiving messages, as well as mosquitto_ctrl and mosquitto_passwd for managing users and access rights (eclipse-mosquitto/mosquitto)
Figure 4b: Eclipse Mosquitto Broker with its client library and the four command-line tools that come with it
3. Closing the identified vulnerability: TLS and the Dynamic Security Plugin
The most important point for this document is to answer how Mosquitto solves, in practice, the 'unencrypted MQTT' problem identified earlier.

In its default state without further configuration, MQTT is often used over port 1883 in plaintext, which anyone on the same network can eavesdrop on. If authentication is not enforced, any client that knows the broker's address can immediately connect, send forged commands or eavesdrop on data. In a drone swarm context, this could mean an attacker impersonating one of the drones and injecting false data into the system, or eavesdropping on all positions and mission status.
Mosquitto solves this problem through two main layers of measures. The first layer is encryption with TLS over port 8883, which encrypts every message in transit just like websites that use HTTPS, and supports authentication with digital certificates (client certificates) where the strictest security is required. The second layer is the Dynamic Security Plugin , a fine-grained permission management system that can define where each user may connect from and which topics they are allowed to publish or subscribe to. When the two measures are combined, the system can ensure that each drone has its own account, connects only via TLS and can publish data only to its own topic. For example, drone 1 can no longer impersonate and send data in the name of drone/2/telemetry , which directly closes the spoofing vulnerability identified in the previous document (eclipse-mosquitto/mosquitto)
4. MQTT in real robotics and drone swarm systems using ROS 2
MQTT is not merely a theoretical concept; working bridges between the ROS 2 robotics framework and the MQTT world already exist.

The mqtt_client project, developed by RWTH Aachen University, is a ROS 2 node that acts as a bidirectional bridge between ROS messages and an MQTT broker. It supports both full conversion of ROS messages and primitive data types (integers, floating-point numbers, strings, booleans), so that it can also communicate with MQTT devices that do not use ROS. The project also includes an automatic latency measurement feature and supports QoS, TLS and authentication at a level usable in real industrial deployments. The developing institute is an automotive engineering unit, so it focuses on use cases such as vehicle-to-infrastructure communication (V2X) and distributed networks of automated vehicles (ika-rwth-aachen/mqtt_client)
At the industrial level, MQTT platforms such as EMQX have extended this concept into a 'real-time data backbone' that connects on-site ROS/DDS systems with cloud services. The publish-subscribe pattern decouples robot hardware from the control centre, allowing operators to manage robot fleets remotely without maintaining fragile point-to-point connections, and supporting scaling from a single robot to large commercial fleets within the same architecture, with enterprise-grade security measures including TLS/SSL encryption, X.509 certificate authentication and topic-level access control (EMQX, Unified MQTT Platform for Connected Robots). The same concept also appears in academic research proposing an architecture that combines Software-Defined Networking (SDN) with MQTT specifically for drone swarm communication on the battlefield, published in IEEE Communications Magazine in 2019. This shows that the idea of MQTT for security-related drone swarms is not new but a direction that has been seriously studied for some time (An SDN-MQTT Based Communication System for Battlefield UAV Swarms, IEEE Communications Magazine)
5. The invisible connection point: Mosquitto is already hidden inside ChirpStack
The most interesting part, looking back at the previous Swarm+LoRa document, is that the emergency monitoring system using ChirpStack as its Network Server actually already uses MQTT as its internal data publishing mechanism by default; the previous document simply did not go into detail on this point.

When a LoRaWAN device sends data up (uplink), the ChirpStack Network Server first decodes it and authenticates the device, then 'publishes all data received from devices as JSON over MQTT' , using a hierarchical topic structure such as application/APPLICATION_ID/device/DEV_EUI/event/up for uplink data and application/APPLICATION_ID/device/DEV_EUI/command/down for sending downlink commands back to the device. ChirpStack's own official documentation lists Mosquitto as the 'reference implementation', i.e. the reference broker for testing and production use (ChirpStack, MQTT Integration)
The practical meaning of this point is that if the emergency monitoring system described in the previous document were actually deployed, Mosquitto would act as the central distribution point that allows multiple downstream systems to receive the same data simultaneously and immediately: InfluxDB/Grafana for map display, ROS 2 via mqtt_client so that ground robots can respond to the data automatically, and manual inspection tools such as MQTT.fx for system administrators, without modifying a single line of ChirpStack's own code, because every party simply subscribes to the topics it needs from the same broker.
6. A tool for testing and inspection: MQTT.fx
When deploying a broker, whether Mosquitto or ChirpStack with embedded MQTT, developers and system administrators often need a tool to inspect the messages flowing back and forth visually. MQTT.fx is a graphical (GUI) MQTT client developed with JavaFX and based on the Eclipse Paho library. It works similarly to Mosquitto's mosquitto_pub/mosquitto_sub but provides an interactive window that is easier to use for people who are not comfortable with the command line. The file mqttfx-1.7.1-windows-x64 that was found is the version 1.7.1 installer specifically for 64-bit Windows (MQTT.fx 1.7.1, jensd.de)
In the context of the current work, this tool is suitable for checking the system before real deployment in several cases, such as connecting to a Mosquitto broker already configured with TLS/ACL to confirm that connections and access rights work correctly as designed, subscribing to ChirpStack topics such as application/# to view LoRaWAN uplink data in real time without writing any code first, or simulating control commands sent to each drone's topic to test system behaviour before connecting to real hardware. In summary, MQTT.fx is a client-side tool for 'seeing' what is happening in the MQTT system that Mosquitto manages behind the scenes. It is not a component that must be permanently installed in the production system, but a development and inspection tool that is useful throughout the system's life cycle.
Figure 5b: The three main use cases of MQTT.fx, checking TLS/ACL, viewing ChirpStack LoRaWAN uplinks, and simulating drone control commands
F28: data age and a growing queue
| Variable | Meaning and unit, input → output | Range/source of values |
|---|---|---|
| tmeasure, tnow | measurement time and evaluation time, s (input) | finite; epoch/unit/clock must match after offset compensation |
| age | data age at the user, s (output) | from 0 when the clock is correct; a negative value requires checking the time |
| λ, μ | incoming message rate and processing capacity, message/s (input) | from 0; measured at the same queue over the same period |
| Q₀, Q(t) | number of messages at the start and after period t, message (input, output) | from 0; the fluid model may give non-integer estimates |
| t | observation period, s (input) | from 0; rates are constant over this period |
| g | queue growth rate while non-empty, message/s (output) | λ − μ may be negative until the queue is empty |
Applied level · Question: even if messages are delivered, does the user receive sufficiently fresh data, and is the consumer keeping up with the producer?
age = tnow − tmeasure
g = λ − μ; Q(t) ≈ max(0, Q₀ + (λ − μ)t)
This queue formula is a fluid-model inflow/outflow account defined by the author for learning purposes; it is not an MQTT requirement. It assumes constant rates, an unlimited queue, no drop/expire/retry adding messages, and μ is the service capacity, which stops being used when the queue is empty. If λ is greater than μ, the queue grows by approximately λ − μ message/s. Latency percentiles cannot be inferred from this average.
Example: messages have arrived but are still stuck in the queue
- The timestamps after clock alignment are tmeasure = 100.00 s and tnow = 100.35 s, so age = 0.35 s = 350 ms
- λ = 20 message/s and μ = 15 message/s give g = 5 message/s
- Starting with Q₀ = 0 and observing for 12 s gives Q ≈ 0 + 5 × 12 = 60 messages still queued in the model
The figure separates the timeline from the queue, because the age of one message and the number of queued messages are different quantities. Measuring age across machines requires stating the synchronisation method, the offset and the clock uncertainty; if clocks differ by 0.1 s, the computed age may be wrong by 0.1 s. Do not use the absolute value to mask a negative age, and do not substitute the broker's receive time for the measurement time.
QoS and deadlines must be checked separately
OASIS MQTT 5.0, §4.3 (P2C04, checked 26 September B.E. 2569 (2026)) defines QoS as a message delivery level; it does not bound the processing time at the destination. QoS 1 may produce duplicate messages, so you must specify whether λ is counted before or after deduplication. The Message Expiry Interval in §3.3.2.3.3 limits the lifetime during protocol delivery stages; it does not guarantee that the application processes data before a deadline. Age and the policy for accepting/discarding stale data should also be checked at the application.
For latency percentiles, record per message the time from measurement to when the application actually uses the data, then use F37 statistics with the same percentile method, reporting the number of samples and dropped messages. Do not conclude p95 from λ and μ alone. ROS 2 QoS requires studying its specification separately; this lesson does not use MQTT in place of the meaning of ROS QoS.
Try it yourself
Keep λ = 20, Q₀ = 0, t = 12 s but increase μ to 18 message/s. Find g and Q. For data measured at 200.00 s and evaluated at 200.12 s, what is the age? A tolerance of 0.000001 in the unit of the result is accepted.
Open answer F28
g = 20 − 18 = 2 message/s; Q ≈ 2 × 12 = 24 messages; age = 200.12 − 200.00 = 0.12 s or 120 ms. Increasing processing capacity reduces the queue growth, but it still cannot keep up with the incoming rate.
Read together with bandwidth and packet loss F27 to report the volume, completeness and age of data.
Conclusion
Putting everything together, MQTT and Eclipse Mosquitto are not new technologies separate from the earlier content, but the missing piece that completes the picture, both in closing the application-layer security vulnerability identified in the Swarm+LoRa document and in revealing that the ChirpStack used in the emergency monitoring system already has MQTT working behind the scenes. Understanding Mosquitto is therefore not just about adding a new technology, but about understanding more deeply a mechanism that already exists in the architecture already designed, together with tools such as MQTT.fx that help operators inspect and test the whole system concretely before real deployment.
Bibliography
- Eclipse Foundation. eclipse-mosquitto/mosquitto: Eclipse Mosquitto - An open source MQTT broker. GitHub. https://github.com/eclipse-mosquitto/mosquitto
- ika-rwth-aachen. mqtt_client: ROS 2 C++ Node for bi-directionally bridging messages between ROS and MQTT. GitHub. https://github.com/ika-rwth-aachen/mqtt_client
- “The Unified MQTT Platform for Connected Robots.” EMQX. https://www.emqx.com/en/solutions/cloud-robotics
- Xiong, et al. “An SDN-MQTT Based Communication System for Battlefield UAV Swarms.” IEEE Communications Magazine, 2019. Read the article in IEEE Xplore
- “MQTT Integration.” ChirpStack Documentation. ChirpStack MQTT Integration documentation
- “MQTT.fx 1.7.1 is released!” JavaFX Delight. https://www.jensd.de/wordpress/?p=2746
Note: This document was prepared in response to a request to review github.com/eclipse-mosquitto/mosquitto and consider incorporating it into the content, linking it to the MQTT security vulnerability identified in the document 'Deep dive: coordinating drone swarms over a LoRa mesh network' and the ChirpStack system discussed in the same document. All content comes from additional research; this is an independent research document.
Download the applied formula exercise kit (CSV/JSON with answers) · synthetic data for calculation practice and unit checking