# CVE-2026-34786: Rack: Rack::Static header_rules bypass via URL-encoded paths

> Attackers can bypass security headers on static files by using URL-encoded paths, affecting Rack deployments relying on header_rules.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 2 Apr 2026
- **Updated:** 3 Apr 2026
- **Also known as:** DEBIAN-CVE-2026-34786, GHSA-q4qf-9j86-f5mh, MINI-245v-8gf2-gh9w, MINI-2744-9838-hgqj, MINI-4fwj-xvm8-pgwx, MINI-4p3p-vxxr-c8jq, MINI-58gm-963v-c8f6, MINI-5pp4-8gvr-x6m7, MINI-786c-cw5p-rpx7, MINI-7p28-h38g-xj5v, MINI-7qqg-8hg7-h9c4, MINI-8cf2-c888-cw23, MINI-8qjp-x6c9-v29r, MINI-98x2-hjwg-7577, MINI-c79j-wqrv-498f, MINI-cqj8-jcg3-mxxx, MINI-cx9w-cr6h-5wm4, MINI-fp3j-6h8w-4rw5, MINI-h38q-vwwq-68qh, MINI-jm8v-52r4-gqrg, MINI-m9g7-r788-jq72, MINI-mpmc-wj5w-6j9x, MINI-p6qr-4846-2xh3, MINI-p7rj-745w-5gx6, MINI-wvqf-9rhv-vj49, MINI-x79w-3mqg-28g2, UBUNTU-CVE-2026-34786

## What is CVE-2026-34786?

CVE-2026-34786 is a medium-severity vulnerability in rack, published on 2 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Rack is a modular Ruby web server interface. Prior to versions 2.2.23, 3.1.21, and 3.2.6, Rack::Static#applicable_rules evaluates several header_rules types against the raw URL-encoded PATH_INFO, while the underlying file-serving path is decoded before the file is served. As a result, a request for a URL-encoded variant of a static path can serve the same file without the headers that header_rules were intended to apply. In deployments that rely on Rack::Static to attach security-relevant response headers to static content, this can allow an attacker to bypass those headers by requesting an encoded form of the path. This issue has been patched in versions 2.2.23, 3.1.21, and 3.2.6.

Weakness: CWE-180 (Incorrect Behavior Order: Validate Before Canonicalize)

## Which versions are affected by CVE-2026-34786?

6 open source packages ship an affected version, including rack. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `rack` | RubyGems | All versions | 2.2.23 |
| `rack` | RubyGems | All versions | 2.2.23 |
| `rack` | RubyGems | From 3.0.0.beta1 | 3.1.21 |
| `rack` | RubyGems | From 3.0.0.beta1 | 3.1.21 |
| `rack` | RubyGems | From 3.2.0 | 3.2.6 |
| `rack` | RubyGems | From 3.2.0 | 3.2.6 |

Products: Rack Rack.

## How do I fix CVE-2026-34786?

Upgrade rack to a fixed version for your release line: 2.2.23, 3.1.21 or 3.2.6.

## Is CVE-2026-34786 being exploited?

There is no known exploitation of CVE-2026-34786 in the wild and no public exploit code.

## Other vulnerabilities in rack

- [CVE-2026-34785](https://insights.sbomify.com/CVE-2026-34785/): Rack: Local file inclusion in `Rack::Static` via URL Prefix Matching (high 7.5)
- [CVE-2026-34827](https://insights.sbomify.com/CVE-2026-34827/): Rack: Algorithmic-Complexity DoS in Rack::Multipart::Parser (high 7.5)
- [CVE-2026-34829](https://insights.sbomify.com/CVE-2026-34829/): Rack: Denial of Service via Unbounded Multipart File Upload Without Content-Length (high 7.5)
- [CVE-2026-22860](https://insights.sbomify.com/CVE-2026-22860/): Rack has a Directory Traversal via Rack:Directory (high 7.5)
- [CVE-2025-61919](https://insights.sbomify.com/CVE-2025-61919/): Rack is vulnerable to a memory-exhaustion DoS through unbounded URL-encoded body parsing (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-34786 and fix it if it is affected.

What it is: CVE-2026-34786 is a medium-severity vulnerability in rack, published on 2 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-34786 in the wild and no public exploit code.

Affected packages and fixed versions:
- rack (RubyGems): affected all versions; fixed in 2.2.23
- rack (RubyGems): affected all versions; fixed in 2.2.23
- rack (RubyGems): affected from 3.0.0.beta1; fixed in 3.1.21
- rack (RubyGems): affected from 3.0.0.beta1; fixed in 3.1.21
- rack (RubyGems): affected from 3.2.0; fixed in 3.2.6
- rack (RubyGems): affected from 3.2.0; fixed in 3.2.6

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-34786/ (Markdown: https://insights.sbomify.com/CVE-2026-34786/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-34786
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-34786
- OSV: https://osv.dev/vulnerability/CVE-2026-34786

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-34786/
Summaries are generated and may contain mistakes; the official description above is the record.
