CVE-2022-45442: Sinatra vulnerable to Reflected File Download attack
8.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.35115%
CWE
Published
11/30/2022
Updated
2/3/2023
KEV Status
No
Technology
Ruby
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
sinatra | rubygems | >= 3.0, < 3.0.4 | 3.0.4 |
sinatra | rubygems | >= 2.0.0, < 2.2.3 | 2.2.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper escaping in the Content-Disposition header's filename parameter. The GitHub patch shows the attachment
method in lib/sinatra/base.rb was modified to add escaping via gsub(/["\r\n]/). The commit message explicitly references fixing filename escaping for multipart form data compliance. The test case added in test/helpers_test.rb demonstrates the attack scenario where a filename containing ;\r\n is sanitized, confirming this function's role. No other functions in the diff appear to handle user-controlled filename input for headers.