Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-5cmq-vp28-xqrj

Опубликовано: 18 июн. 2026
Источник: github
Github: Не прошло ревью
CVSS4: 7.1

Описание

RabbitMQ management HTTP API accepts request bodies larger than configured max_http_body_size

Overview

The rabbitmq_management HTTP API appears to enforce a request body size limit through max_http_body_size, but in practice it accepts oversized valid JSON bodies and processes them normally.

The root cause is that the helper responsible for reading the request body checks the accumulated size only before reading the final chunk and does not validate the final combined size after appending that chunk.

  • Vulnerability type: Request body size limit bypass
  • Affected component: rabbitmq_management
  • Verification date: 2026-03-11

Impact

Even when an operator configures a management HTTP API body size limit, endpoints that use the with_decode or direct_request paths do not enforce that limit completely.

As a result, an attacker can send JSON requests larger than the configured limit, and management operations that should have been blocked are still processed.

The exact impact depends on the endpoint, but at minimum the following problems exist:

  • Oversized body blocking policies can be bypassed
  • Operator expectations around management API input size control are broken
  • Additional resources may be consumed for body parsing, decoding, and management operations

Root Cause Summary

The issue follows this path:

  1. read_complete_body/3 checks the accumulated size only before calling cowboy_req:read_body/1
  2. After reading the final chunk and constructing Acc ++ Data, it returns without re-checking the total size
  3. Endpoints using with_decode and direct_request inherit this behavior

Relevant code locations:

Detailed Analysis

1. No size re-check after the final chunk

The vulnerable helper looks like this:

read_complete_body(Req0, Acc, BodySizeLimit) -> N = byte_size(Acc), case N > BodySizeLimit of true -> {error, http_body_limit_exceeded, BodySizeLimit, N}; false -> case cowboy_req:read_body(Req0) of {ok, Data, Req} -> {ok, <<Acc/binary, Data/binary>>, Req}; {more, Data, Req} -> read_complete_body(Req, <<Acc/binary, Data/binary>>) end end.

It only validates N = byte_size(Acc). If Acc is still under the limit before the final Data chunk is read, the final combined result <<Acc, Data>> can exceed the limit and still be returned as {ok, Body, Req}.

2. Rejection depends entirely on the helper return value

with_decode rejects a request only when the helper returns {error, http_body_limit_exceeded, ...}.

with_decode(Keys, ReqData, Context, Fun) -> case read_complete_body(ReqData) of {error, http_body_limit_exceeded, LimitApplied, BytesRead} -> bad_request("Exceeded HTTP request body size limit", ReqData, Context); {ok, Body, ReqData1} -> with_decode(Keys, Body, ReqData1, Context, Fun) end.

Because the helper can return oversized bodies as {ok, Body, Req}, limit-exceeding requests continue into JSON decoding and the endpoint-specific logic.

3. The impact extends beyond a single endpoint

The same helper is used not only by with_decode, but also by the direct_request path.

{ok, Body, ReqData1} = read_complete_body(ReqData),

This means the bug is not just an isolated endpoint mistake. It is a flaw in the shared management API body-reading logic.

Dynamic Reproduction Environment

The issue was reproduced locally under the following conditions:

  • A broker with rabbitmq_management enabled was running
  • A management API account was used
  • rabbitmq_management.max_http_body_size was temporarily reduced to 120 at runtime for deterministic testing
  • The reproduction used /api/exchanges/%2F/amq.default/publish

Reproduction Steps

1. Lower the body size limit

To make the behavior easy to observe, the runtime limit was reduced to 120.

docker exec rabbitmq-dev bash -lc "cd /work && ./sbin/rabbitmqctl eval 'application:set_env(rabbitmq_management, max_http_body_size, 120), io:format(\"~tp~n\", [application:get_env(rabbitmq_management, max_http_body_size)]).'"

Observed output:

{ok,120} ok

2. Send below-limit and above-limit requests

Valid JSON bodies of different sizes were sent to the same endpoint.

docker exec rabbitmq-dev bash -lc "python3 - <<'PY' import base64, json, urllib.request base_url = 'http://127.0.0.1:15672/api/exchanges/%2F/amq.default/publish' auth = 'Basic ' + base64.b64encode(b'guest:guest').decode() for n in [30, 40, 200]: body = json.dumps( { 'properties': {}, 'routing_key': 'fedlive.q', 'payload': 'A' * n, 'payload_encoding': 'string', }, separators=(',', ':'), ).encode() req = urllib.request.Request( base_url, data=body, method='POST', headers={ 'Authorization': auth, 'Content-Type': 'application/json', }, ) with urllib.request.urlopen(req, timeout=10) as resp: print(f'payload_chars={n} json_len={len(body)} status={resp.status} body={resp.read().decode()}') PY"

