A RubyGems.org remote code execution flaw has been fixed on the hosted registry, according to a GitHub security advisory published by the RubyGems.org maintainers on November 26, 2026. The advisory rates the bug Critical with a CVSS score of 9.0 and says it affected the way the registry validated gems when they were pushed.

The flaw sat in the gem push validator. A specially crafted gemspec file could make the server compile an attacker supplied regular expression, and the advisory says that step could be chained with a separate Ruby memory corruption bug to run code on the gem upload worker. The advisory says this chain was reproduced locally only.

Gem maintainers and consumers do not need to act, but anyone who self hosts RubyGems.org should update. Security teams that care about software supply chains should also read how close a simple account came to reaching the registry’s code path.

RubyGems.org Remote Code Execution Flaw: Key Takeaway

  • Any user with a RubyGems.org account and a push capable API key could reach the vulnerable code, because validation ran before the registry checked who owned the gem name.

Track the software you depend on. Tenable provides vulnerability management, which helps teams keep an inventory of what needs patching.

Add a layer of endpoint protection. Bitdefender provides antivirus, threat detection and online privacy software for individuals, businesses and managed service providers.

What Happened: A Validator That Trusted the Wrong YAML Tag

The advisory is titled as an authenticated remote code execution in RubyGems.org gem pushes through !ruby/regexp gemspec tags. It has no CVE number; the advisory states “No known CVE.” It is classed as CWE-502, deserialization of untrusted data, which means the program turns outside input back into live objects without enough checks.

How the flaw worked

  • When someone pushes a gem, the registry reads the gemspec, a YAML file that describes the package.
  • The validator kept a list of ignored tags, called IGNORED_TAGS. That list included !ruby/regexp, so a field carrying that tag was treated as a plain value.
  • Ruby’s YAML library, Psych, then deserialized the field into a Regexp object. That compiled the pattern the attacker supplied.
  • All of this ran before the Pusher component checked whether the user owned the gem name. An attacker therefore needed only an account and a push capable API key, not an existing gem.
  • The attack path was a POST request to /api/v1/gems.

Why it mattered

On Ruby 4.0.9, the advisory says chaining this behavior with a memory corruption bug in Ruby’s regexp compiler gave code execution with the privileges of the gem upload worker, in local testing. It does not name the specific memory bug. Even without code execution, compiling a hostile pattern can crash a worker or exhaust its memory.

Separately, the Ruby project published security advisories for seven Regexp and String case conversion flaws on November 18, 2026. Those affect Ruby 3.3.13 and earlier, 3.4.0 through 3.4.12 and 4.0.0 through 4.0.9, and are fixed in 4.0.10, 3.4.13 and 3.3.14. The RubyGems advisory does not state that its memory bug is one of those seven, so treat the link as unconfirmed.

The Fix

The maintainers made several changes:

  1. Removed !ruby/regexp from IGNORED_TAGS, so such fields are rejected with an HTTP 422 response.
  2. Replaced to_ruby with safe_to_ruby, which uses a restricted class loader and refuses YAML aliases. The Ruby documentation for Psych says unsafe loading should not be used to parse untrusted documents.
  3. Limited deserialization to a short list of classes: Gem::Specification, Gem::Version, Gem::Requirement, Gem::Dependency, Gem::Version::Requirement, Symbol, Time and Date.
  4. Capped OIDC access policy string match patterns at 255 characters and turned regexp errors into access errors during token exchange.

Who Is Affected

  • The hosted RubyGems.org service was the vulnerable system, and the advisory describes it as fixed.
  • Operators of self hosted RubyGems.org instances are affected until they take a commit that contains the fix. The advisory lists patched versions as “None,” so no release number is given.
  • Ordinary gem users are told no action is needed.

Steps Administrators Can Take

The advisory gives these directions:

  • Gem users: no action needed.
  • Self hosted RubyGems.org operators: update to a commit that contains the fix.

The advisory offers no workarounds. The following are general hardening ideas, not statements from the source:

  • Review who holds push capable API keys on any private registry and revoke those that are unused.
  • Keep Ruby runtimes on supported patched releases, since the Ruby project has fixed the separate regexp flaws.
  • Run upload workers with the fewest privileges possible and cap their memory.

Implications

Registries are high value targets

A flaw in a package registry sits upstream of every project that installs from it. The advisory says no gem credentials or published packages were shown to be reachable, and that point remains unconfirmed. Past incidents, such as the npm supply chain attack and malicious PyPI packages, show why defenders watch registries closely.

Validation order matters

The bug existed because validation and deserialization ran before the ownership check. Checking who a user is and what they may do before parsing their data would have narrowed the exposure to gem owners.

Evidence of exploitation is thin by design

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 also say log retention was short and upload payloads were not logged, so earlier attempts cannot be ruled out. Coverage by The Hacker News highlights the same limit.

Get help if a build system is compromised. CrowdStrike offers AI native cybersecurity software and incident response services.

Looking Forward

The hosted registry is fixed, but the picture is incomplete. The advisory does not say who found the flaw, when it was found or when it was reported. It names no bounty and gives no fix commit date.

It also does not say whether published gems or publishing credentials were reachable through the flaw. Until the maintainers or independent researchers say more, the safest reading is that no exploitation was seen, with limited logging behind that claim. The RubyGems.org site remains the place to watch for updates.

Questions Worth Answering

What is the RubyGems.org remote code execution flaw?

  • It is a critical bug in the gem push validator that let a crafted gemspec make the server compile an attacker supplied regular expression.

Does it have a CVE number?

  • No. The advisory GHSA-7h7w-m82c-x2xg states “No known CVE.”

How severe is it?

  • The advisory rates it Critical with a CVSS 4.0 score of 9.0.

Who could exploit it?

  • Anyone with a RubyGems.org account and a push capable API key, because validation ran before gem name ownership was checked.

Was it exploited in the wild?

  • The maintainers found no direct evidence of exploitation but say short log retention means earlier attempts cannot be ruled out.

Did attackers get code execution on the live registry?

  • The advisory says code execution was reproduced locally on Ruby 4.0.9 only, not against the live service.

Do gem users need to do anything?

  • No. The advisory says gem users need no action.

Do self hosted operators need to update?

  • Yes. They should move to a commit that contains the fix, since no version number is listed.

Is this related to the November 18 Ruby security release?

  • The RubyGems advisory does not say so, though both involve the Ruby regexp compiler and Ruby 4.0.9 as an affected version.

Who discovered the flaw?

  • The advisory does not name a reporter. It credits two people as remediation developers.

More tools worth a look: 1Password for logins, Optery for personal data removal and EasyDMARC for spoofed email.

Leave a Comment

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list for the latest news and updates.

You have Successfully Subscribed!

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More