Insights / Embedded & Firmware
MQTT Security: Why TLS to the Broker Is Not End-to-End Encryption
TLS protects the link to an MQTT broker, but the broker, a relaying phone and the cloud still read every message. How application-layer encryption closes that gap on small MCUs.

The short answer
MQTT security usually means TLS between each device and the broker, plus authentication and topic permissions. That protects the network path, but TLS ends at the broker: the broker, any phone or gateway that relays data, and the cloud behind them can all read the messages. To keep data private from them, encrypt at the application layer, end to end between the nodes that create and use the data. Frameworks such as the Microchip Connectivity Framework (MCF) do this with standard ECDH, HKDF and ECDSA in 20–30 kB of flash, over MQTT or any other link.
Key takeaways
- TLS, authentication and topic permissions are the baseline for any MQTT deployment, and they protect the path, not the content.
- TLS ends at the broker, so the broker, relaying phones and gateways, and the cloud can read every message.
- Application-layer end-to-end encryption keeps the data unreadable to everything between the two nodes that use it.
- MCF adds this layer in 20–30 kB of flash on 8- to 32-bit MCUs, over MQTT, Bluetooth, CAN and other links. Indeema implements it on devices and runs its cloud instances.
- Encryption helps with the CRA and sector standards, but compliance also needs secure boot, updates and vulnerability handling.
MQTT security best practices: the baseline
- MQTT
- MQTT is a lightweight publish-subscribe messaging protocol. Devices publish messages to topics on a central server called a broker, and the broker delivers each message to every client subscribed to that topic.
The MQTT standard leaves security to the deployment. In practice, a well-run system adds five controls, and every one of them belongs in a production device:
- TLS between each client and the broker, so nobody on the network path can read or change the traffic. Secure MQTT runs on port 8883, which is registered with IANA for MQTT over TLS. Port 1883 carries unencrypted MQTT and should stay closed to the internet.
- Client authentication with a certificate per device (mutual TLS), or at least a username and password. MQTT 5 also supports extended authentication, so the client and broker can run a challenge-response exchange.
- Authorisation rules on the broker that limit which topics each client may publish or subscribe to.
- Broker hardening: no anonymous access, closed admin ports, rate limits and logging.
- Monitoring: alerts on failed logins, on clients that subscribe to the # wildcard, and on sudden changes in message rates.
Broker vendors describe much the same baseline in their security guides, and it stops most attacks from outside. It does not change who can read the messages once they arrive.
Where the data is still exposed
TLS protects one link at a time. It ends at the broker, because the broker has to read the topic to route the message. The payload is decrypted there and encrypted again for the next link. The same happens on a phone or gateway that relays data from a device without an IP stack.

