CVE-2025-61772: Rack's multipart parser buffers unbounded per-part headers, enabling DoS (memory exhaustion)
Summary
Rack::Multipart::Parser can accumulate unbounded data when a multipart part’s header block never terminates with the required blank line (CRLFCRLF). The parser keeps appending incoming bytes to memory without a size cap, allowing a remote attacker to exhaust memory and cause a denial of service (DoS).
Details
While reading multipart headers, the parser waits for CRLFCRLF using:
ruby @sbuf.scanuntil(/(.?\r\n)\r\n/m)
If the terminator never appears, it continues appending data (@sbuf.concat(content)) indefinitely. There is no limit on accumulated header bytes, so a single malformed part can consume memory proportional to the request body size.
Impact
Attackers can send incomplete multipart headers to trigger high memory use, leading to process termination (OOM) or severe slowdown. The effect scales with request size limits and concurrency. All applications handling multipart uploads may be affected.
Mitigation
Upgrade to a patched Rack version that caps per-part header size (e.g., 64 KiB). Until then, restrict maximum request sizes at the proxy or web server layer (e.g., Nginx clientmaxbodysize).
Other sources
Rack is a modular Ruby web server interface. In versions prior to 2.2.19, 3.1.17, and 3.2.2, Rack::Multipart::Parser can accumulate unbounded data when a multipart part’s header block never terminates with the required blank line (CRLFCRLF). The parser keeps appending incoming bytes to memory without a size cap, allowing a remote attacker to exhaust memory and cause a denial of service (DoS). Attackers can send incomplete multipart headers to trigger high memory use, leading to process termination (OOM) or severe slowdown. The effect scales with request size limits and concurrency. All applications handling multipart uploads may be affected. Versions 2.2.19, 3.1.17, and 3.2.2 cap per-part header size (e.g., 64 KiB). As a workaround, restrict maximum request sizes at the proxy or web server layer (e.g., Nginx clientmaxbodysize).
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
rubygems/rackto a version that resolves this vulnerability.Fixed in 3.2.2 - Upgrade
Upgrade
rubygems/rackto a version that resolves this vulnerability.Fixed in 3.1.17 - Upgrade
Upgrade
rubygems/rackto a version that resolves this vulnerability.Fixed in 2.2.19 - Upgrade
Upgrade
Rack::Multipart::Parserto a version that resolves this vulnerability.Fixed in 2.2.19 - Upgrade
Upgrade
Rack::Multipart::Parserto a version that resolves this vulnerability.Fixed in 3.1.17 - Upgrade
Upgrade
Rack::Multipart::Parserto a version that resolves this vulnerability.Fixed in 3.2.2 - Configuration
As a workaround until the Rack upgrade is applied, restrict maximum request sizes at the proxy/web server layer; for Nginx, set `client_max_body_size` to limit multipart upload request sizes.
Nginx client_max_body_size = (set to a maximum appropriate for your application)
Event History
Frequently Asked Questions
What is the severity of CVE-2025-61772?
CVE-2025-61772 is classified as a high severity vulnerability due to its potential to cause unbounded data accumulation.
How do I fix CVE-2025-61772?
To fix CVE-2025-61772, update Rack to version 2.2.19, 3.1.17, or 3.2.2 or later.
What versions of Rack are affected by CVE-2025-61772?
CVE-2025-61772 affects Rack versions prior to 2.2.19, 3.1.17, and 3.2.2.
What is the impact of CVE-2025-61772 on applications using Rack?
The impact of CVE-2025-61772 can lead to excessive memory consumption and potential denial of service if the multipart part's header block does not terminate correctly.
Is CVE-2025-61772 a remote vulnerability?
CVE-2025-61772 can be exploited remotely if the application is accepting multipart requests from untrusted sources.