Skip to content

(Web) MQTT with PROXY Protocol enabled: a loopback-only user permission bypass

Moderate
michaelklishin published GHSA-4r6f-9cpw-f6g6 Jul 23, 2026

Package

rabbitmq-server

Affected versions

>= 4.3.0, < 4.3.3
>= 4.2.0, < 4.2.9
>= 4.1.0, < 4.1.14
>= 4.0.0, < 4.0.23
>= 3.13.0, < 3.13.18

Patched versions

4.3.3
4.2.9
4.1.14
4.0.23
3.13.18

Description

Advisory Details

Title: (Web) MQTT PROXY Protocol path bypasses loopback-only user restriction

Description:

RabbitMQ (Web) MQTT loses the PROXY Protocol-derived client address before the MQTT authentication path checks loopback_users. A remote client with valid credentials for a loopback-restricted account can therefore authenticate through a trusted PROXY Protocol frontend because the backend evaluates the frontend's 127.0.0.1 address instead of the original client address.

Workarounds

One or multiple of:

Summary

When rabbitmq_web_mqtt runs behind a trusted TCP frontend with web_mqtt.proxy_protocol = true, Cowboy preserves the original client address in a rabbit_proxy_socket. rabbit_web_mqtt_handler uses that wrapper for connection logging, but unwraps it before invoking rabbit_mqtt_processor:init/4. The processor then derives PeerIp from the raw frontend-to-backend socket and passes 127.0.0.1 to the loopback-user check.

This bypasses the intended restriction for users such as the default guest account. The issue requires a reachable trusted frontend and valid credentials for a loopback-only account; it does not require modifying RabbitMQ configuration, directly reaching the loopback-bound backend, or forging a PROXY header.

Details

The Web MQTT handler receives a proxy-aware socket after Cowboy parses the PROXY header. The helper rabbit_net:socket_ends/2 explicitly returns src_address and src_port from that wrapper:

socket_ends({rabbit_proxy_socket, Sock, ProxyInfo}, Direction) ->
    ...
    #{src_address := FromAddress, src_port := FromPort, ...} ->
        {ok, {rdns(FromAddress), FromPort, ...}}

However, the first MQTT CONNECT is initialized with the raw socket:

rabbit_mqtt_processor:init(Packet, rabbit_net:unwrap_socket(Socket),
                           ConnName, fun send_reply/1)

unwrap_socket/1 discards the proxy metadata. rabbit_mqtt_processor:init/4 calls rabbit_net:socket_ends(Socket, inbound), then passes the resulting PeerIp into check_user_loopback/2. In a trusted-front-end deployment, that raw socket peer is the local frontend, typically 127.0.0.1.

The result is an authorization-context mismatch:

  1. Connection logging reports the real client address from the proxy-aware socket
  2. Loopback authorization evaluates the frontend address from the unwrapped socket
  3. A non-loopback client with valid guest credentials receives a successful MQTT CONNACK

The direct non-PROXY control confirms that the loopback check itself works: the same credentials and MQTT CONNECT from a non-loopback client receive 20 02 00 05 and the broker logs that guest can only connect via localhost.

PoC

Prerequisites

  • RabbitMQ Server version v4.3.2, or another affected version in the range below
  • Docker with host networking available for the isolated test environment
  • rabbitmq_mqtt and rabbitmq_web_mqtt enabled
  • A trusted TCP frontend that owns PROXY header generation
  • A Web MQTT backend configured with web_mqtt.proxy_protocol = true
  • A valid loopback-restricted account, such as the default guest / guest in a fresh isolated broker

Download these secret Gists into the same exploit directory, preserving the filenames:

File Secret Gist
Dockerfile Dockerfile
build_plugin.sh build_plugin.sh
start_isolated_broker.sh start_isolated_broker.sh
rabbitmq.conf rabbitmq.conf
rabbitmq-control.conf rabbitmq-control.conf
trusted_proxy.py trusted_proxy.py
web_mqtt_client.py web_mqtt_client.py
verification_test_CVE-2026-57216-web-mqtt.py verification client
control-direct-nonloopback.py control client

