Title: RubyGems.org Closed a Critical Chain That Began With an Overlooked YAML Tag in Gem Metadata
Summary:
RubyGems.org disclosed a critical weakness in its gem-push validation on November 26 (GHSA-7h7w-m82c-x2xg, CVSS 9.0, CWE-502, no CVE assigned). The schema that screens uploaded gemspec metadata treated !ruby/regexp as a tag it could ignore, so a string field carrying it sailed through as ordinary text — after which the Psych YAML loader rebuilt that field into a working Regexp and compiled whatever pattern the uploader had embedded. Since ownership checks happen later in the push pipeline, the path was open to any account with a push-capable API key, even one that owns no gems at all. In local testing on Ruby 4.0.9, the maintainers combined the flaw with a memory-corruption weakness in Ruby’s regexp engine and obtained code execution running under the gem-upload worker’s privileges; against Ruby builds without that weakness, the same trick could still crash a worker or exhaust its memory. The team examined production telemetry and the 29,100 gems published from October 5 through November 4 and saw nothing that pointed to real abuse — though short log retention and unrecorded upload payloads mean earlier attempts cannot be excluded entirely. On the hosted registry the remediation is already live: regexp-tagged gemspec fields now bounce with an HTTP 422, gemspec YAML is parsed by a loader that refuses aliases and whitelists only the classes a genuine gemspec needs, and OIDC access-policy patterns are capped at 255 characters as an extra guard. Gem users have nothing to do here; operators who run their own RubyGems.org instance are the ones who need to move to a fixed commit. Ruby applications face separate homework: the underlying regexp and string-case flaws were corrected in Ruby 4.0.10, 3.4.13, and 3.3.14 on November 18.
References: