Описание
Topic authorization can lead to cross-tenant routing-key bypass
Summary
RabbitMQ topic authorization allows restricted topic operations during metadata-store failures due to error collapsing in topic-permission lookup handling. The internal backend fetches topic permissions and treats undefined as allow, while the database helper returns undefined for any non-{ok, TopicPermission} Khepri response, including timeout/error paths. This turns transient Khepri lookup faults into authorization success for topic writes/binds that should remain denied. Executed validation reproduced this deterministically: denied before fault, allowed during Khepri timeout, denied again after recovery. Intended-behavior research also indicates this is not expected behavior because backend authorization contracts treat {error, Error} as an error path, not an implicit allow.
Impact
An authenticated low-privileged tenant can publish or bind to routing keys outside its configured topic regex during Khepri lookup failures, enabling unauthorized cross-tenant message routing in shared topic exchanges.
Description
The topic-permission read path first queries Khepri and collapses every non-{ok, TopicPermission} result to undefined.
After that lookup, the internal authorization backend treats undefined as success for topic access.
The backend authorization contract explicitly defines {error, Error} as an error condition, so converting store errors into undefined and then allowing access violates expected validation flow.
The issue is triggered when a user with restricted topic permissions performs topic operations while Khepri returns timeout/error results, because the lookup failure is normalized to undefined and interpreted as allow instead of deny/error.
Proof of Concept (PoC)
The finding was validated against the 83866edcc995602f546f3c4147078b3a610b0075 commit.
The PoC demonstrates that topic authorization is correctly enforced before a metadata fault, fails open during a forced Khepri timeout, and returns to denial after recovery. It uses one standalone helper file and standard broker APIs/CLI only. The full helper file used in execution is included below.
validation-environments/finding-674/poc_topic_fail_open.sh
PoC Steps
- Ensure a running RabbitMQ broker with management API on
127.0.0.1:15672and CLI access viarabbitmqctlinside the broker container. - Create directory
validation-environments/finding-674. - Create file
validation-environments/finding-674/poc_topic_fail_open.shwith the exact content shown above. - Run
chmod +x validation-environments/finding-674/poc_topic_fail_open.sh. - Run
bash validation-environments/finding-674/poc_topic_fail_open.sh. - Observe baseline publish denial for
secret.1, then forced Khepri timeout, then publish success during timeout, then denial again after resume.
PoC Results
Observed stdout/stderr from the executed run:
The results show a real fail-open authorization bypass limited to the Khepri lookup error window: policy-denied topic publish becomes accepted and routed, then returns to denied when metadata lookup recovers.
Пакеты
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.21
4.0.21
rabbitmq
>= 3.13.0, < 3.13.15
3.13.15
Связанные уязвимости
RabbitMQ is a messaging and streaming broker. Prior to 3.13.15, 4.0.21, 4.1.11, and 4.2.6, RabbitMQ topic authorization can allow restricted topic writes and binds during metadata-store failures because topic-permission lookup errors from Khepri can collapse to undefined, which the internal backend treats as allow. This issue is fixed in versions 3.13.15, 4.0.21, 4.1.11, and 4.2.6.
RabbitMQ is a messaging and streaming broker. Prior to 3.13.15, 4.0.21, 4.1.11, and 4.2.6, RabbitMQ topic authorization can allow restricted topic writes and binds during metadata-store failures because topic-permission lookup errors from Khepri can collapse to undefined, which the internal backend treats as allow. This issue is fixed in versions 3.13.15, 4.0.21, 4.1.11, and 4.2.6.
RabbitMQ is a messaging and streaming broker. Prior to 3.13.15, 4.0.21, 4.1.11, and 4.2.6, RabbitMQ topic authorization can allow restricted topic writes and binds during metadata-store failures because topic-permission lookup errors from Khepri can collapse to undefined, which the internal backend treats as allow. This issue is fixed in versions 3.13.15, 4.0.21, 4.1.11, and 4.2.6.
RabbitMQ: Topic authorization can lead to cross-tenant routing-key bypass
RabbitMQ is a messaging and streaming broker. Prior to 3.13.15, 4.0.21 ...