RubyGems.org closes a CVSS 9.0 gem-push RCE path; Ruby apps still need 4.0.10, 3.4.13 or 3.3.14
Any account with a push-capable API key could feed a crafted regexp to RubyGems.org uploads. The registry is fixed; Ruby's own regexp flaws need an upgrade.

TL;DR
- RubyGems.org fixed a critical flaw (CVSS 4.0 score 9.0) that let any account with a push-capable API key make the gem-upload process compile an attacker-supplied regular expression [1].
- Maintainers reached remote code execution in local testing on Ruby 4.0.9 and found no direct evidence of exploitation in production, though they cannot rule out earlier attempts [1].
- Gem users need to do nothing; self-hosted RubyGems.org deployments must update, and Ruby itself fixed seven regexp and string flaws in 4.0.10, 3.4.13 and 3.3.14 [1][2].
RubyGems.org, the central registry for Ruby gems, has published a critical advisory, GHSA-7h7w-m82c-x2xg, with a CVSS 4.0 score of 9.0 [1]. Any authenticated user with a push-capable API key could send crafted gem metadata to POST /api/v1/gems and make the upload process compile a regular expression of the attacker’s choosing [1]. In local testing on Ruby 4.0.9, the maintainers chained this with a memory corruption bug in Ruby’s regexp compiler and reached remote code execution [1].
How the flaw worked
The gem-push validator checks the gemspec YAML against a schema before turning it into Ruby objects [1]. Its list of ignored tags included !ruby/regexp, so a field such as summary: !ruby/regexp /.../ passed validation as plain text [1]. Ruby’s YAML library, Psych, then deserialised that field into a real Regexp object and compiled the pattern [1].
Validation and deserialisation ran before the registry checked who owns the gem name [1]. An attacker therefore needed only a RubyGems.org account and a push-capable API key, not ownership of any gem [1]. Even on Ruby builds without the code execution bug, compiling an attacker’s pattern could crash a worker or exhaust its memory [1].
Exploitation and the fix
The RCE was reproduced locally, not against the live service [1]. A review of production telemetry and 29,100 gems published between 5 October and 4 November 2026 found no direct evidence of exploitation, but log retention limits and unlogged upload payloads mean earlier attempts cannot be ruled out [1].
The registry now rejects regexp-tagged gemspec fields with HTTP 422 before deserialisation [1]. Gem metadata is loaded with a restricted loader that refuses YAML aliases and allows only the classes a valid gemspec uses, and OIDC access-policy patterns are capped at 255 characters before compilation [1].
The Ruby side
Separately, on 18 November 2026 the Ruby project disclosed seven vulnerabilities in its regular expression engine and in string case conversion [2]. It says it is aware of PoCs showing that some of them can lead to remote code execution, for example in applications that compile attacker-controlled patterns [2]. CVE identifiers had been requested but not yet assigned when it posted [2]. Ruby 4.0.9, the version used in the RubyGems.org test, predates the 4.0.10 fix release [1][2].
What builders can do now
- If you only install or publish gems, no action is needed for the registry flaw, because RubyGems.org is a hosted service [1].
- If you run a self-hosted RubyGems.org deployment, update to a commit that contains the fix [1].
- Upgrade Ruby to 4.0.10, 3.4.13 or 3.3.14, which fix the seven regexp and string flaws; the Ruby project strongly recommends the upgrade [2].
Sources
Written and checked by AI from the sources below
- Authenticated remote code execution in RubyGems.org gem pushes via !ruby/regexp gemspec tags (GHSA-7h7w-m82c-x2xg)
- Security advisories: multiple vulnerabilities in Regexp and String case conversion
Fact-checked by gpt-6.1-sol on · Editorial policy



