MQTT
MQTT is the publish/subscribe protocol behind most IoT fleets, standardised by OASIS and as ISO/IEC 20922. How it works and the broker mistakes we find in IoT pentests.
Updated This page as Markdown
In short
MQTT is a lightweight publish/subscribe messaging protocol for devices with little bandwidth or power. Clients connect to a broker, publish messages to hierarchical topics and subscribe to topics with wildcards. It is an OASIS standard (versions 3.1.1 and 5.0) and ISO/IEC 20922. The specification leaves authentication, authorisation and encryption to the implementation, so MQTT security is broker configuration: TLS, per-device credentials and topic access control lists.
What is MQTT?
MQTT is a lightweight publish/subscribe messaging protocol designed for devices with constrained bandwidth, power and processing. Clients do not talk to each other; they connect to a broker, publish messages to topics and subscribe to topics. Topics are hierarchical strings such as plant/line3/robot7/temperature, and subscriptions can use wildcards: + for one level, # for everything below. Three quality-of-service levels (0, 1, 2) control delivery guarantees. Retained messages keep the last value of a topic for new subscribers, and a Last Will message is published by the broker when a client disconnects unexpectedly.
The protocol runs over TCP, conventionally on port 1883 for plain connections and 8883 for TLS, and over WebSockets for browsers. It is the dominant protocol in IoT fleets, smart home products, vehicle backends and Industry 4.0 data pipelines, including OPC UA PubSub over MQTT and Sparkplug B.
Where is it defined?
MQTT is standardised by OASIS. Version 3.1.1 (2014) is also published as ISO/IEC 20922:2016; version 5.0 (2019) adds reason codes, message properties, message expiry, shared subscriptions, server-side limits and enhanced authentication through the AUTH packet. The security chapter of both specifications is explicitly non-normative: it recommends TLS, authentication of clients and servers, authorisation of access to topics and protection of the broker, but mandates none of it. Security therefore comes from the broker configuration and the client implementation, not from the protocol.
For device manufacturers the Cyber Resilience Act applies: Annex I requires protection of data in transit and at rest, access control and protection against unauthorised access, which for an MQTT-connected product means TLS, per-device authentication and authorisation on the broker.
What it means in practice
We have tested MQTT brokers, the devices that connect to them and the cloud backends behind them in a range of IoT penetration tests. The findings repeat:
- Anonymous access. The broker accepts connections without credentials, usually a leftover from development.
- No TLS, or TLS without validation. Plain 1883 to the internet, or a device firmware that accepts any server certificate, which makes interception of credentials and commands trivial.
- One credential for the fleet. A username and password or a client certificate baked into the firmware of every unit. Firmware extraction from one device yields access to all.
- No topic authorisation. Every authenticated client may subscribe to
#and publish anywhere. Data of all customers and commands to all devices become readable and writable, the MQTT equivalent of an IDOR. - Identity not bound to topics. The device publishes under
devices/<serial>/..., and the broker never checks that the authenticated client is that serial number. - Retained messages and wills leaking state. Credentials, Wi-Fi passwords or location data in retained payloads that any subscriber receives on connect.
- Exposed management. Broker dashboards, WebSocket listeners and metrics endpoints reachable from the internet with default credentials.
The fixes are standard: TLS everywhere with certificate validation and ideally pinning on the device, per-device credentials or client certificates with a revocation path, access control lists that bind each identity to its own topic prefix, rate limits and payload size limits, and a broker that is not reachable beyond what the architecture needs. Zyberum tests MQTT deployments end to end: broker, devices (including firmware analysis), mobile apps and cloud APIs.
Common misunderstandings
TLS is not authorisation; an encrypted connection to a broker without ACLs still shows everything to everyone. A managed broker in the cloud is not secure by itself; the ACLs and identities are still yours to configure. And MQTT is not an industrial-only or consumer-only protocol; the same mistakes appear in both.
FAQ
Frequently asked questions
Is MQTT encrypted?
Not by itself. MQTT runs over TCP, by default on port 1883 in plain text. Encryption comes from TLS, conventionally on port 8883, and only if the broker enforces it and the device validates the broker certificate. Firmware that disables certificate validation to make a connection work is one of the most common findings in our IoT tests.
What is the most common MQTT security mistake?
Missing authorisation. Brokers are configured with authentication but without topic access control lists, so every authenticated device can subscribe to the wildcard topic # and read the data of every other device, or publish commands to other devices. One extracted set of credentials from one device then opens the whole fleet.
Does MQTT 5.0 make the protocol secure?
It adds useful tools, in particular enhanced authentication through the AUTH packet, which allows challenge-response schemes such as SCRAM, plus reason codes and server-side limits. The security chapter remains non-normative. A 5.0 broker with anonymous access is as open as a 3.1.1 broker with anonymous access.
Sources
Related pages
- GlossaryOPC UAOPC UA (IEC 62541) is the platform-independent industrial communication standard with built-in security. Security policies, certificates and the misconfigurations we see.
- InsightsMQTT Security Checklist for Connected ProductsA practical MQTT security checklist for IoT makers: authentication, TLS, topic authorisation, per-device credentials and broker hardening, with the mistakes we find most.
- InsightsIoT Penetration Testing: What We Attack and What We FindWhat an IoT pentest covers, from debug ports and firmware to radio, apps and cloud, which findings come up most often, and how to prepare your device for testing.
- For your industryCybersecurity for IoT Device Makers: RED EN 18031, CRA and Device TestsWhat IoT device makers must do: RED with EN 18031 since August 2025, the Cyber Resilience Act from 2026, the device attack surface, typical findings and a first project.
- GlossaryIDOR / BOLAIDOR (Insecure Direct Object Reference) and BOLA (Broken Object Level Authorization) are one flaw: an API returns objects without checking who asked. Find and fix it.
- ServicesConnected products that stay secure for their whole lifetime.IoT penetration testing, firmware analysis and secure development for connected devices. Get your products ready for the EU Cyber Resilience Act.
