/

CVE-2026-44838

Severity:

HIGH RISK

(8.1)

Authorization Bypass via Unescaped Regex Variable Substitution (CWE-863) in RabbitMQ MQTT Plugin

CVE-2026-44838

Analyzed

Vulnerability type

Category:

Authorization Bypass

CWE:

CWE-863

Impact:

Privilege Escalation / Unauthorized Access to Messaging Topics

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

RabbitMQ's MQTT plugin supports topic-level authorization using regular expressions that interpolate user-controlled values such as client_id.

Because these values are inserted into regex patterns without escaping special characters, an authenticated MQTT client can inject regex operators to bypass topic access restrictions.

Affected context

This vulnerability affects RabbitMQ deployments that:

  • Enable and rely on the MQTT plugin for client communication
  • Use topic-level authorization rules expressed as regular expressions
  • Include user-controlled variables like {client_id} in regex patterns

The risk is present when access control policies assume that interpolated values are literal strings, but the underlying implementation treats them as part of a regex, allowing special characters to alter the pattern.

Exploit preconditions

  • Attack surface: MQTT interface exposed by RabbitMQ (network-accessible MQTT port).
  • Required access: Valid MQTT credentials (authenticated user) and the ability to choose or influence the client_id in the CONNECT packet.
  • Trigger point: Authorization checks that construct regex patterns using unescaped {client_id} (or similar variables) when matching publish/subscribe topics.
  • Why exploitation is possible: The implementation interpolates the raw client_id directly into the regex pattern without escaping regex metacharacters. An attacker can embed regex operators in the client_id, causing the resulting pattern to match topics beyond the intended scope and bypass policy constraints.

Why this happens

The core issue is improper authorization logic stemming from unsafe use of regular expressions in access control rules.

Instead of treating user-controlled values (e.g., client_id) as literal strings, the system interpolates them directly into regex patterns. Regex engines interpret characters like . * ? + | and grouping constructs as operators, so a crafted client_id can expand or alter the match space significantly.

This maps to CWE-863: Incorrect Authorization because the authorization mechanism is logically flawed: it assumes that the pattern constraints accurately represent the intended permissions, but the unescaped interpolation allows a malicious client to redefine the effective rules at runtime.

Abstractly, this is an insecure pattern where policy logic is coupled to a powerful pattern-matching language without robust escaping or canonicalization of untrusted inputs used inside those patterns.

Potential impact

  • MQTT clients may access topics they are not intended to publish to or subscribe from.
  • Unauthorized reading of sensitive telemetry, event streams, or inter-service messages.
  • Injection of forged messages into protected topics, potentially leading to data tampering or business logic abuse in downstream consumers.
  • Lateral movement between logical tenants or customers within a multi-tenant RabbitMQ deployment.
  • Violation of segregation-of-duties or per-device isolation guarantees, impacting compliance and auditability.

General mitigation guidance

Effective mitigation focuses on hardening authorization expressions and decoupling them from untrusted regex input:

  • Treat user-controlled identifiers (such as client_id) as literal values when used in access control patterns by applying strict escaping before interpolation into any regular expression.
  • Prefer exact string comparisons or prefix checks for topic authorization where possible instead of full regexes, reducing the complexity and attack surface of policy evaluation.
  • Introduce a layer that normalizes and validates identifiers (length limits, allowed character sets) before they are used in authorization rules; restricting client_id to a safe character set can greatly reduce misuse.
  • Design authorization policies to be deny-by-default, granting only the minimum set of topics needed, so that any pattern expansion has limited blast radius.
  • Consider separating policy configuration from user-controlled naming schemes, e.g., mapping client IDs to internal identifiers that are used in access control rules.

How teams detect issues like this

Organizations can detect and monitor for this class of issue via:

  • Configuration review: Examine MQTT authorization rules for regex-based policies that interpolate variables like {client_id}, {username}, or other untrusted values without explicit escaping or normalization.
  • Code analysis: Use static analysis or manual review to find authorization paths where regex construction includes user input, especially where pattern strings are built via concatenation or templating.
  • Security testing: Perform targeted tests with client_id values containing regex metacharacters to confirm whether topic access expands unexpectedly compared to the policy intent.
  • Logging and monitoring: Enable detailed authorization logs for MQTT operations; alert on anomalous topic access patterns (e.g., a single client accessing many tenants' topics or unexpected topic namespaces).
  • Policy enforcement in CI/CD: Integrate linters or custom policy checks into deployment pipelines to flag new or modified regex-based access-control rules that embed user-controlled variables.

Sources

SourceLink
github.comgithub.com/rabbitmq/rabbitmq-server/security/advisories/GHSA-x866-xp2g-cx8v

Frequently asked

questions

Yes. Any remote client that can reach the MQTT interface and authenticate can potentially exploit the issue by choosing a crafted client_id, assuming the deployment uses regex-based topic authorization with variable substitution.

No. Only valid MQTT credentials are required; the attacker does not need administrative rights. However, the impact depends on how broadly the regex-based policies are used to segregate access between clients or tenants.

The safest pattern is to stop feeding untrusted data directly into regex-based authorization rules. Either escape all user-controlled values before interpolation so they are treated as literals, or replace regex-based topic authorization with simpler, exact-match or prefix-based checks that do not interpret those values as patterns.

When designing access control or security policies, avoid coupling them directly to powerful pattern languages that consume untrusted input. Enforce strict input validation and canonicalization, treat user-controlled values as opaque identifiers, and have security reviews specifically focus on any place where user data influences authorization rules or filters (including regexes, SQL WHERE clauses, or routing expressions).

Find out what's already
exploitable in your codebase.