- Severity: HIGH
- CVE: CVE-2026-142592
- Ecosystems: rubygems, rubygems
- Packages: rack, rack
## Summary
`Rack::Multipart::Parser#tag_multipart_encoding` calls `Encoding.find` once for every `charset` parameter in the `Content-Type` header of a multipart part. When the name is not a known encoding, Ruby’s `Encoding.find` attempts to load an encoding library of that name, which searches every directory on `$LOAD_PATH` before failing. Rack rescues the resulting `ArgumentError` and falls back to binary, does not remember the failure, and does not limit the number of `charset` parameters a part may carry. An attacker can send a part whose `Content-Type` contains thousands of unknown `charset` parameters, and each one costs a full load-path search. This results in a denial of service condition for applications that accept multipart requests.
## Details
The relevant code is:
“`ruby
if k == “charset”
encoding = find_encoding(v)
end
def find_encoding(enc)
Encoding.find enc
rescue ArgumentError
Encoding::BINARY
end
“`
For a name absent from `Encoding.name_list`, `Encoding.find` calls `load_encoding` in `encoding.c`, which requires `enc/.so` through Ruby’s internal loader. The lookup is not cached, is not visible to RubyGems or Bootsnap, and costs roughly 3–5 µs per `$LOAD_PATH` entry: about 30 µs on a bare Ruby, about 500 µs in a Bundler application with 200 load-path entries on macOS, and about 2.5 ms per lookup measured on Linux with 167 entries.
Each `;charset=x` costs 10 bytes. Existing limits do not bound the attack: the part limit (`RACK_MULTIPART_PART_LIMIT`…
Source: GitHub Security Advisories · 2026-12-03