- Sensor deviceEncrypts the reading for the Bluetooth link to the phone.
- Phone appDecrypts the Bluetooth traffic, then opens a new TLS session to the broker. The app can read and change the data.
- MQTT brokerEnds TLS, reads the topic and the payload, and forwards the message.
- Cloud applicationStores the message, often in one central database.
- Clinician's PCReceives the data over a second TLS session from the cloud.
Every hop is encrypted, but the phone, the broker and the cloud each see the data in plain text.
| Point in the path | TLS on each link | Application-layer end-to-end encryption |
|---|---|---|
| Network between hops | Cannot read | Cannot read |
| Phone or gateway that relays data | Can read and change | Forwards encrypted bytes |
| MQTT broker | Can read | Routes encrypted bytes by topic |
| Cloud provider or integrator running the broker | Can read | Cannot read |
| Receiving application at the far end | Can read | Can read |
For many products this is acceptable. It stops being acceptable when the data is health data, when a customer contract says no third party may see production data, or when a compromised phone app must not be able to send commands to the device.
How application-layer end-to-end encryption closes the gap
- End-to-end encryption in IoT
- End-to-end encryption means a message is encrypted on the device that creates it and decrypted only on the node it is meant for. Every system in between carries bytes it cannot read.
The usual building blocks are standard elliptic-curve cryptography. Each node holds a certificate and a private key. Two nodes agree on a shared secret with ECDH, derive session keys from it with HKDF, and sign what they send with ECDSA, so the receiver knows who sent a message and that nobody changed it.
Because this layer sits above the transport, MQTT, Bluetooth, CAN or a serial line underneath carry it unchanged. The broker still sees the topic and routes the message. It just cannot open it.
How MCF does it
The Microchip Connectivity Framework (MCF) is one way to build this layer. It is a set of software libraries and tools that add an encrypted messaging layer at the application level. It only needs access to the input and output buffers of whatever driver or stack is already there, so the transport code stays as it is.
| Property | MCF |
|---|---|
| Cryptography | ECDSA, ECDH, HKDF |
| Hardware | 8-, 16- and 32-bit MCUs and MPUs |
| Links underneath | UART, SPI, CAN, 10BASE-T1S, Ethernet, Wi-Fi, 802.15.4, Bluetooth and others |
| Flash footprint | From 20 kB to 30 kB |
| Topologies | Point to point, star and mesh |
| Cloud link | A standard MQTT broker plus a small application that extends the network through the cloud |
| Keys and certificates | Held in a PKI the customer controls |
With MCF, the broker becomes part of the transport. A sensor and a clinician's PC, or a controller and a service laptop, keep one secure session between them while the bytes travel over Bluetooth, through a phone, through the broker and across the internet. For a fuller walk-through of clusters, gateways and node identity, see our MCF overview.

What it takes to run MCF in a product
At Indeema we implement MCF on devices and run its cloud instances (see MCF on our ecosystem page). The library is the smaller part of the work. Most of the effort goes into the parts around it:
- The cloud instance. We run it as a shared instance, a dedicated instance, or on-premise on the customer's own server. Services run in an isolated environment behind a firewall that limits inbound and outbound traffic.
- Scale. For large fleets the instance runs on Kubernetes, with a load balancer, automatic scale-down when demand drops, and metrics for monitoring.
- Firmware ports. Porting the library to the target MCU and connecting it to the existing Bluetooth, CAN or Wi-Fi stack.
- Key storage. Where the threat model asks for it, private keys go into a hardware security module or secure element instead of flash.
- Updates. Firmware updates delivered through the same secure channel.
Why device makers ask for it
Product teams rarely search for application-layer encryption. They come with a business problem, and encryption turns out to be part of the answer.
| Need | Typical buyer | What end-to-end encryption changes |
|---|---|---|
| Keep selling in the EU under new security rules | Any maker of connected devices for the EU market | Gives evidence for the confidentiality and integrity requirements on data in transit |
| Keep data away from the cloud provider or integrator | Medical, industrial and public-sector customers | The party running the broker carries data it cannot read |
| Avoid lock-in to one cloud IoT service | Teams built on one provider's IoT platform | A standard MQTT broker on any cloud or on-premise does the routing |
| Limit the damage of a breach | Anyone holding sensitive data from a fleet | A compromised broker or relay app does not expose message content |
| Add security to a product already in the field | Products on small MCUs and non-IP buses | A 20–30 kB library above existing drivers can often arrive as a firmware update |
| One security model for mixed links | Gateways, hubs and plants with Bluetooth, CAN and Wi-Fi side by side | One secure session across all links instead of a separate fix per bus |

