MQTT 5.0: Receive Maximum zero disables delivery credit
Summary
Summary
RabbitMQ accepts the MQTT 5 Receive Maximum CONNECT property with value zero,
although MQTT 5 requires the server to treat zero as a malformed packet.
RabbitMQ converts the value directly into {simple_prefetch, 0}. For classic
queues, zero means unlimited prefetch, not zer...
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
RabbitMQ accepts the MQTT 5 Receive Maximum CONNECT property with value zero,
although MQTT 5 requires the server to treat zero as a malformed packet.
RabbitMQ converts the value directly into {simple_prefetch, 0}. For classic
queues, zero means unlimited prefetch, not zero delivery credit. An
authenticated subscriber can therefore advertise zero, subscribe at QoS 1,
read deliveries without sending PUBACK, and cause the broker's MQTT process and
queue acknowledgement state to grow without the configured MQTT prefetch bound.
A control connection advertising Receive Maximum = 1 receives exactly one
QoS 1 message until it acknowledges it.
Preconditions
rabbitmq_mqttor Web MQTT is enabled.- The attacker has valid credentials and permission to consume a topic.
- Messages are available to the subscription at QoS 1.
- The affected subscription uses a classic queue. Clean-start MQTT
subscriptions use classic queues in the verified configuration.
Root cause
1. CONNECT parsing accepts zero
%% deps/rabbitmq_mqtt/src/rabbit_mqtt_packet.erl:350-351
parse_prop(<<16#21, Val:16, Bin/binary>>, ?CONNECT = Type, Props) ->
parse_prop(Bin, Type, Props#{'Receive-Maximum' => Val});
No guard rejects Val = 0.
2. Zero becomes effective prefetch
%% deps/rabbitmq_mqtt/src/rabbit_mqtt_processor.erl:295-302
prefetch(Props) ->
ReceiveMax = maps:get('Receive-Maximum', Props, ?TWO_BYTE_INTEGER_MAX),
min(rabbit_mqtt_ut…
Source: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV
References
- GITHUB_REPO_ADVISORY rabbitmq/rabbitmq-server