top of page

RubyGems.org Critical Flaw: Any Account With a Push Key Could Run Code on the Registry. Fixed Nov 4, No Evidence of Exploitation, but the Review Covered One Month of a Nine-Month Window

Writer: Patrick Duggan
Patrick Duggan
13 minutes ago
7 min read

What to do first. If you only install gems, RubyGems.org says you do not need to do anything: the hosted registry is fixed. Two groups do have work. If you run your own copy of the RubyGems.org application, update to a commit that contains the fix (it was merged into the public repository on November 4, 2026). If your Ruby apps compile regular expressions from input, upgrade Ruby itself to 4.0.10, 3.4.13 or 3.3.14; that is a separate set of seven runtime bugs, and it is the half of this chain that lives on your servers. And if you want your builds to notice a gem that changes underneath you, from any cause, record checksums in your lockfile with bundle lock --add-checksums and install frozen in CI.


Nobody has reported this flaw being used. The advisory says a review "found no direct evidence of exploitation," and it is honest about how far that review reaches. More on that below, because the gap is the most useful part of this story.



What it is


The advisory is GHSA-7h7w-m82c-x2xg, rated critical and published November 26, 2026 by the RubyGems.org maintainers. The Hacker News puts the CVSS score at 9.0; the advisory page we read through the GitHub API lists the severity as critical without a score. There is no CVE, so a scanner that works from CVE IDs will not show it, and it is not in CISA's Known Exploited Vulnerabilities catalog.


In the advisory's words: "RubyGems.org's gem-push validator ignored the !ruby/regexp YAML tag during schema validation, then Psych deserialised it into an attacker-controlled regular expression. Any authenticated user with a push-capable API key could submit crafted gem metadata to POST /api/v1/gems and trigger regexp compilation in the upload process before gem-name ownership checks ran."


In plain terms: every gem carries its metadata as YAML. The registry checks that YAML against a schema, then turns it into Ruby objects. The checker skipped one tag, !ruby/regexp, so a field like the gem's summary could arrive marked as a regular expression, pass the check as ordinary text, and then be compiled as a real regex. Ruby's regex compiler had memory corruption bugs. Feed it the right pattern and you are running code.


Two details make it worse than an ordinary authenticated bug:


  • No gem needed. The advisory: "Validation and deserialisation run before Pusher checks gem ownership, so any account with a push-capable API key could reach this path without owning an existing gem." Anyone can sign up for an account and make a push key.

  • It ran on the registry, not on a user's machine. The advisory: "On Ruby 4.0.9, crafted gemspec patterns achieved remote code execution with the privileges of the gem-upload worker process in local testing."

Even without code execution, the advisory notes, "attacker-controlled regexp compilation can crash or exhaust memory in a worker."



Was it exploited? What RubyGems says


Quoted in full, because every word is load-bearing: "This was reproduced locally against Ruby 4.0.9 rather than against the live service. A review of production telemetry and 29,100 gems published between 5 October and 4 November 2026 found no direct evidence of exploitation, though log retention and unlogged upload payloads do not rule out earlier attempts."


So three things are true at once:


  1. The maintainers proved code execution in their own lab, not on production.

  2. They looked at a month of pushes (29,100 gems) and found nothing.

  3. They say plainly they cannot rule out earlier attempts, because older logs were gone and upload payloads were never logged.

The advisory does not say whether an attacker who got code execution on an upload worker could have reached published gems, signing material or other users' credentials. It does not say which of Ruby's regexp bugs the chain used. We are not going to guess at either.



How long was the door open?


The advisory gives a review window (October 5 to November 4) but no start date for the flaw. The public commit history fills part of that in. The schema validator, with !ruby/regexp already on its ignored-tags list, entered the rubygems.org repository on February 5, 2026 (commit 8ec1fe888fb0). Its own commit message says it was added to "reject objects that contain arbitrary instance variables" and malformed object trees in uploaded gemspecs: a guard against exactly this class of YAML attack, carrying the one exception that made this possible. The fix (commit 8b6fbba682ee, November 4, 2026, 13:09 UTC) deletes that one entry from the list.


What we cannot tell from the repository: when each commit actually reached production, and whether the push path was safer or less safe before February. So the honest statement is that the vulnerable list sat in public code for about nine months, and the exploitation review covered roughly the last one of them. The chain the maintainers demonstrated also depended on Ruby runtime bugs that were not public until Ruby's November 18 announcement; the advisory does not say whether the production upload workers ran a vulnerable Ruby build.



