CVE-2022-29970 is a high-severity (CVSS 7.5) Path Traversal vulnerability in sinatra. A fix is available for sinatra — see the affected versions and patch details below.
sinatra does not validate expanded path matches
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
sinatraReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects RubyGems packages — download data is not available via public APIs for these ecosystems.
Description
Sinatra before 2.2.0 does not validate that the expanded path matches public_dir when serving static files.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 💎RubyGems | sinatra | all versions | 2.2.0bundle update sinatra --conservative |
Affected Products
debian linuxdebiansinatrasinatrarbDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for sinatra, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update sinatra to 2.2.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2022-29970 is resolved across your whole dependency graph.
Workarounds
Resolve every user-supplied path to its canonical form and reject anything that escapes the intended directory, and run the component under an account that has no read or write access outside the directory it legitimately serves.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
Disable the static option which will disable the public_dir option. With this configuration, Sinatra will not serve files from the public directory and therefore files outside of it.Source: Red Hat security advisory for CVE-2022-29970 (CC BY 4.0)
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Enterprise Linux 8 | pcs-0:0.10.12-6.el8_6.1 | RHSA-2022:4661 |
| Red Hat Enterprise Linux 8.1 Update Services for SAP Solutions | pcs-0:0.10.2-4.el8_1.2 | RHSA-2022:2255 |
| Red Hat Enterprise Linux 8.2 Extended Update Support | pcs-0:0.10.4-6.el8_2.2 | RHSA-2022:2253 |
| Red Hat Enterprise Linux 8.4 Extended Update Support | pcs-0:0.10.8-1.el8_4.1 | RHSA-2022:2256 |
| Red Hat Enterprise Linux 9 | pcs-0:0.11.1-10.el9_0.1 | RHSA-2022:4587 |
| Red Hat Satellite 6.12 for RHEL 8 | rubygem-sinatra-1:2.2.0-1.el8sat | RHSA-2022:8506 |
Frequently Asked Questions
Is CVE-2022-29970 in your dependencies?
Find it across RubyGems, including transitive dependencies.