Summary
NATS Server contained an authorization flaw where access control lists (ACLs) on message subjects were not enforced for subjects in the $MQTT.> namespace.
This gap allowed MQTT clients to bypass configured ACL checks for MQTT subjects, potentially publishing or subscribing to messages they were intended to be denied from accessing in environments relying on subject-based ACLs.
Affected context
The vulnerability appears in NATS Server deployments that:
- Use subject-based ACLs for access control, and
- Enable and accept MQTT client connections, and
- Rely on subject ACLs to protect sensitive MQTT message subjects.
It specifically affects message subjects under the $MQTT.> namespace, where ACL rules that apply elsewhere in the system are not consistently enforced for MQTT clients.
Exploit preconditions
- Attack surface: NATS Server's MQTT interface and subject routing logic.
- Required access: Ability to connect as an MQTT client to the affected NATS Server (with any level of valid credentials or in deployments allowing unauthenticated MQTT access).
- Trigger point: Publishing or subscribing to MQTT subjects that map into the
$MQTT.>namespace where ACLs should be applied but are not. - Why exploitation is possible: The authorization layer fails to evaluate or enforce configured ACL rules on the
$MQTT.>subject hierarchy, creating a discrepancy between expected and actual access control behavior.
Why this happens
This issue stems from inconsistent authorization enforcement in the subject routing and ACL evaluation logic for MQTT-derived subjects.
While ACLs are defined to restrict access to message subjects, the $MQTT.> namespace was effectively treated as an exception path where these checks were not applied or were bypassed.
Conceptually, this maps to CWE-863: Incorrect Authorization, where logic that should enforce permissions on a resource (here, MQTT subjects mapped into $MQTT.>) is incomplete or missing, allowing users to perform operations beyond their intended authorization.
Potential impact
- MQTT clients may publish messages to subjects they should not be allowed to write to.
- MQTT clients may subscribe to subjects and receive messages that should be restricted, leading to data exposure.
- Security assumptions based on subject ACLs can be invalidated, undermining multi-tenant isolation or internal segmentation.
- Misuse of unauthorized messaging channels could facilitate abuse workflows, such as spoofed events or unauthorized control messages within message-driven systems.
General mitigation guidance
Mitigations generally focus on tightening and validating authorization boundaries between protocol frontends and internal subject namespaces:
- Ensure that all protocol entry points (including MQTT) consistently pass through the same ACL evaluation pipeline and that there are no special namespaces exempt from checks.
- Favor secure-by-default configurations where newly introduced subject hierarchies or protocol mappings inherit existing ACL policies rather than requiring separate, opt-in rules.
- Minimize implicit trust in protocol-specific namespaces by designing ACLs and routing rules that treat them as first-class resources subject to explicit authorization.
- Apply the principle of least privilege to client credentials, limiting the subjects that MQTT clients can reach and avoiding overly broad wildcard permissions.
- Implement configuration review practices that consider cross-protocol behavior (NATS native, MQTT, WebSockets, etc.) to prevent gaps in effective access control.
How teams detect issues like this
Detection typically involves validating that subject ACLs behave consistently across all protocol entry points:
- Configuration analysis: Review NATS account and permission configurations to identify assumptions that all subject hierarchies are equally protected, especially around
$MQTT.>and other special namespaces. - Authorization testing: Use integration tests or security tests to verify that MQTT clients cannot publish/subscribe to subjects that are denied to equivalent NATS-native clients, watching for discrepancies.
- Logging and monitoring: Enable detailed authorization and access logs for subject operations, and alert on MQTT clients accessing subjects that appear outside their intended ACL scope.
- Code and policy review: In custom deployments or forks, inspect protocol gateway implementations to ensure subject mappings and ACL enforcement paths are unified, and use security linters or policy-as-code tools to validate authorization rules.

