CVE-2022-45442: Sinatra Sinatra Vulnerable To Reflected File Vulnerability

HIGH
Advisory Identifier: GHSA-2x8x-jmrp-phxw
CVSS 8.8
CWE-494
Published
Advisory Summary

CVE-2022-45442 is a HIGH (CVSS 8.8) sinatra vulnerable to reflected file vulnerability (CWE-494: Download of Code Without Integrity Check) affecting Sinatra libraries in the RubyGems ecosystem. The issue involves sinatra vulnerable to reflected file download attack. Remediation is available by upgrading affected packages to version 3.0.4, 2.2.3.

CVE-2022-45442 at a Glance

CVE Identifier CVE-2022-45442
GHSA Identifier GHSA-2x8x-jmrp-phxw
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-494: Download of Code Without Integrity Check
Affected Product Sinatra
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-45442

To remediate this vulnerability, upgrade all affected Sinatra dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

sinatra fixed: 3.0.4
Upgrade sinatra to 3.0.4
sinatra fixed: 2.2.3
Upgrade sinatra to 2.2.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for sinatra

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-45442, inspect your project dependencies for Sinatra:

inspect dependencies for sinatra

Analyze the terminal output to locate any version of Sinatra in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.4), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-494: Download of Code Without Integrity Check, where the product downloads source code or an executable from a remote location and executes the code without sufficiently verifying the origin and integrity of the code. In Sinatra, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Description An issue was discovered in Sinatra 2.0 before 2.2.3 and 3.0 before 3.0.4. An application is vulnerable to a reflected file download (RFD) attack that sets the Content-Disposition header of a response when the filename is derived from user-supplied input. ### References * https://www.blackhat.com/docs/eu-14/materials/eu-14-Hafif-Reflected-File-Download-A-New-Web-Attack-Vector.pdf * https://github.com/advisories/GHSA-8x94-hmjh-97hq

CVE-2022-45442 Affected Sinatra Versions

2 component(s)
Fixed Versions:
3.0.42.2.3
Product / Package Ecosystem Affected Versions Fixed Version
sinatra
RubyGems
≥ 3.0
< 3.0.4
3.0.4
sinatra
RubyGems
≥ 2.0.0
< 2.2.3
2.2.3

References

Frequently Asked Questions

What is CVE-2022-45442?
CVE-2022-45442 is a security vulnerability in Sinatra involving Sinatra vulnerable to Reflected File Download attack under CWE-494: Download of Code Without Integrity Check.
Which Sinatra versions are affected?
Affected versions include releases prior to 3.0.4, 2.2.3 across affected packages: sinatra.
What version fixes CVE-2022-45442?
Upgrading to 3.0.4, 2.2.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sinatra affected?
Yes, sinatra is affected in releases prior to 3.0.4, 2.2.3. Upgrade your dependency to 3.0.4, 2.2.3 or later.
What is the CVSS score of CVE-2022-45442?
CVE-2022-45442 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-45442?
CVE-2022-45442 is classified under CWE-494: Download of Code Without Integrity Check (The product downloads source code or an executable from a remote location and executes the code without sufficiently verifying the origin and integrity of the code.).
How can I check RubyGems dependencies for CVE-2022-45442?
Run the dependency tree command: 'inspect dependencies for sinatra'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2x8x-jmrp-phxw",
  "modified" : "2025-11-04T19:37:28Z",
  "published" : "2022-11-30T21:18:34Z",
  "aliases" : [ "CVE-2022-45442" ],
  "summary" : "Sinatra vulnerable to Reflected File Download attack",
  "details" : "### Description\nAn issue was discovered in Sinatra 2.0 before 2.2.3 and 3.0 before 3.0.4. An application is vulnerable to a reflected file download (RFD) attack that sets the Content-Disposition header of a response when the filename is derived from user-supplied input.\n\n### References\n* https://www.blackhat.com/docs/eu-14/materials/eu-14-Hafif-Reflected-File-Download-A-New-Web-Attack-Vector.pdf\n* https://github.com/advisories/GHSA-8x94-hmjh-97hq",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "sinatra"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0"
      }, {
        "fixed" : "3.0.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "sinatra"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.2.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/sinatra/sinatra/security/advisories/GHSA-2x8x-jmrp-phxw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-45442"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sinatra/sinatra/commit/ea8fc9495a350f7551b39e3025bfcd06f49f363b"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-8x94-hmjh-97hq"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/sinatra/CVE-2022-45442.yml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sinatra/sinatra"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/01/msg00005.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2024/09/msg00020.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.blackhat.com/docs/eu-14/materials/eu-14-Hafif-Reflected-File-Download-A-New-Web-Attack-Vector.pdf"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-494" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-11-30T21:18:34Z",
    "nvd_published_at" : "2022-11-28T21:15:00Z"
  }
}