Read the docs
TI-2023-21039 Aliases CVE-2023-40165

Unauthorized gem replacement for full names ending in numbers on rubygems.org

Priority LOW 33CWE-20Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
None
Attack complexity
Low
Impact type
—
Confidentiality · integrity · availability
None · High · None
Fix status
Fixed

Attack profile from CVSS 3.1 · NVD. Fix status from CNA.

Summary

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.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.00459 39th percentileScored 2026-11-07
Fix Fixed rubygems.org (rubygems): 2023-08-14

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
No
Technical impact
Partial

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
rubygemsrubygems.orgbefore 2023-08-142023-08-14Patch availableCNA
  • rubygems.org Vendorrubygems Affected before 2023-08-14 Fixed in 2023-08-14 Patch available CNA

CPE configurations NVD · 1

CPEVersionsRoleVendor
cpe:2.3:a:rubygems:rubygems.org:*:*:*:*:*:*:*:*before 2023-08-14Vulnerablerubygems
  • cpe:2.3:a:rubygems:rubygems.org:*:*:*:*:*:*:*:* Versions before 2023-08-14 Vulnerable ·rubygems

Remediation

  • Fix · CNA rubygems.org (rubygems) Fixed in 2023-08-14

Timeline

  1. 2026-10-02 Threatist record created from CVE-2023-40165

References

  • TI-2022-11761 Unauthorized takeover for new versions of some platform-specific gems CVSS 3.1HIGH 7.7
  • TI-2024-14379 rubygems.org MFA Bypass through password reset function could allow account takeover CVSS 3.1CRITICAL 9.8
  • TI-2022-11719 Unauthorized gem takeover for some gems on rubygems.org CVSS 3.1CRITICAL 9.9

Sources

This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences