RubyGems.org parsed a push-time gem tag before deciding who owned it
RubyGems.org disclosed GHSA-7h7w-m82c-x2xg, a critical remote code execution issue in the registry's gem-upload path. A user with a push-capable API key could place an attacker-controlled !ruby/regexp object in gemspec metadata. The upload validator deserialized it before the ownership check completed. In local testing on Ruby 4.0.9, the maintainers chained the issue with a regexp compiler memory-corruption bug and reached code execution in the gem-upload worker.
The prerequisite is authentication, but the account does not need to own the gem being pushed. That changes the review from "who has admin access" to "which API keys can reach the upload workflow". Package registries accept automation credentials by design, and many of those credentials belong to CI jobs, maintainers, bots or cached local scripts.
The hosted RubyGems.org service was fixed. Operators of self-hosted Gemcutter or other registry implementations need to confirm that they run updated code and that their upload workers cannot deserialize rich Ruby objects from untrusted metadata. Updating a development dependency is not enough if the registry server image remains unchanged.
Review upload-worker isolation. The worker should not have broad access to signing keys, source repositories, mail relays or customer systems. A service account with only the data needed for the current push limits the value of code execution. Rotate push credentials that were used during an uncertain window, especially long-lived CI keys with ownership across multiple gems.
Logs should connect pushes, API-key identity and worker process activity. Look for rejected or unusual gem metadata, regexp objects in gemspecs, unexpected child processes, outbound connections and access to signing material. A successful push alone is not proof of exploitation, but it is a useful scope boundary when paired with suspicious worker behavior.
The fix also belongs in code review practice. A parser that accepts rich object types is an execution surface even when the input arrives inside a package field. Prefer scalar-only parsing for metadata, enforce ownership before expensive validation and test with hostile types rather than only malformed text.
References
- GitHub security advisory: https://github.com/rubygems/rubygems.org/security/advisories/GHSA-7h7w-m82c-x2xg
- The Hacker News summary: https://thehackernews.com/2026/11/critical-rubygems-flaw-could-have-let.html

