Описание
AMQP 1.0, AMQP 0-9-1, Stream Protocol loopback enforcement can lead to remote guest sessions due to listener-address loopback checks
Summary
RabbitMQ AMQP 0-9-1 authentication allows a loopback-restricted user to connect remotely when traffic is accepted through a trusted PROXY-protocol path and the backend listener is loopback-bound. The issue occurs because the loopback check is performed on the accepted socket and resolves loopback using the listener-side address (sockname) instead of the real client source. In the validated run, the connection was recorded with non-loopback peer_host from PROXY metadata while the authenticated user was guest and the connection state reached running. This behavior conflicts with documented loopback-user expectations and was classified as not intended in the intended-behavior stage. The executed PoC demonstrates the authentication boundary bypass for loopback-restricted login, which is the specific effect proven here.
Impact
A remote actor who can reach a trusted PROXY-protocol frontend and provide valid loopback-restricted credentials can obtain a live AMQP session as that user, and in deployments where guest keeps default admin privileges this can escalate to full broker control.
Description
The listener handshake path accepts PROXY headers and wraps the socket with proxy metadata. https://github.com/rabbitmq/rabbitmq-server/blob/83866edcc995602f546f3c4147078b3a610b0075/deps/rabbit/src/rabbit_networking.erl#L581-L593
The connection startup path immediately unwraps the socket for later auth checks and stores proxy metadata separately. https://github.com/rabbitmq/rabbitmq-server/blob/83866edcc995602f546f3c4147078b3a610b0075/deps/rabbit/src/rabbit_reader.erl#L288-L340
The authentication phase calls the loopback-user gate with that socket and transitions to tuning on success.
https://github.com/rabbitmq/rabbitmq-server/blob/83866edcc995602f546f3c4147078b3a610b0075/deps/rabbit/src/rabbit_reader.erl#L1507-L1524
The loopback-user gate allows login when rabbit_net:is_loopback(SockOrAddr) is true.
https://github.com/rabbitmq/rabbitmq-server/blob/83866edcc995602f546f3c4147078b3a610b0075/deps/rabbit/src/rabbit_access_control.erl#L275-L281
The socket loopback helper uses sockname(Sock), which evaluates the listener bind address instead of the remote peer.
https://github.com/rabbitmq/rabbitmq-server/blob/83866edcc995602f546f3c4147078b3a610b0075/deps/rabbit_common/src/rabbit_net.erl#L278-L288
Proof of Concept (PoC)
The finding was validated against the 83866edcc995602f546f3c4147078b3a610b0075 commit.
- Create
rabbitmq.confwith the exact content below.
- Create helper file
amqp_frames.pywith the exact content below.
- Create helper file
amqp_proxy_connect.pywith the exact content below.
PoC Steps
- Launch RabbitMQ with the provided
rabbitmq.confso AMQP listens on127.0.0.1:5674withproxy_protocol=true. - Set loopback users on the live node to include
guest:rabbitmqctl eval 'application:set_env(rabbit, loopback_users, [<<"guest">>]).'. - Verify runtime config values:
rabbitmqctl environment | egrep 'loopback_users|proxy_protocol|tcp_listeners'. - Run
python3 amqp_proxy_connect.pyand keep it alive for 20 seconds as written. - During that window, run
rabbitmqctl -n rabbit@rmq-proxy-poc list_connections name user peer_host peer_port state. - Confirm PoC stdout, connection listing, and process exit code.
PoC Results
Observed configuration evidence from the executed run:
Observed PoC client stdout:
Observed broker-side connection state during the same run:
Observed PoC exit code:
This shows a non-loopback source reached an authenticated running AMQP session as loopback-restricted guest under the tested proxy/listener configuration.
Пакеты
rabbitmq
>= 4.2.0, < 4.2.6
4.2.6
rabbitmq
>= 4.1.0, < 4.1.11
4.1.11
rabbitmq
>= 4.0.0, < 4.0.20
4.0.20
rabbitmq
>= 3.13.0, < 3.13.15
3.13.15
Связанные уязвимости
RabbitMQ is a messaging and streaming broker. Prior to 3.13.15, 4.0.20, 4.1.11, and 4.2.6, AMQP 0-9-1, AMQP 1.0, and Stream Protocol authentication can allow a loopback-restricted user such as guest to connect remotely when traffic is accepted through a trusted PROXY-protocol path and the backend listener is loopback-bound because the loopback check uses the listener-side socket address instead of the real client source. This issue is fixed in versions 3.13.15, 4.0.20, 4.1.11, and 4.2.6.
RabbitMQ is a messaging and streaming broker. Prior to 3.13.15, 4.0.20, 4.1.11, and 4.2.6, AMQP 0-9-1, AMQP 1.0, and Stream Protocol authentication can allow a loopback-restricted user such as guest to connect remotely when traffic is accepted through a trusted PROXY-protocol path and the backend listener is loopback-bound because the loopback check uses the listener-side socket address instead of the real client source. This issue is fixed in versions 3.13.15, 4.0.20, 4.1.11, and 4.2.6.
RabbitMQ is a messaging and streaming broker. Prior to 3.13.15, 4.0.20, 4.1.11, and 4.2.6, AMQP 0-9-1, AMQP 1.0, and Stream Protocol authentication can allow a loopback-restricted user such as guest to connect remotely when traffic is accepted through a trusted PROXY-protocol path and the backend listener is loopback-bound because the loopback check uses the listener-side socket address instead of the real client source. This issue is fixed in versions 3.13.15, 4.0.20, 4.1.11, and 4.2.6.
RabbitMQ: AMQP 1.0, AMQP 0-9-1, Stream Protocol loopback enforcement can lead to remote guest sessions due to listener-address loopback checks
RabbitMQ is a messaging and streaming broker. Prior to 3.13.15, 4.0.20 ...