All vulnerabilities

RubyGems

CVE-2026-142594

Rack: `Rack::Multipart` extracts the boundary by substring match rather than parameter parsing, allowing parser differentials and WAF bypass

Severity
Low 3.7
Published
3 Dec 2026
Last changed
3 Dec 2026
Added to UpHeron
3 Dec 2026
Fixed in
2.2.26, 3.1.24, 3.2.9
Weakness
CWE-436
Attack
Over the network · Only under certain conditions · No login needed · No user action needed
Attacker can
Change some data
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N
Also known as
GHSA-r243-pfwh-7rpx
Sources
OSV.dev and GitHub

Description

Rack::Multipart::Parser.parse_boundary locates the multipart boundary by matching boundary= anywhere in the Content-Type header with a regular expression, rather than parsing the header's parameters. The matched value is also cut at the first ", ;, or , even inside a quoted-string, and surrounding whitespace is kept. Rack therefore derives a boundary from headers in which a conforming parser (RFC 9110 Section 8.3.1, as implemented by Go's mime.ParseMediaType, Python's email package, and WAF engines built on them) finds a different boundary or none at all. An attacker can choose such a header and lay out a body that an inspecting intermediary and Rack read as different sets of parts.

The boundary is extracted with:

This has three consequences:

  • boundary= inside another parameter's value is accepted as the boundary. multipart/form-data; name=" boundary=EVIL" and multipart/form-data; x=boundary=AaB03x both yield a boundary for Rack, while a conforming parser finds no boundary…
From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Workarounds

  • Update to a patched version of Rack, in which the boundary is taken only from a parameter named boundary using an RFC 9110 parameter parser, quoted-strings are honoured, and a request with more than one boundary parameter is rejected.
  • At the reverse proxy, reject multipart requests whose Content-Type does not contain exactly one well-formed boundary parameter, and reject boundary values containing , or ;.
Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
rackRubyGems · osv:RubyGems:rack
  • Every version before 2.2.26
  • From 3.0.0 before 3.1.24
  • From 3.2.0 before 3.2.9

About rack

Total downloads (RubyGems)
1,403,480,099RubyGems, 1 Dec 2026

References