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 advisory last week. Gem users do not need to do anything.
A review of production telemetry and 29,100 gems published between October 5 and November 4 found "no direct evidence of exploitation," the advisory says. Gaps remain: logs were not kept long enough, and upload payloads were not recorded, so earlier attempts cannot be ruled out.
The flaw is tracked as GHSA-7h7w-m82c-x2xg and scores 9.0 on the CVSS scale, with no CVE assigned. It sat in how the registry reads the metadata a gem carries as YAML.
The validator that screens that metadata ignored the !ruby/regexp YAML tag, so a field carrying the tag passed schema checks as plain text. Ruby's YAML library, Psych, then turned the field into a real regular expression, compiling whatever pattern the attacker supplied.
All of 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.
9, a version affected by the seven flaws in Ruby's regexp engine and string case conversion that the Ruby project patched on November 18. The advisory does not say which memory corruption bug the chain used.
Source link







