The team behind RubyGems.org, the registry for Ruby packages (gems), disclosed on November 26, 2026 in a GitHub security advisory that a critical vulnerability in its gem push process had been fixed. Rated 9.0 (Critical) under CVSS v4, the flaw could have allowed arbitrary code to run on RubyGems.org's servers.
The "!ruby/regexp" tag in gemspecs slipped past validation
According to the advisory, the problem was in the POST /api/v1/gems endpoint that accepts gem uploads. A gem's gemspec is sent in YAML, and RubyGems.org validates it before converting it into Ruby objects. However, the validator was set to ignore the !ruby/regexp YAML tag, so a value carrying that tag passed validation as an ordinary string.
Later, when the YAML library Psych converted the value, the attacker-supplied string was actually compiled as a regular expression. Simply sending a field such as summary with a regexp tag was enough to reach this code path. The weakness is classified as deserialization of untrusted data (CWE-502).
All it took was an API key with push rights
The only requirement was a RubyGems.org API key with permission to push gems. Because validation and deserialization ran before the registry checked gem ownership, an attacker did not need to own any gem. In other words, anyone able to create an account and issue an API key could meet the conditions.
The team reproduced the issue locally on Ruby 4.0.9 and reached remote code execution by chaining it with a memory corruption bug in Ruby's regexp compiler. The test was not run against the live service. Even on builds where code execution was not possible, compiling the regexp could crash a worker or exhaust its memory, the team said.
About 29,100 gems reviewed, no direct exploitation found
The team reviewed production telemetry and about 29,100 gems published between October 5 and November 4, 2026, and found no direct evidence of exploitation. It cautioned, however, that log retention limits and unlogged upload payloads mean earlier attempts cannot be ruled out.
Three fixes were made. First, !ruby/regexp was removed from the ignored tags, so gemspecs containing it are now rejected with an HTTP 422 error. Next, YAML conversion now uses a restricted loader that refuses YAML aliases and only allows a small set of permitted classes. Finally, regular expressions used in OIDC access policies are now capped at 255 characters.
No action needed for gem users; self-hosters should update
Since RubyGems.org is a hosted service, developers who use or publish gems do not need to take any action. Organizations running their own deployment of the RubyGems.org code, however, are advised to update to a commit that contains the fix. As of this writing, no CVE has been assigned in the advisory.
Our Take
That anyone with an account and an API key could reach dangerous code before ownership was checked is a serious gap for a registry at the heart of the software supply chain. Code execution on the registry's servers could in theory have led to tampering with the gems it distributes. That said, a successful attack required chaining with a separate memory corruption bug, and the CVSS vector rates attack complexity as high. Still, the fact that the exploitation review covered only about a month is a concern, and the team deserves credit for openly stating that limitation.
Summary
RubyGems.org has fixed a vulnerability that could have allowed code execution on its servers through regexp tags in gemspecs, and found no evidence of exploitation in the period it reviewed. Gem users need not do anything, and only organizations that self-host RubyGems.org are affected. Details are available in the RubyGems.org security advisory.