CVE-2022-29970: Sinatra Sinatra Does Not Validate Expanded Vulnerability
HIGHCVE-2022-29970 is a HIGH (CVSS 7.5) sinatra does not validate expanded vulnerability (CWE-426: Untrusted Search Path) affecting Sinatra libraries in the RubyGems ecosystem. The issue involves sinatra does not validate expanded path matches. Remediation is available by upgrading affected packages to version 2.2.0.
CVE-2022-29970 at a Glance
Security Impact
CVSS: 7.5
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:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2022-29970
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.
Upgrade sinatra to 2.2.0
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-29970, 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 2.2.0), 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-426: Untrusted Search Path, where the product searches for critical resources using an externally-supplied search path that can point to resources that are not under the product's direct control. 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
CVE-2022-29970 Affected Sinatra Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
sinatra
|
RubyGems |
< 2.2.0
|
2.2.0
|
References
Frequently Asked Questions
What is CVE-2022-29970?
Which Sinatra versions are affected?
What version fixes CVE-2022-29970?
Is sinatra affected?
What is the CVSS score of CVE-2022-29970?
What CWE is associated with CVE-2022-29970?
How can I check RubyGems dependencies for CVE-2022-29970?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qp49-3pvw-x4m5",
"modified" : "2025-11-04T19:36:42Z",
"published" : "2022-05-03T00:00:43Z",
"aliases" : [ "CVE-2022-29970" ],
"summary" : "sinatra does not validate expanded path matches",
"details" : "Sinatra before 2.2.0 does not validate that the expanded path matches public_dir when serving static files.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "sinatra"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.2.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-29970"
}, {
"type" : "WEB",
"url" : "https://github.com/sinatra/sinatra/pull/1683"
}, {
"type" : "WEB",
"url" : "https://github.com/sinatra/sinatra/pull/1683/commits/462c3ca1db53ed3cfc394cf5948e9c948ad1c10e"
}, {
"type" : "WEB",
"url" : "https://github.com/skylightio/skylight-ruby/pull/294"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/sinatra/CVE-2022-29970.yml"
}, {
"type" : "WEB",
"url" : "https://github.com/sinatra/sinatra"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2022/10/msg00034.html"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2024/09/msg00020.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22", "CWE-426" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-05-03T20:59:50Z",
"nvd_published_at" : "2022-05-02T05:15:00Z"
}
}