News
A RubyGems upload could compile an attacker's pattern on the registry (GHSA-7h7w-m82c-x2xg).
RubyGems.org fixed a critical flaw that let any account with a push-capable API key place an attacker-chosen regular expression in a gem upload, and maintainers reached code execution when they chained it with a Ruby regex bug in a local test.

Impact
- What was impacted
- RubyGems.org gem-upload handling, tracked as GHSA-7h7w-m82c-x2xg and scored 9.0. No CVE is assigned. The registry's metadata check treated a YAML tag for a regular expression as plain text, then Ruby's Psych library compiled the pattern before the registry checked that the account owned the gem name. In a local test on Ruby 4.0.9, maintainers chained this with a memory-corruption bug in Ruby's regexp compiler and reached code execution as the gem-upload worker. The advisory does not name which memory-corruption bug was used. On a Ruby build that is not vulnerable to code execution, compiling the pattern can still crash an upload worker or exhaust its memory.
- Who was impacted
- Anyone who holds a RubyGems.org API key that can push gems, and operators who self-host the RubyGems.org software. People who only install gems from the hosted registry are told they do not need to act on this registry flaw. Teams that run Ruby applications still have a separate job: the seven regexp and string flaws fixed on November 18.
- What you need to do
- If you only install gems from the hosted RubyGems.org registry, do nothing for this flaw. The hosted service now rejects regexp-tagged gemspec fields with HTTP 422, reads gem metadata with a restricted loader that refuses YAML aliases and allows only the classes a valid gemspec uses, and caps patterns in OIDC access policies at 255 characters before they are compiled. If you run your own copy of the RubyGems.org software, update to a commit that contains the fix. The validation change entered the public repository on November 4, 2026 (UTC). This report does not name the commit. Separately, install Ruby 4.0.10, 3.4.13, or 3.3.14 for the seven runtime flaws. Do not rotate publishing credentials because of this report: it does not say they were reached. A review of telemetry and 29,100 gems published from October 5 through November 4, 2026 found no direct evidence of exploitation. Logs were not kept long enough, and upload payloads were not recorded, so earlier attempts cannot be ruled out.
RubyGems.org, the central registry for Ruby gems, fixed a critical flaw tracked as GHSA-7h7w-m82c-x2xg and scored 9.0. No CVE is assigned. Any account with an API key that can push a gem could place an attacker-chosen regular expression in the metadata of an upload. The attacker did not need to own a gem name. The check that screens gem metadata ignored a YAML tag that marks a regular expression, so a field carrying that tag passed as plain text. Ruby's YAML library, Psych, then turned the field into a real regular expression and compiled the supplied pattern. That happened before the registry checked whether the account owned the gem name.
In local testing, the maintainers chained this flaw with a memory-corruption bug in Ruby's regexp compiler and reached remote code execution. The test ran on Ruby 4.0.9, a release affected by seven regexp and string flaws that the Ruby project patched on November 18. The advisory does not say which of those bugs the chain used. Code execution in the test ran with the privileges of the gem-upload worker, in a local environment. The advisory does not say whether an attacker who got that far could have reached published gems or publishing credentials. Even on a Ruby build that is not vulnerable to code execution, compiling an attacker's pattern can crash an upload worker or exhaust its memory.
A review of production telemetry and of 29,100 gems published between October 5 and November 4, 2026 found no direct evidence of exploitation. The advisory says the logs were not kept long enough and that upload payloads were not recorded, so earlier attempts cannot be ruled out. On the hosted service, schema validation now rejects regexp-tagged gemspec fields with an HTTP 422 error. Gem metadata is read with a restricted loader that refuses YAML aliases and allows only the classes a valid gemspec uses. Patterns in OIDC access policies are capped at 255 characters before they are compiled. The validation change entered the registry's public code repository on November 4, 2026 (UTC), three weeks before the disclosure. The registry hosts about 199,000 gems and has counted more than 278 billion downloads.
People who only install gems from the hosted registry do not need to do anything for this flaw. Operators who self-host the RubyGems.org software need a commit that contains the fix. This report does not name that commit. Ruby applications have a separate job: the seven runtime flaws are fixed in Ruby 4.0.10, 3.4.13, and 3.3.14. Those runtime builds are not a substitute for updating a self-hosted registry, and a registry update is not a substitute for those Ruby builds.
For your AI agent
Agent instructions — copy paste to Claude
You are helping me respond to GHSA-7h7w-m82c-x2xg on RubyGems.org and on any self-hosted copy of that registry software. Do not build a gemspec that carries a regular-expression YAML tag. Do not upload a gem, a yank, or a test payload to RubyGems.org or to a self-hosted registry to see if the flaw still works. Do not chain this with a Ruby regexp memory-corruption bug. Do not write a proof of concept. Ask before you upgrade Ruby, deploy a registry commit, restart a registry, rotate an API key, or take a host offline. Facts from the report: - RubyGems.org fixed a critical flaw that let any account with a push-capable API key feed an attacker-controlled regular expression into the metadata of a gem upload. The flaw is GHSA-7h7w-m82c-x2xg, scored 9.0. No CVE is assigned. Do not invent a CVE. - The registry reads gem metadata as YAML. The validator ignored the YAML tag that marks a regular expression, so a field with that tag passed schema checks as plain text. Ruby's Psych library then compiled the attacker's pattern. This ran before the registry checked whether the account owned the gem name. The attacker needed a push-capable API key and did not need to own a gem. Do not construct that tag. - In a local test on Ruby 4.0.9, the maintainers chained the flaw with a memory-corruption bug in Ruby's regexp compiler and reached remote code execution as the gem-upload worker. Ruby 4.0.9 is affected by seven regexp and string flaws patched on November 18. The advisory does not say which of those bugs the chain used. Do not guess an ID and do not build the chain. - The advisory does not say whether an attacker who reached code execution could have reached published gems or publishing credentials. Do not claim either outcome. - Even on a Ruby build that is not vulnerable to code execution, compiling an attacker's pattern can crash an upload worker or exhaust its memory. - A review of production telemetry and 29,100 gems published between October 5 and November 4, 2026 found no direct evidence of exploitation. Logs were not kept long enough, and upload payloads were not recorded, so earlier attempts cannot be ruled out. Do not treat the gap as proof that an attack happened. - On the hosted service, schema validation now rejects regexp-tagged gemspec fields with HTTP 422. Gem metadata is read with a restricted loader that refuses YAML aliases and allows only the classes a valid gemspec uses. Patterns in OIDC access policies are capped at 255 characters before they are compiled. - The validation change entered the registry's public code repository on November 4, 2026 (UTC), three weeks before disclosure. The report says self-host operators should update to a commit that contains the fix. It does not name the commit. Do not invent a hash, a tag, or a version number. - Gem users of the hosted registry are told to do nothing for this flaw. Do not tell them to reinstall gems or to rotate a gem-install token because of this report. - The seven Ruby runtime flaws are a separate fix, in Ruby 4.0.10, 3.4.13, and 3.3.14. A registry update does not replace those builds, and those builds do not replace a self-hosted registry update. - The registry hosts about 199,000 gems and has counted more than 278 billion downloads. That is scale, not a victim count. - Code execution in the maintainers' test was local and ran as the gem-upload worker. Do not reproduce the test. Context: - What was impacted: gem-upload handling on RubyGems.org, and the same software if you host it yourself. Gem installers on the hosted registry are told they have nothing to do for this flaw. - Who should care: holders of push-capable RubyGems API keys, and operators of a self-hosted RubyGems.org. Ruby application owners still need the November 18 runtime fixes if they are not already on 4.0.10, 3.4.13, or 3.3.14. - What to do: leave hosted-registry gem installs alone, update a self-hosted registry to a commit that contains the fix, and install one of the three named Ruby builds for the separate runtime flaws. Do not rotate publishing credentials on the basis of this report. Do this in order. Prefer read-only checks first. Ask before any change that upgrades Ruby, deploys a registry, restarts a service, rotates a key, or takes a host offline. 1. Inventory - Record whether we only install gems from the hosted RubyGems.org registry, whether we publish gems, and whether we run our own copy of the RubyGems.org software. Read only. - If we self-host, record the deployed commit and whether it is from November 4, 2026 (UTC) or later and includes the metadata validation fix. The report does not name the commit. If you cannot tell from the tree, say so. Do not upload a probe gem. - Record the Ruby version on registry hosts and on applications that compile regular expressions or change string case from outside input. The report names Ruby 4.0.10, 3.4.13, and 3.3.14 as the builds that fix the seven runtime flaws. Ruby 4.0.9 is the version used in the registry test and is affected. Do not invent a different safe build. - List push-capable API keys and who holds them. Do not print key values. This report does not say those keys were stolen. 2. Contain - For the hosted registry, do not propose a gem reinstall, a yank, or a key rotation. The report says gem users need to do nothing, and it does not say publishing credentials were reached. - If we self-host and the deployed commit is older than the November 4, 2026 validation change, or you cannot show that the fix is present, leave the service running until I agree. Propose updating to a commit that contains the fix. Ask before you deploy or restart. - Do not propose taking the registry offline unless I ask. 3. Remediate - After I agree, update a self-hosted registry to a commit that contains the fix described above. Do not invent the commit id. If the repository history does not make the fix obvious, stop and say what you need. - Separately, after I agree, install Ruby 4.0.10, 3.4.13, or 3.3.14 on hosts still running an affected runtime. Those three builds are the runtime fix. They are not the registry fix. - Do not rotate API keys, OIDC secrets, or publishing credentials unless I ask. This report does not say they were exposed. 4. Verify - Report the registry commit, the Ruby version, and whether any change is still waiting on my approval. - State that the hosted registry is described as fixed, that no direct evidence of exploitation was found in the October 5 to November 4 window, and that earlier attempts cannot be ruled out because logs and upload payloads were not retained. 5. Report back - What matched, what you changed, and what the advisory left unnamed: a CVE, the commit hash, which regexp bug was chained, and whether published gems or publishing credentials could have been reached. Do not invent CVEs, commit ids, patches, victim counts, or exploit steps. If a check needs access I have not given you, say what you need and stop.