Rack: `Rack::Multipart` extracts the boundary by substring match rather than parameter parsing, allowing parser differentials and WAF bypass
影響パッケージ
| パッケージ | 影響を受ける版 → 修正版 | |
|---|---|---|
| rackrack | — | 記載なし |
| rubygemsrack |
3.2.0 以上 3.2.9 未満→ 3.2.9 |
3.2.9 |
原文の説明 取得元が公開している説明をそのまま載せています (多くは英語)。
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:
boundary=inside another parameter's value is accepted as the boundary.multipart/form-data; name=" boundary=EVIL"andmultipart/form-data; x=boundary=AaB03xboth yield a boundary for Rack, while a conforming parser finds noboundaryparameter. The duplicate-boundary guard added for CVE-2026-125108 counts one occurrence and does not fire, and the token-character lookbehind does not help because a space or=is not a token character.- A quoted boundary is truncated at
,or;.multipart/form-data; boundary="AaB03x,1"yieldsAaB03xfor Rack andAaB03x,1for a conforming parser. Thi…
出典: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
参照URL
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com