Skip to content

Commit 8251f08

Browse files
flavorjonesRubySec CI
authored andcommitted
Updated advisory posts against rubysec/ruby-advisory-db@b694a68
1 parent a048f9d commit 8251f08

10 files changed

Lines changed: 977 additions & 0 deletions
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
layout: advisory
3+
title: 'CVE-2026-26961 (rack): Rack''s greedy multipart boundary parsing can cause
4+
parser differentials and WAF bypass.'
5+
comments: false
6+
categories:
7+
- rack
8+
advisory:
9+
gem: rack
10+
cve: 2026-26961
11+
ghsa: vgpv-f759-9wx3
12+
url: https://github.com/rack/rack/security/advisories/GHSA-vgpv-f759-9wx3
13+
title: Rack's greedy multipart boundary parsing can cause parser differentials and
14+
WAF bypass.
15+
date: 2026-04-02
16+
description: |-
17+
## Summary
18+
19+
`Rack::Multipart::Parser` extracts the `boundary` parameter from
20+
`multipart/form-data` using a greedy regular expression. When a
21+
`Content-Type` header contains multiple `boundary` parameters,
22+
Rack selects the last one rather than the first.
23+
24+
In deployments where an upstream proxy, WAF, or intermediary
25+
interprets the first `boundary` parameter, this mismatch can
26+
allow an attacker to smuggle multipart content past upstream
27+
inspection and have Rack parse a different body structure than
28+
the intermediary validated.
29+
30+
## Details
31+
32+
Rack identifies the multipart boundary using logic equivalent to:
33+
34+
```ruby
35+
MULTIPART = %r|\Amultipart/.*boundary=\"?([^\";,]+)\"?|ni
36+
```
37+
38+
Because the expression is greedy, it matches the last `boundary=`
39+
parameter in a header such as:
40+
41+
```http
42+
Content-Type: multipart/form-data; boundary=safe; boundary=malicious
43+
```
44+
45+
As a result, Rack parses the request body using `malicious`, while
46+
another component may interpret the same header using `safe`.
47+
48+
This creates an interpretation conflict. If an upstream WAF or proxy
49+
inspects multipart parts using the first boundary and Rack later
50+
parses the body using the last boundary, a client may be able to
51+
place malicious form fields or uploaded content in parts that Rack
52+
accepts but the upstream component did not inspect as intended.
53+
54+
This issue is most relevant in layered deployments where security
55+
decisions are made before the request reaches Rack.
56+
57+
## Impact
58+
59+
Applications that accept `multipart/form-data` uploads behind an
60+
inspecting proxy or WAF may be affected.
61+
62+
In such deployments, an attacker may be able to bypass upstream
63+
filtering of uploaded files or form fields by sending a request
64+
with multiple `boundary` parameters and relying on the intermediary
65+
and Rack to parse the request differently.
66+
67+
The practical impact depends on deployment architecture. If no
68+
upstream component relies on a different multipart interpretation,
69+
this behavior may not provide meaningful additional attacker capability.
70+
71+
## Mitigation
72+
73+
* Update to a patched version of Rack that rejects ambiguous multipart
74+
`Content-Type` headers or parses duplicate `boundary` parameters
75+
consistently.
76+
* Reject requests containing multiple `boundary` parameters.
77+
* Normalize or regenerate multipart metadata at the trusted edge
78+
before forwarding requests to Rack.
79+
* Avoid relying on upstream inspection of malformed multipart
80+
requests unless duplicate parameter handling is explicitly
81+
consistent across components.
82+
cvss_v3: 3.7
83+
patched_versions:
84+
- "~> 2.2.23"
85+
- "~> 3.1.21"
86+
- ">= 3.2.6"
87+
related:
88+
url:
89+
- https://nvd.nist.gov/vuln/detail/CVE-2026-26961
90+
- https://github.com/rack/rack/security/advisories/GHSA-vgpv-f759-9wx3
91+
- https://github.com/advisories/GHSA-vgpv-f759-9wx3
92+
---
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
layout: advisory
3+
title: 'CVE-2026-26962 (rack): Rack''s improper unfolding of folded multipart headers
4+
preserves CRLF in parsed parameter values'
5+
comments: false
6+
categories:
7+
- rack
8+
advisory:
9+
gem: rack
10+
cve: 2026-26962
11+
ghsa: rx22-g9mx-qrhv
12+
url: https://github.com/rack/rack/security/advisories/GHSA-rx22-g9mx-qrhv
13+
title: Rack's improper unfolding of folded multipart headers preserves CRLF in parsed
14+
parameter values
15+
date: 2026-04-02
16+
description: |-
17+
## Summary
18+
19+
`Rack::Multipart::Parser` unfolds folded multipart part headers
20+
incorrectly. When a multipart header contains an obs-fold sequence,
21+
Rack preserves the embedded CRLF in parsed parameter values such
22+
as `filename` or `name` instead of removing the folded line break
23+
during unfolding.
24+
25+
As a result, applications that later reuse those parsed values in
26+
HTTP response headers may be vulnerable to downstream header
27+
injection or response splitting.
28+
29+
## Details
30+
31+
`Rack::Multipart::Parser` accepts folded multipart header values and
32+
unfolds them during parsing. However, the unfolding behavior does
33+
not fully remove the embedded line break sequence from the parsed value.
34+
35+
This means a multipart part header such as:
36+
37+
```http
38+
Content-Disposition: form-data; name="file"; filename="test\r
39+
foo.txt"
40+
```
41+
42+
can result in a parsed parameter value that still contains CRLF characters.
43+
44+
The issue is not that Rack creates a second multipart header field.
45+
Rather, the problem is that CRLF remains embedded in the parsed
46+
metadata value after unfolding. If an application later uses that
47+
value in a security-sensitive context, such as constructing an HTTP
48+
response header, the preserved CRLF may alter downstream header parsing.
49+
50+
Affected values may include multipart parameters such as
51+
`filename`, `name`, or similar parsed header attributes.
52+
53+
## Impact
54+
55+
Applications that accept multipart form uploads may be affected if
56+
they later reuse parsed multipart metadata in HTTP headers or other
57+
header-sensitive contexts.
58+
59+
In affected deployments, an attacker may be able to supply a multipart
60+
parameter value containing folded line breaks and cause downstream
61+
header injection, response splitting, cache poisoning, or related
62+
response parsing issues.
63+
64+
The practical impact depends on application behavior. If parsed
65+
multipart metadata is not reused in HTTP headers, the issue may
66+
be limited to incorrect parsing behavior rather than a direct
67+
exploit path.
68+
69+
## Mitigation
70+
71+
* Update to a patched version of Rack that removes CRLF correctly
72+
when unfolding folded multipart header values.
73+
* Avoid copying upload metadata such as `filename` directly into
74+
HTTP response headers without sanitization.
75+
* Sanitize or reject carriage return and line feed characters in
76+
multipart-derived values before reusing them in response headers,
77+
logs, or downstream protocol contexts.
78+
* Where feasible, normalize uploaded filenames before storing or
79+
reflecting them.
80+
cvss_v3: 4.8
81+
unaffected_versions:
82+
- "< 3.2.0"
83+
patched_versions:
84+
- ">= 3.2.6"
85+
related:
86+
url:
87+
- https://nvd.nist.gov/vuln/detail/CVE-2026-26962
88+
- https://github.com/rack/rack/security/advisories/GHSA-rx22-g9mx-qrhv
89+
- https://github.com/advisories/GHSA-rx22-g9mx-qrhv
90+
---
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
layout: advisory
3+
title: 'CVE-2026-32762 (rack): Rack - Forwarded Header semicolon injection enables
4+
Host and Scheme spoofing'
5+
comments: false
6+
categories:
7+
- rack
8+
advisory:
9+
gem: rack
10+
cve: 2026-32762
11+
ghsa: qfgr-crr9-7r49
12+
url: https://github.com/rack/rack/security/advisories/GHSA-qfgr-crr9-7r49
13+
title: Rack - Forwarded Header semicolon injection enables Host and Scheme spoofing
14+
date: 2026-04-02
15+
description: |-
16+
## Summary
17+
18+
`Rack::Utils.forwarded_values` parses the RFC 7239 `Forwarded` header
19+
by splitting on semicolons before handling quoted-string values.
20+
Because quoted values may legally contain semicolons, a header such as:
21+
22+
```http
23+
Forwarded: for="127.0.0.1;host=evil.com;proto=https"
24+
```
25+
26+
can be interpreted by Rack as multiple `Forwarded` directives rather
27+
than as a single quoted `for` value.
28+
29+
In deployments where an upstream proxy, WAF, or intermediary validates
30+
or preserves quoted `Forwarded` values differently, this discrepancy
31+
can allow an attacker to smuggle `host`, `proto`, `for`, or `by`
32+
parameters through a single header value.
33+
34+
## Details
35+
36+
`Rack::Utils.forwarded_values` processes the header using logic
37+
equivalent to:
38+
39+
```ruby
40+
forwarded_header.split(';').each_with_object({}) do |field, values|
41+
field.split(',').each do |pair|
42+
pair = pair.split('=').map(&:strip).join('=')
43+
return nil unless pair =~ /\A(by|for|host|proto)="?([^"]+)"?\Z/i
44+
(values[$1.downcase.to_sym] ||= []) << $2
45+
end
46+
end
47+
```
48+
49+
The method splits on `;` before it parses individual `name=value`
50+
pairs. This is inconsistent with RFC 7239, which permits quoted-string
51+
values, and quoted strings may contain semicolons as literal content.
52+
53+
As a result, a header value such as:
54+
55+
```http
56+
Forwarded: for="127.0.0.1;host=evil.com;proto=https"
57+
```
58+
59+
is not treated as a single `for` value. Instead, Rack may interpret
60+
it as if the client had supplied separate `for`, `host`, and `proto`
61+
directives.
62+
63+
This creates an interpretation conflict when another component in
64+
front of Rack treats the quoted value as valid literal content,
65+
while Rack reparses it as multiple forwarding parameters.
66+
67+
## Impact
68+
69+
Applications that rely on `Forwarded` to derive request metadata
70+
may observe attacker-controlled values for `host`, `proto`, `for`,
71+
or related URL components.
72+
73+
In affected deployments, this can lead to host or scheme spoofing
74+
in derived values such as `req.host`, `req.scheme`, `req.base_url`,
75+
or `req.url`. Applications that use those values for password reset
76+
links, redirects, absolute URL generation, logging, IP-based
77+
decisions, or backend requests may be vulnerable to downstream
78+
security impact.
79+
80+
The practical security impact depends on deployment architecture.
81+
If clients can already supply arbitrary trusted `Forwarded`
82+
parameters directly, this bug may not add meaningful attacker
83+
capability. The issue is most relevant where an upstream component
84+
and Rack interpret the same `Forwarded` header differently.
85+
86+
## Mitigation
87+
88+
* Update to a patched version of Rack that parses `Forwarded`
89+
quoted-string values before splitting on parameter delimiters.
90+
* Avoid trusting client-supplied `Forwarded` headers unless they
91+
are normalized or regenerated by a trusted reverse proxy.
92+
* Prefer stripping inbound `Forwarded` headers at the edge and
93+
reconstructing them from trusted proxy metadata.
94+
* Avoid using `req.host`, `req.scheme`, `req.base_url`, or
95+
`req.url` for security-sensitive operations unless the forwarding
96+
chain is explicitly trusted and validated.
97+
cvss_v3: 4.8
98+
unaffected_versions:
99+
- "< 3.0.0.beta1"
100+
patched_versions:
101+
- "~> 3.1.21"
102+
- ">= 3.2.6"
103+
related:
104+
url:
105+
- https://nvd.nist.gov/vuln/detail/CVE-2026-32762
106+
- https://github.com/rack/rack/security/advisories/GHSA-qfgr-crr9-7r49
107+
- https://github.com/advisories/GHSA-qfgr-crr9-7r49
108+
---

0 commit comments

Comments
 (0)