Beyond the Usual Suspects
In the world of IoT, MQTT is the lingua franca, a lightweight and efficient protocol for devices to communicate. Because of its simplicity, security isn't built-in by default; it's layered on top. The
standard security playbook is clear and well-understood: wrap traffic in TLS to prevent eavesdropping, require every client to authenticate with a unique username/password or certificate, and harden the broker server itself. These practices are the foundation of a secure setup, designed to prevent unauthorized access and man-in-the-middle attacks. For many development teams, checking these boxes means the security work is done. However, this focus on external threats often causes them to overlook a vulnerability that comes from within the protocol's own design.
The Hidden Detail: Wildcard Abuse
The hidden detail most engineers skip is the insidious risk of poorly managed topic wildcards. Specifically, the multi-level wildcard, represented by the '#' symbol. In MQTT, wildcards are a feature of convenience, allowing a client to subscribe to multiple topics at once. A client subscribing to 'sensors/+/temperature' can get readings from all sensors, while a client subscribing to '#' can, if permitted, receive every single message published on the broker. This is where the danger lies. Many engineers, especially during development or for administrative clients, grant broad wildcard permissions without considering the full implications. The overlooked detail is that this convenience is a powerful weapon if a client with that subscription is ever compromised. Recent vulnerability reports have even highlighted how unblocked wildcards allow for unauthorized data access across systems.
What’s the Worst That Could Happen?
Imagine a low-privilege device, like a simple environmental sensor, gets compromised. If that sensor's client has been granted a subscription to '#', the attacker now has a god-mode listening device on your network. They don't need to hack the broker or break TLS encryption. They can passively subscribe and receive a firehose of every message traversing the system. This could include sensitive customer data, commands for industrial machinery, firmware update notifications, and even credentials for other services if they are being passed through MQTT messages. The attacker can map your entire IoT architecture, identify high-value targets, and steal confidential information, all from a single, seemingly insignificant compromised endpoint. This isn't a theoretical flaw; it's a practical exploit path rooted in a common configuration shortcut.
Taming Wildcards with Access Control
The solution is to move from a mindset of convenience to one of strict control by implementing the Principle of Least Privilege. This is enforced using Access Control Lists (ACLs) on the MQTT broker. An ACL is a set of rules that defines which clients are allowed to publish or subscribe to which specific topics. Instead of granting broad wildcard access, your security policy should be granular. A temperature sensor should only have permission to publish to its specific topic, like 'building/1/floor/2/temp', and nothing else. It should have no subscription rights at all. An application that controls lights should only be able to subscribe to relevant state topics and publish to light control topics. Critically, the '#' wildcard subscription should be forbidden for all but the most trusted, secured, and monitored administrative clients. By tightly scoping permissions, you ensure that even if a single device is compromised, the blast radius is minimal. The attacker gains access to a single topic, not the keys to the entire kingdom.






