RubyGems registry flaw fixed, no action for gem users
RubyGems.org patched a critical flaw in gem metadata handling. Gem users need to do nothing, but self-hosters and Ruby app owners have updates to apply.

RubyGems.org has fixed a critical flaw that let any account with a push-capable API key feed an attacker-controlled regular expression into the metadata of a gem upload. The hosted registry is already patched. If you only install gems, there is nothing to do, according to The Hacker News.
What to do
- Gem users: nothing. The hosted registry is fixed.
- Self-hosters of the RubyGems.org software: update to a commit that contains the fix.
- Ruby application owners: this is a separate job. The seven runtime flaws in Ruby’s regexp engine and string case conversion, patched November 18, are fixed in Ruby 4.0.10, 3.4.13 and 3.3.14, per the Ruby project’s security announcement as cited in the report. Put that ahead of anything else on this list if you run Ruby in production.
What changed
The registry’s maintainers tracked the flaw as GHSA-7h7w-m82c-x2xg and rated it 9.0 on the CVSS scale. No CVE has been assigned. It sat in how the registry reads the YAML metadata that every gem carries.
The validator that screens that metadata ignored the !ruby/regexp YAML tag, so a tagged field passed schema checks as plain text. Ruby’s YAML library, Psych, then turned the field into a real regular expression. This ran before the registry checked whether the account owned the gem name, so an attacker needed no gem of their own, only a push-capable API key.
In local testing, the maintainers chained the flaw with a memory corruption bug in Ruby’s regexp compiler and reached remote code execution. They did not say which bug the chain used. That code execution ran with the privileges of the gem-upload worker in a local environment. The advisory does not say whether an attacker could have reached published gems or publishing credentials from there. Even on a Ruby build not exposed to code execution, compiling an attacker’s pattern can crash an upload worker or exhaust its memory.
Exploitation status
The maintainers reviewed production telemetry and 29,100 gems published between October 5 and November 4 and found no direct evidence of exploitation. That is not a clean bill of health. Logs were not kept long enough and upload payloads were not recorded, so earlier attempts cannot be ruled out.
The fix
On the hosted service, schema validation now rejects regexp-tagged gemspec fields with an HTTP 422 error. Gem metadata is read with a restricted loader that refuses YAML aliases and allows only the handful of classes a valid gemspec uses. Patterns in OIDC access policies are capped at 255 characters before compilation. The validation change reached the registry’s public repository on November 4 (UTC), three weeks before the disclosure.
Priority call
The registry hosts about 199,000 gems, so the stakes of a registry-side bug are high. But the fix is live and the practical exposure for most teams is the Ruby runtime. Patch the interpreter first. Registry-side, there is nothing left for you to do.
For more on registry-level risk, see our coverage of a RubyGems typosquat campaign and dormant-account abuse on RubyGems. More in the supply chain hub.
Found this useful? Share it.


