AEGLIX News
RubyGems.org has fixed a critical security flaw that allowed any account holder with a push-capable API key to inject attacker-controlled regular expressions into gem metadata, potentially achieving remote code execution on the registry infrastructure. The vulnerability, tracked as GHSA-7h7w-m82c-x2xg with a CVSS score of 9.0, stemmed from the validator ignoring the !ruby/regexp YAML tag, which permitted malicious patterns to pass schema checks as plain text before the Psych parser compiled them into executable regular expressions. Maintainers demonstrated that chaining this flaw with a memory corruption bug in Ruby's regexp compiler could reach remote code execution in local testing environments.
The vulnerability existed because metadata parsing occurred before the registry verified whether the account owned the gem name, meaning an attacker needed only a valid push-capable API key to exploit the flaw. On non-vulnerable Ruby builds, compiling an attacker's pattern could still crash an upload worker or exhaust its memory, creating a denial-of-service vector. The issue affected the hosted RubyGems.org registry directly, while self-hosted instances running vulnerable code were also at risk. No CVE identifier has been assigned to this vulnerability.
A review of production telemetry covering 29,100 gems published between October 5 and November 4 found no direct evidence of exploitation in the wild. However, investigators noted that logs were not retained long enough and upload payloads were not recorded, making it impossible to rule out earlier exploitation attempts. The absence of forensic data means the full historical impact cannot be definitively determined, though no active compromise has been identified during the examined window.
The hosted registry now rejects regexp-tagged gemspec fields with an HTTP 422 error and reads metadata using a restricted YAML loader that refuses aliases, effectively neutralizing the attack vector. As an additional safeguard, patterns in OIDC access policies are now capped at 255 characters before compilation. The validation fix was committed to the public code repository on November 4 UTC, three weeks prior to public disclosure. Self-hosted operators are advised to update to a commit containing the fix, while gem users need take no action because the hosted registry has already been patched.
Report prepared 2026-11-30 · Based on reporting from The Hacker News. Source publication date above; subsequent developments may not be reflected.