low

CVE-2026-142594

RubyGems · rack

Summary

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

Severity
low
CVSS
3.7
EPSS
0.6% (p49)
CWE
CWE-436
Also known as
GHSA-r243-pfwh-7rpx
Published
2026-12-03
Updated
2026-12-03

Advisory details

Summary

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.

Details

The boundary is extracted with:

MULTIPART = /\Amultipart\/.*?#{NOT_AFTER_TOKEN_CHAR}boundary(\s*)="?([^";,]+)"?/ni

This has three consequences:

Rack::MediaType.params(content_type)["boundary"] returns nil for the in-value shapes while parse_boundary returns a value, so Rack's own API is inconsistent with itself.

All supported versions, including 2.2, are affected.

Impact

Applications that accept multipart/form-data behind a web application firewall, reverse proxy, or other component that inspects multipart bodies with a conforming parser. The intermediary sees no multipart body, or a different set of parts, so form fields and file uploads reach the application without inspection. This was confirmed end to end against OWASP Coraza with the OWASP Core Rule Set: a rule that blocks an ordinary PHP file upload does not fire on the smuggled form, while the Rack application receives the file. No authentication, malformed HTTP, or large payload is required. Rack itself grants no capability beyond that of a well-formed request with the same body.

Mitigation

References

Related advisories

Is your project exposed to this? Stateward checks every dependency on every pull request and flags it only if your code actually reaches it.

Check my repo

Summarize with AI

ChatGPTClaudePerplexity

Sources: CISA KEV (public domain), OSV.dev & GitHub Advisory Database (CC-BY-4.0), FIRST EPSS, NVD/CWE (public domain). Served live from the Stateward advisory database.