RubyGems.org Patches Critical Flaw Allowing Remote Code Execution via Package Publish API Keys
Cybersecurity and privacy
RubyGems.org has resolved a critical vulnerability (GHSA-7h7w-m82c-x2xg, CVSS 4.0 score 9.0). Improper handling of YAML tags during metadata validation allowed any account holding a package publishing API key to trigger arbitrary code execution prior to ownership checks. The hosted platform is patched, while self-hosted instances require manual updates.
Ruby package registry RubyGems.org has patched a critical vulnerability tracked as GHSA-7h7w-m82c-x2xg with a CVSS 4.0 score of 9.0, currently without an assigned CVE. The flaw resides in the package upload metadata validator, which improperly handled YAML tags and allowed attacker-controlled regular expressions to be parsed by Ruby's Psych library. Because metadata validation occurs before verifying gem ownership, any account possessing a valid publishing API key could trigger the issue without owning a repository gem. The maintenance team reproduced remote code execution in local testing when chained with a memory corruption issue in the Ruby 4.0.9 regex compiler. Although an inspection found no signs of active exploitation in 29.1 thousand inspected packages, self-hosted deployments must upgrade immediately.
Key takeaways
- Vulnerability GHSA-7h7w-m82c-x2xg affects package metadata validation and is rated 9.0 under CVSS 4.0.
- The validation executes before ownership checks, enabling any account with a publishing API key to trigger the flaw.
- The hosted RubyGems.org service is patched with no exploit evidence found; self-hosted users must update manually.
Source:iThome Read the original ↗
Prepared, checked and automatically published by AI; not individually reviewed by a human. Translation checked by AI.