RubyGems.org fixes critical metadata flaw that could run registry code
Original title: Critical RubyGems Flaw Could Have Let Any Gem Publisher Run Code on the Registry
Any push-capable API key could inject a regexp via YAML; maintainers reached code execution locally, with no CVE assigned.
RubyGems.org fixed GHSA-7h7w-m82c-x2xg, a CVSS 9.0 flaw with no CVE, in how gem upload metadata is read as YAML. A push-capable API key could pass a !ruby/regexp tag that Psych compiled before ownership checks. Maintainers chained it in local testing on Ruby 4.0.9 with a regexp memory-corruption bug and reached code execution as the upload worker. A review of 29,100 gems published from October 5 to November 4 found no direct evidence of exploitation.
Unconfirmed: The advisory found no direct evidence of exploitation but said incomplete logs cannot rule out earlier attempts, and it does not say whether code execution could reach published gems or credentials.
- Schema validation now rejects regexp-tagged gemspec fields with an HTTP 422 error.
- Self-hosters should update to a commit that contains the registry fix.
- Related Ruby regexp flaws are fixed in 4.0.10, 3.4.13 and 3.3.14.
- Logs were not kept long enough to rule out earlier upload attempts.
- Users of the hosted registry do not need to take action.
Impact: Remote code execution as the gem-upload worker
| Product | Affected | Fixed in |
|---|---|---|
| RubyGems.org | — | a commit containing the fix |
| Ruby | 4.0.9 used in the maintainers' test | 4.0.10, 3.4.13, 3.3.14 |
- 1.Gem users of the hosted registry do not need to act.
- 2.Self-hosters should update to a commit containing the registry fix.
- 3.Update Ruby applications to 4.0.10, 3.4.13 or 3.3.14.
- Products
- RubyGems.org
From the original article
2 min read at thehackernews.com
RubyGems. org, the central registry for the Ruby community's gems, 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. In local testing, the registry's maintainers chained the flaw with a memory corruption bug in Ruby's regexp compiler and reached remote code execution, they said in an
thehackernews.com
A short excerpt; the article and its images belong to the publisher. Summary, key facts and assessment above are AI-written from the article and can be wrong.