Where regulation comes in
European rules now treat protection of data in transit as a basic requirement. The Cyber Resilience Act asks manufacturers to protect the confidentiality and integrity of data and commands. Its vulnerability reporting obligations apply from 11 September 2026, and the main requirements from 11 December 2027. Radio equipment already falls under the cybersecurity requirements of the Radio Equipment Directive, which apply from 1 August 2025.
Sector standards say the same in more detail: ETSI EN 303 645 for consumer IoT, and IEC 62443-4-2 for components of industrial control systems. End-to-end encryption helps meet the parts of these rules that concern communication. It does not make a product compliant on its own, because the same rules also cover secure boot, updates, default settings and how the maker handles vulnerabilities. Our Cyber Resilience Act guide covers the rest.
When TLS is enough and when it is not
TLS to a well-configured broker is enough when you run the broker yourself, trust everyone who operates it, and devices talk to the cloud directly. Consider an application-layer framework such as MCF if one of these is true:
Signs you need end-to-end encryption
- A third party runs the broker or the cloud, and must not see the data
- Data passes through a phone, gateway or hub you do not fully control
- Devices talk over Bluetooth, CAN or serial links, not only IP
- A customer contract or regulator asks who can access production data
- You want to change cloud provider later without redesigning device security
Engineering trade-offs
TLS to the broker only
- You gain
- Simple, supported by every broker and MQTT library.
- You pay
- The broker operator, relaying apps and the cloud can read all data.
- Choose it when
- You run the broker and every hop yourself and the data is not sensitive.
Application-layer end-to-end encryption
- You gain
- Data stays private across brokers, phones, gateways and clouds.
- You pay
- You own a PKI, certificate provisioning and key rotation, and debugging encrypted traffic takes more tooling.
- Choose it when
- Third parties carry the data, or links other than IP are involved.
Encrypt payloads ad hoc in application code
- You gain
- No new dependency.
- You pay
- Teams tend to reinvent key exchange, replay protection and identity, and get one of them wrong.
- Choose it when
- Rarely. Prefer a reviewed framework or library.
Common mistakes
Calling TLS to the broker end-to-end encryption
Security reviews and customers assume the operator cannot read data when it can.
Instead: Describe exactly where TLS ends, and add application-layer encryption where the data must stay private.
Leaving meaning in topic names
Encrypted payloads still reveal patient, site or device details through the topic tree.
Instead: Use opaque topic identifiers and keep the mapping inside the encrypted layer.
Storing device private keys in plain flash
A device pulled from the field gives up its identity and the ability to impersonate it.
Instead: Use a secure element or the MCU's protected storage, and plan certificate revocation.
Questions engineers ask
Is MQTT secure?
MQTT has no encryption of its own. It becomes secure when you add TLS, client authentication and topic permissions. Even then, the broker can read every message, so sensitive data also needs application-layer encryption.
What port does secure MQTT use?
Port 8883 is registered with IANA for MQTT over TLS. Port 1883 is for unencrypted MQTT and should not be open to the internet.
Does MQTT over TLS give end-to-end encryption?
No. TLS protects each connection between a client and the broker. The broker decrypts the message to route it, so the content is readable on the broker and on anything that processes it after that.
How much memory does end-to-end encryption need on a microcontroller?
It depends on the library and the crypto hardware. The Microchip Connectivity Framework, for example, needs 20 to 30 kB of flash and runs on 8-, 16- and 32-bit MCUs.
What are the main security weaknesses of MQTT?
The protocol leaves encryption and access control to the deployment, so a broker with anonymous access or an open port 1883 is easy to abuse. Topic names can also leak information. In a well-secured system the remaining gap is that the broker and any relaying app can read every message.
Who implements the Microchip Connectivity Framework?
MCF is a Microchip technology. Indeema implements it on devices, from firmware ports to key storage in a secure element, and runs MCF cloud instances as shared, dedicated or on-premise deployments.
Was this useful?
Where this shows up in our work
ExpertiseEmbedded and firmware engineeringNeed end-to-end encryption on a device that already ships, or on a new design?Apply this to your product
Review your device security approach
Sources
- MQTT Version 5.0, OASIS Standard accessed 30 November 2026
- Indeema MCF: Secure IoT Communication accessed 30 November 2026
- European Commission: Cyber Resilience Act accessed 30 November 2026
- ETSI EN 303 645: Cyber Security for Consumer Internet of Things accessed 30 November 2026
- IEC 62443-4-2:2019, Technical security requirements for IACS components accessed 30 November 2026
- Commission Delegated Regulation (EU) 2022/30 (Radio Equipment Directive, cybersecurity) accessed 30 November 2026