Loading SecureCyberVM…
SecureCyberVM
CVE Lookup Daily Threat Briefing Exploited CVEs Ransomware Zero-day
SecureCyberVM
Get the Patch Brief

RubyGems.org critical flaw let any gem publisher reach code execution on the registry

RubyGems.org disclosed a critical flaw in how it validated uploaded gem metadata, which could be chained with a Ruby regexp bug to run code on the upload worker. The hosted registry is fixed and a log review found no evidence of exploitation.

RubyGems.org critical flaw let any gem publisher reach code execution on the registry

The maintainers of RubyGems.org, the central package registry for the Ruby ecosystem, have disclosed a critical flaw in how the service validated gem metadata at upload time. The weakness let an attacker with nothing more than a push-capable API key push the registry’s upload worker into compiling an attacker-chosen regular expression, which the maintainers chained into remote code execution in local testing.

The hosted service has already been fixed, so ordinary gem users need to do nothing. A review of production data found no direct evidence that the flaw was abused, although the maintainers acknowledge limits in their logs. The advisory carries the identifier GHSA-7h7w-m82c-x2xg and no CVE.

What happened

According to the advisory, published on November 26, 2026, the gem-push validator ignored the YAML tag !ruby/regexp when checking the schema of a gemspec. A field carrying that tag passed validation as plain text, and Ruby’s YAML parser, Psych, then turned it into a real regular expression. The weakness is classed as CWE-502, deserialization of untrusted data.

The order of operations made it worse. Validation and deserialization ran before the registry checked whether the account owned the gem name, so the attacker needed no gem of their own. The maintainers say that in a local reproduction on Ruby 4.0.9 they combined this with a memory-corruption bug in Ruby’s regexp compiler to reach code execution with the privileges of the upload worker. The advisory does not say which regexp bug was used, and on other Ruby builds the same input could still crash a worker or exhaust its memory.

Who is affected

The affected system is the RubyGems.org service itself, which hosts roughly 199,000 gems according to the registry’s public statistics page cited by The Hacker News. The advisory lists no patched package version because the fix is in the registry’s server code. Two groups should pay attention:

  • Self-hosted operators who run the open-source rubygems.org application, for example as an internal gem mirror or registry, need to update to a commit that contains the fix.
  • Everyone else who installs gems from RubyGems.org is not required to act, according to the advisory.

The advisory does not say whether an attacker who gained code execution on the upload worker could have reached published gems or publishing credentials, so that impact remains unstated.

Severity and exploitation

The advisory scores the flaw 9.0 under CVSS v4.0 and rates it critical. The vector reflects network access, high attack complexity, low privileges and no user interaction. The maintainers reviewed production telemetry and 29,100 gems published between October 5 and November 4, 2026, and found no direct evidence of exploitation. They add that limited log retention and the fact that upload payloads were not recorded mean earlier attempts cannot be ruled out. No public exploit is described.

The maintainers also point to a related set of fixes: separate Ruby regexp and string-conversion vulnerabilities were patched on November 18, 2026, in Ruby 4.0.10, 3.4.13 and 3.3.14, according to The Hacker News.

What defenders should do now

  1. If you operate your own RubyGems.org-based registry, update to a commit that includes the fix and confirm that gemspecs with regexp-tagged fields are rejected with HTTP 422.
  2. Upgrade Ruby to 4.0.10, 3.4.13 or 3.3.14 (or later) wherever you process untrusted regular expressions or gem metadata.
  3. Do not load untrusted YAML with unrestricted loaders. Use safe loading with an explicit allow-list of classes.
  4. Review API keys on your RubyGems.org account, remove unused push-capable keys and prefer scoped keys or trusted publishing where available.
  5. Monitor your dependencies for unexpected new releases or ownership changes, and pin versions with lockfiles in builds.

SCVM analysis

Package registries are high-value targets because one foothold can reach many downstream builds, and this case shows the risk sits in routine handling of uploaded files, not just in login or signing. A metadata field was treated as inert text during validation and as live code-adjacent data a moment later. Equally notable is the sequencing: expensive parsing happened before the authorisation check on the gem name, which widened the attacker pool to anyone who could sign up. The disclosure is also candid about its limits, since gaps in logging prevent a firm all-clear for earlier months. Registry operators and teams running internal artifact servers should take the lesson that upload pipelines deserve the same hardening, sandboxing and retention of raw payloads as any internet-facing parser.

Sources

About this article: produced by the SCVM Newsroom with AI assistance from the public sources linked above, enriched with NVD, FIRST EPSS and CISA KEV data, and checked by automated quality controls under our editorial policy. Spotted an error? Request a correction.

SecureCyberVM

Install SecureCyberVM

Get the Daily Threat Briefing and exploited-CVE alerts one tap away, full screen, like an app.