CyberSecurityNews

Critical RubyGems Vulnerability Could Let Attackers Execute Code on Package Registry Servers


RubyGems.org disclosed a critical package upload flaw that could let authenticated attackers execute code on registry servers by exploiting how gem metadata is processed.

Maintainers demonstrated remote code execution in a local test using Ruby 4.0.9. However, they found no direct evidence that attackers exploited the flaw on the public registry.

The GitHub security advisory, GHSA-7h7w-m82c-x2xg, was published on November 26, 2026, and carries a CVSS 4.0 score of 9.0 out of 10. The advisory lists no known CVE identifier.

An attacker would need a RubyGems.org account and an API key with permission to publish packages, but would not need to own an existing gem. No action by another user was required.

Every gem includes a specification, or gemspec, that describes the package. The registry checks that metadata against rules for what each field can contain. In this case, the validator and the YAML parser interpreted part of the same metadata differently.

The validator treated the value as plain text. At the same time, the parser turned it into a regular expression, a pattern normally used to match text.

Critical RubyGems Vulnerability

The registry processed the metadata before checking whether the publisher owned the package name. That meant an ownership check could not protect the upload process from the earlier parsing flaw.

MITRE classifies this type of weakness as CWE-502, or deserialization of untrusted data. It occurs when software rebuilds objects from external input without adequately limiting what the input can create.

In local testing, the registry flaw and a separate memory corruption bug in Ruby’s regular expression compiler together allowed code to run with the permissions of the process that handles gem uploads.

The advisory does not report code execution on the live service. It also warns that even Ruby builds not susceptible to code execution could still face upload worker crashes or run out of memory.

Maintainers reviewed production activity and 29,100 gems published from October 5 through November 4, 2026. They found no direct evidence of exploitation. The review could not rule out earlier attempts because logs were kept for a limited time and the service did not log upload contents.

The fix rejects regular expressions in gemspec fields that expect text and limits which Ruby objects the parser can create. Developers who use the hosted RubyGems.org service do not need to take action.

Teams running a self-hosted RubyGems.org deployment should update to a code revision that contains the fix rather than look for a patched gem release.

The flaw differs from the credential-stealing Ruby gem and malicious gems that previously turned developer machines into Monero miners, as covered by Cyber Security News.

Those campaigns put developers at risk through packages they installed or used. This vulnerability was on the registry side, where the server processes uploads before a package is available for anyone to download.

Give your SOC the alert context on the latest threats to stop incidents quickly -> Integrate Threat Intel from 16K SOCs



Source link