RabbitMQ consistent-hash exchange: empty array crashes DLX queue processes
Summary
Summary
An x-consistent-hash exchange configured with hash-header accepts an AMQP
field-array as the selected hash value. RabbitMQ preserves an empty AMQP array
as the Erlang empty list [].
When the exchange has at least two buckets, its routing function treats lists
by hashing the...
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| otherrabbitmq-server |
>= 4.2.0, < 4.2.10→ 4.2.10 |
4.2.10 |
| otherrabbitmq-server |
>= 4.3.0, < 4.3.5→ 4.3.5 |
4.3.5 |
Original description The description as published by the source.
Summary
An x-consistent-hash exchange configured with hash-header accepts an AMQP
field-array as the selected hash value. RabbitMQ preserves an empty AMQP array
as the Erlang empty list [].
When the exchange has at least two buckets, its routing function treats lists
by hashing their first element and calls hd([]), raising badarg.
A direct publish closes the publisher's channel. More importantly, if a
classic queue dead-letters an attacker-controlled message through the exchange,
the routing exception occurs inside the victim queue process. A persistent
poison message is retried when the queue restarts, repeatedly crashing the
queue until its supervisor exhausts restart attempts. The attacker publication
is confirmed and the attacker's channel survives because the exception occurs
later in the victim's DLX path.
Preconditions
rabbitmq_consistent_hash_exchangeis enabled.- An
x-consistent-hashexchange useshash-header = h. - At least two queues or bucket weights are bound to that exchange.
- A classic queue is configured to dead-letter to the hash exchange.
- The attacker can publish to an upstream exchange that routes into the classic
queue.
The attacker does not need configure or read permission when the topology
already exists. The attached PoC uses one account to create the disposable test
topology for convenience.
Root cause
1. Empty AMQP arrays remain empty lists
The AMQP parser and message-container conversion preserve an empt…
Source: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV
References
- GITHUB_REPO_ADVISORY rabbitmq/rabbitmq-server