CVE-2023-40165: Unauthorized gem replacement for full names ending in numbers on rubygems.org
Vulnerability summary
CVE-2023-40165 is a high (CVSS 7.5) Improper Input Validation vulnerability in rubygems rubygems.org. EPSS estimates a 0.46% chance of exploitation in the next 30 days, higher than 38.7% of scored vulnerabilities.
Timeline
- 17-08-2023PublishedVulnerability first disclosed.
- 01-10-2024Last modifiedVulnerability information updated.
Description
rubygems.org is the Ruby community's primary gem (library) hosting service. Insufficient input validation allowed malicious actors to replace any uploaded gem version that had a platform, version number, or gem name matching `/-\d/`, permanently replacing the legitimate upload in the canonical gem storage bucket, and triggering an immediate CDN purge so that the malicious gem would be served immediately. The maintainers have checked all gems matching the `/-\d/` pattern and can confirm that no unexpected `.gem`s were found. As a result, we believe this vulnerability was _not_ exploited. The easiest way to ensure that a user's applications were not exploited by this vulnerability is to check that all of your downloaded .gems have a checksum that matches the checksum recorded in the RubyGems.org database. RubyGems contributor Maciej Mensfeld wrote a tool to automatically check that all downloaded .gem files match the checksums recorded in the RubyGems.org database. You can use it by running: `bundle add bundler-integrity` followed by `bundle exec bundler-integrity`. Neither this tool nor anything else can prove you were not exploited, but the can assist your investigation by quickly comparing RubyGems API-provided checksums with the checksums of files on your disk. The issue has been patched with improved input validation and the changes are live. No action is required on the part of the user. Users are advised to validate their local gems.
CVSS metrics
2 scores · 2 sources · 1 version- CVE.orgCNA7.4HighCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:NDiffers
EPSS trend
Probability
0.46%
Chance of exploitation in the next 30 days
Percentile
39%
Versus all other CVEs
30-day change
No change 0.00 pp
From 0.46% on 22-09-2026
Known exploited
Compare KEV catalogsNot in the CISA KEV catalog.
Not in the ENISA CNW catalog.
Not in the CIRCL catalog.
Public exploits
0 foundNo public exploits indexed.
Weaknesses
CWE · root causeAffected systems
Rubygems1 product
- rubygems.org< 2023-08-14
1 vendor · 1 product
References
2 links- github.com/rubygems/rubygems.org/security/advisories/GHSA-rxcq-2m4f-94wmX Refsource CONFIRMVendor Advisory
- github.com/rubygems/rubygems.org/commit/7e19c19247ddf5885a915710afc60ec6663d8502X Refsource MISCPatch