Skip to content

Chunked response decoder buffers an entire chunk in memory before emitting it

High
whatyouhide published GHSA-c59h-fq4p-r36r Jul 6, 2026

Package

erlang mint (Erlang)

Affected versions

>= 0.5.0

Patched versions

>= 1.9.1

Description

Summary

Mint (Mint.HTTP1) contains an unbounded-memory denial of service in its chunked transfer-encoding decoder. When decoding a chunked response body, Mint buffers every partial fragment of the current chunk in memory and does not release it to the caller until the full declared chunk length has arrived. The chunk size is read straight from the server and parsed with no upper bound, so a malicious or compromised server can announce one enormous chunk and then dribble bytes without ever completing it, forcing the client to accumulate the whole (never-finished) chunk in memory. Any unauthenticated remote server that a Mint client can be steered to reach (via a redirect, SSRF, or webhook fetch) can trigger it.

Details

The bug lives in Mint.HTTP1's chunked-body decoder in lib/mint/http1.ex, primarily decode_body/5 and its helper add_body_to_buffer/2.

1. Unbounded chunk-size parsing. The chunk size line is parsed with Integer.parse(data, 16) with no maximum. A server can declare a chunk of arbitrary size, e.g. a size line of 7FFFFFFF (~2 GiB).

2. Buffer-until-complete decoding. For a chunk of declared size, the decoder computes new_size = size - byte_size(data) and, while the chunk is not yet complete (new_size > 0), appends every received fragment to request.data_buffer via add_body_to_buffer/2 (an unbounded iolist). Data is only emitted to the caller once the full declared length has been received, when add_body/3 collapses and flushes the accumulated buffer. Because the chunk never completes, the buffer grows without bound and no {:data, ...} responses are ever produced.

3. Streaming contract bypass. This is worse than a plain large-body issue. The content-length path emits each received packet immediately via add_body/3, so a caller that safely streams large content-length bodies still gets forced to buffer the entire chunk in the chunked case. The caller cannot observe or bound the growth because no data responses are emitted at all until the chunk finishes.

The same "no size limit on server-controlled data" root cause also affects the unbounded header count in decode_headers/5 and the unbounded chunk-size line buffer, but the chunked-body path is the most concrete because it bypasses streaming entirely.

PoC

  1. Stand up an attacker-controlled TCP server that accepts a Mint connection and replies with HTTP/1.1 200 OK, Transfer-Encoding: chunked, then a chunk size line of 7FFFFFFF\r\n (~2 GiB).
  2. Dribble body bytes (e.g. 64 KiB packets) continuously without ever sending the chunk terminator, and hold the connection open.
  3. Point a normal Mint client at the server (Mint.HTTP.connect + Mint.HTTP.request) and drain the socket via Mint.HTTP.recv.
  4. Observe that zero {:data, ...} responses are emitted to the caller while process memory grows in lockstep with the dribbled bytes (measured ~506 MiB buffered for 500 MiB dribbled), climbing until out-of-memory.

Impact

A remote attacker who controls or has compromised a server that a Mint client connects to can drive the client's memory arbitrarily high and trigger an out-of-memory condition, crashing the application. No client-side authentication is required, and applications that follow redirects, fetch user-supplied URLs (SSRF), or process webhooks are the most exposed; callers that otherwise stream large bodies safely gain no protection.

References

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v4 base metrics

Exploitability Metrics
Attack Vector Network
Attack Complexity Low
Attack Requirements None
Privileges Required None
User interaction None
Vulnerable System Impact Metrics
Confidentiality None
Integrity None
Availability High
Subsequent System Impact Metrics
Confidentiality None
Integrity None
Availability None

CVSS v4 base metrics

Exploitability Metrics
Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity.
Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system.
Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system.
Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack.
User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner.
Vulnerable System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
Subsequent System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

CVE ID

CVE-2026-56810

Weaknesses

Allocation of Resources Without Limits or Throttling

The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. Learn more on MITRE.

Credits