Reproduction Steps

  1. Check out RabbitMQ Server v4.3.2 and place the downloaded files in llm-enhance/cve-finding/Auth_Bypass/CVE-2026-57216-web-mqtt-exp/

  2. Start the isolated primary broker, trusted frontend, and direct control broker:

    sh llm-enhance/cve-finding/Auth_Bypass/CVE-2026-57216-web-mqtt-exp/start_isolated_broker.sh
  3. Identify a non-loopback host address and run the Web MQTT verification through the trusted frontend:

    HOST_IP=$(hostname -I | awk '{print $1}')
    docker run --rm --network bridge -v "$PWD:/workspace" -w /workspace \
      -e WEB_MQTT_HOST="$HOST_IP" -e WEB_MQTT_PORT=15686 \
      rabbitmq-cve-2026-57216-test \
      python3 llm-enhance/cve-finding/Auth_Bypass/CVE-2026-57216-web-mqtt-exp/verification_test_CVE-2026-57216-web-mqtt.py
  4. Run the same WebSocket MQTT CONNECT against the direct, non-PROXY control listener:

    docker run --rm --network bridge -v "$PWD:/workspace" -w /workspace \
      -e WEB_MQTT_HOST="$HOST_IP" -e WEB_MQTT_PORT=15687 \
      rabbitmq-cve-2026-57216-test \
      python3 llm-enhance/cve-finding/Auth_Bypass/CVE-2026-57216-web-mqtt-exp/control-direct-nonloopback.py
  5. The proxy path should incorrectly return a successful MQTT 3.1.1 CONNACK. The control should return the not-authorized CONNACK.

Log of Evidence

The verification run against the trusted frontend returned:

[End-to-End] loopback-restricted guest received MQTT CONNACK
through the PROXY-protocol WebSocket listener with payload=20020000

The frontend and primary broker independently recorded the non-loopback client:

FORWARDED_PROXY source=172.17.0.2:46374 destination=127.0.0.1:15685
Accepted Web MQTT connection 172.17.0.2:46374 -> 127.0.0.1:15685

The direct non-PROXY control returned and logged the protected behavior:

[End-to-End control] direct non-loopback guest login was denied
with opcode=2 payload=20020005
MQTT login failed: user 'guest' can only connect via localhost

Impact

This is an authorization bypass of the loopback-user restriction. A remote attacker who knows valid credentials for a loopback-restricted account can establish a (Web) MQTT session through an affected trusted-PROXY deployment.

The attacker receives the affected account's MQTT-accessible vhost and resource permissions. In a fresh default broker, guest has broad permissions on the default vhost, so the impact can include publishing forged messages, consuming accessible messages, and triggering downstream services that trust those message flows. This does not itself bypass passwords or grant access to separately exposed management HTTP endpoints; those interfaces retain their own listener and authorization checks.

Note that this affects MQTT and MQTT over WebSocket.

Affected products

  • Ecosystem: RabbitMQ Server / Erlang
  • Package name: rabbitmq-server
  • Affected versions: >= 3.13.0, <= 4.3.2
  • Patched versions:

Severity

  • Severity: Medium
  • Vector string: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L

Weaknesses

  • CWE: CWE-863: Incorrect Authorization

Occurrences

Permalink Description
rabbit_web_mqtt_handler.erl#L385-L386 The Web MQTT handler unwraps the proxy-aware socket before initializing MQTT CONNECT processing
rabbit_mqtt_processor.erl#L132-L134 The processor derives socket endpoints from the socket it receives
rabbit_mqtt_processor.erl#L205-L206 The derived PeerIp drives vhost authorization and the loopback-user check
rabbit_net.erl#L208-L221 Proxy-aware socket endpoints correctly use the PROXY header source and destination addresses
rabbit_net.erl#L292-L293 unwrap_socket/1 removes the proxy wrapper and exposes the raw frontend-to-backend socket

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v4 base metrics

Exploitability Metrics
Attack Vector Network
Attack Complexity High
Attack Requirements Present
Privileges Required Low
User interaction None
Vulnerable System Impact Metrics
Confidentiality High
Integrity None
Availability None
Subsequent System Impact Metrics
Confidentiality None
Integrity None
Availability None

CVSS v4 base metrics

Exploitability Metrics
Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity.
Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system.
Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system.
Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack.
User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner.
Vulnerable System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
Subsequent System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

CVE ID

No known CVE

Weaknesses

Incorrect Authorization

The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. Learn more on MITRE.

Credits