RubyGems.org YAML regexp flaw let gem publishers reach RCE on registry (GHSA-7h7w-m82c-x2xg)
Severity: critical · Patch status: patched · Since 2026-11-26
GitHub published GHSA-7h7w-m82c-x2xg on rubygems/rubygems.org on 2026-11-26 as a critical CWE-502 issue. The gem-push validator stopped rejecting the !ruby/regexp YAML tag, so any account holding a push-capable API key could submit gemspec metadata that Psych turned into a live Regexp before the gem-ownership check ran. The advisory says the chain reached code execution with the upload worker's privileges, but only in local testing against Ruby 4.0.9, where it was paired with a memory-corruption bug in Ruby's regexp compiler that the advisory does not name. Its review of 29,100 gems published 2026-10-05 to 2026-11-04 found no direct evidence of exploitation, but log retention was short and upload payloads were not recorded, so earlier attempts cannot be ruled out. The hosted registry now returns HTTP 422 for regexp-tagged gemspec fields, reads metadata with a restricted YAML loader, and caps OIDC policy patterns at 255 characters. Hosted gem users need no action. Self-hosters must update to a commit containing the validation fix, which entered the public repository on 2026-11-04 per THN. The seven Ruby regexp and case-conversion flaws are a separate Ruby advisory of 2026-11-18, fixed in Ruby 4.0.10, 3.4.13 and 3.3.14.
What to do
- Self-hosted RubyGems.org: update to a commit containing the gemspec validation fix
- Hosted RubyGems.org users: no action needed
- Ruby applications: the separate Ruby advisory of 2026-11-18 (seven regexp and case-conversion flaws) is fixed in Ruby 4.0.10, 3.4.13 and 3.3.14; see the linked Ruby record
Fixed versions
- RubyGems.org commit containing the gemspec validation fix (public repository, 2026-11-04 per THN)
Sources
All live incidents on Threat Watch