What changed on the registry


From the advisory's fix section:


  • Regexp-tagged gemspec fields are now rejected before they are turned into objects, with HTTP 422 and the message "expected no tag, but got "!ruby/regexp" path: /summary".

  • Gem metadata is now loaded with a restricted loader that refuses YAML aliases and allows only the classes a real gemspec uses: Gem::Specification, Gem::Version, Gem::Requirement, Gem::Dependency, Gem::Version::Requirement, Symbol, Time and Date.

  • Patterns in OIDC access policies are capped at 255 characters before compilation, as defense in depth.

The advisory credits Colby Swandale and dkw-oss as remediation developers. It names no outside finder.



It is not the only registry advisory this fall


The same repository has published a run of advisories since September, most of them about who is allowed to push what: a pending trusted publisher that let any account claim first-push ownership of a gem from someone else's repository (high, October 30), a default OIDC role policy that trusted every GitHub Actions workflow (high, November 3), gem-scoped API keys bypassed when republishing fully yanked gems (high, October 7), and an OIDC token-replay race (medium, November 27). None of those advisories reports exploitation either. Together they say the publishing path is getting a hard look, which is good news, and that "who can push" was softer than most Ruby shops assumed.


The pattern matches what Hex.pm disclosed last week, where a long-standing bug in the package registry itself was used to breach its servers. Registries are infrastructure now, and they get attacked like infrastructure.



What to do


  • Gem users: nothing is required by RubyGems.org. If you want your own guarantee rather than the registry's, run bundle lock --add-checksums so Gemfile.lock records each gem's checksum (Bundler's docs: checksums "are taken from the source's index, or computed from the .gem file of a gem installed on this machine"), commit the lockfile, and install with a frozen lockfile in CI. A gem whose contents change under an existing version will then fail the install instead of slipping in. This is general hygiene; nothing in the advisory says any published gem was altered.

  • Self-hosted RubyGems.org operators: update to a commit containing 8b6fbba682ee or later.

  • Anyone running Ruby: upgrade to 4.0.10, 3.4.13 or 3.3.14. Ruby 3.2 and earlier will not get those fixes. Apps that compile regexes from user input are the ones the Ruby advisory singles out.

  • Your own services: if you load YAML from strangers anywhere (Psych, any language's equivalent), this is the lesson: a schema check that skips a tag is a schema check with a hole, and the safe loader with an explicit class allowlist is the control that held after the fix.


Am I affected?


  1. Run ruby -v on your servers and build images. Anything in 4.0.0 through 4.0.9, 3.4.0 through 3.4.12, or 3.3.13 and earlier has the runtime bugs. That is the part on your side.

  2. Open Gemfile.lock and look for a CHECKSUMS section. If there is none, your installs trust whatever the registry serves for each locked version. That was always true; this advisory is a reason to change it.

  3. If you self-host the RubyGems.org app, check whether your deployed commit includes 8b6fbba682ee.

Did our edge see it? Not applicable. This attack is a gem push to RubyGems.org's own API. It never touches our sites, so there is nothing for an edge sensor or honeypot of ours to record, and we did not run an edge check. No indicators of compromise were published in the sources we read, so there is nothing to add to a blocklist.



What is not known


  • Whether anyone used this before November 4. The review covered October 5 to November 4 and the maintainers say earlier attempts cannot be ruled out.

  • Whether production upload workers were running a Ruby build vulnerable to the code execution half of the chain.

  • What an attacker on an upload worker could have reached.

  • Which Ruby regexp bug the chain used.


How we know


We read the GitHub security advisory GHSA-7h7w-m82c-x2xg through the GitHub API, the rubygems.org commit history for the validator file (commits 8ec1fe888fb0 and 8b6fbba682ee), the Ruby project's November 18 security announcement, Bundler's bundle lock documentation, and the other advisories in the rubygems.org repository, all on December 1, 2026. The Hacker News report (Swati Khandelwal, November 30) is where we first saw it; it is one source with the advisory, not a second confirmation.



Sources





Every indicator in this post is in the feed. Free.

1.58M+ IOCs, STIX 2.1 / TAXII, 88% novel vs ThreatFox, exploited-CVE leads ahead of CISA. No credit card — a free API key in 30 seconds, and you can audit every claim above against the live endpoints.


Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page