3. Compare expected and actual behavior

  • With payload_chars=30, the full JSON body length was 114 bytes, which is below the 120 byte limit
  • With payload_chars=40, the full JSON body length was 124 bytes, which exceeds the 120 byte limit
  • With payload_chars=200, the full JSON body length was 284 bytes, which significantly exceeds the 120 byte limit

In a correct implementation, the 124 and 284 byte requests should be rejected.

Reproduction Results

The actual responses were:

payload_chars=30 json_len=114 status=200 body={"routed":true} payload_chars=40 json_len=124 status=200 body={"routed":true} payload_chars=200 json_len=284 status=200 body={"routed":true}

Both requests larger than the configured limit were accepted with HTTP 200, and the publish operation was still performed.

This demonstrates that max_http_body_size can be bypassed in this code path.

Notes

After reproduction, the temporary setting was restored to the default value.

docker exec rabbitmq-dev bash -lc "cd /work && ./sbin/rabbitmqctl eval 'application:set_env(rabbitmq_management, max_http_body_size, 10000000), io:format(\"~tp~n\", [application:get_env(rabbitmq_management, max_http_body_size)]).'"

Observed output:

{ok,10000000} ok

Recommended Fix

The smallest fix is to re-check the total body size immediately after each chunk is read.

At minimum, the following conditions should be enforced:

  • Before returning {ok, Data, Req}, validate byte_size(Acc) + byte_size(Data)
  • Before recursing on {more, Data, Req}, reject as soon as the new accumulated size exceeds the limit

The following regression tests should also be added:

  • Verify that a valid JSON body larger than max_http_body_size is rejected on with_decode paths
  • Verify the same behavior on direct_request paths
  • Verify that multi-chunk bodies are blocked consistently whether or not Content-Length is present

Conclusion

The shared rabbitmq_management body reader does not fully enforce the HTTP request body size limit.

  • The accumulated size is not re-validated after the final chunk
  • Valid JSON bodies larger than the configured limit are accepted by a live endpoint
  • Because the issue exists in a shared helper, multiple management API endpoints may be affected

This is therefore a management HTTP API body size limit bypass.

Пакеты

Наименование

rabbitmq

vmware
Затронутые версииВерсия исправления

>= 4.2.0, < 4.2.5

4.2.5

Наименование

rabbitmq

vmware
Затронутые версииВерсия исправления

>= 4.1.0, < 4.1.10

4.1.10

Наименование

rabbitmq

vmware
Затронутые версииВерсия исправления

>= 4.0.0, < 4.0.19

4.0.19

Наименование

rabbitmq

vmware
Затронутые версииВерсия исправления

>= 3.13.0, < 3.13.14

3.13.14

EPSS

Процентиль: 36%
0.00433
Низкий

7.1 High

CVSS4

Дефекты

CWE-770

Связанные уязвимости

CVSS3: 7.7
ubuntu
24 дня назад

RabbitMQ is a messaging and streaming broker. Prior to 3.13.14, 4.0.19, 4.1.10, and 4.2.5, the rabbitmq_management HTTP API accepts oversized valid JSON bodies on with_decode and direct_request paths because read_complete_body checks the accumulated size before the final chunk but not the final combined size. This issue is fixed in versions 3.13.14, 4.0.19, 4.1.10, and 4.2.5.

CVSS3: 7.7
redhat
25 дней назад

RabbitMQ is a messaging and streaming broker. Prior to 3.13.14, 4.0.19, 4.1.10, and 4.2.5, the rabbitmq_management HTTP API accepts oversized valid JSON bodies on with_decode and direct_request paths because read_complete_body checks the accumulated size before the final chunk but not the final combined size. This issue is fixed in versions 3.13.14, 4.0.19, 4.1.10, and 4.2.5.

CVSS3: 7.7
nvd
24 дня назад

RabbitMQ is a messaging and streaming broker. Prior to 3.13.14, 4.0.19, 4.1.10, and 4.2.5, the rabbitmq_management HTTP API accepts oversized valid JSON bodies on with_decode and direct_request paths because read_complete_body checks the accumulated size before the final chunk but not the final combined size. This issue is fixed in versions 3.13.14, 4.0.19, 4.1.10, and 4.2.5.

CVSS3: 7.7
debian
24 дня назад

RabbitMQ is a messaging and streaming broker. Prior to 3.13.14, 4.0.19 ...

EPSS

Процентиль: 36%
0.00433
Низкий

7.1 High

CVSS4

Дефекты

CWE-770