RubyGems.org fixes critical GHSA-7h7w-m82c-x2xg YAML regexp deserialization flaw enabling upload-worker RCE; no exploitation found
Matéria consolidada. Reúne 3 matérias que o Tifon tinha publicado separadamente sobre a mesma história. A IA reescreveu o relatório com o que as 3 fontes trouxeram em 30/11/2026 12:04; os links antigos trazem para cá.
Fontes: gbhackers.com ↗ thehackernews.com ↗ securityonline.info ↗
RubyGems.org fixed a critical flaw tracked as GHSA-7h7w-m82c-x2xg (CVSS 9.0; CVSS v4 per gbhackers.com), disclosed in an advisory on November 26, 2026. Any account holding a push-capable API key could send gem metadata that triggered unsafe YAML deserialization of a regular expression on the upload service, before gem ownership checks ran (securityonline.info, thehackernews.com). Maintainers chained it with a memory corruption bug in Ruby's regex compiler to achieve remote code execution on Ruby 4.0.9, but only in local testing, not against the live registry (gbhackers.com). A review of production telemetry and 29,100 gems pushed from October 5 to November 4, 2026 found no direct evidence of exploitation. Short log retention and unlogged upload payloads mean earlier attempts cannot be ruled out (thehackernews.com, gbhackers.com). No CVE has been assigned and no public exploit code exists (securityonline.info). The hosted registry is patched, so gem users and authors need to do nothing, while self-hosted registries running earlier commits remain exposed.
Entenda a falha
A vulnerabilidade
GHSA-7h7w-m82c-x2xg (no CVE, CVSS 9.0; CVSS v4 per gbhackers.com) is an unsafe YAML deserialization flaw (CWE-502) in the RubyGems.org gem upload service. Any account with a push-capable API key could send gem metadata that made Psych build an attacker-supplied regular expression, before gem ownership was checked. Maintainers chained it with a memory corruption bug in Ruby's regex compiler to get code execution as the upload worker on Ruby 4.0.9, but only in local testing, not against the live registry. On builds where that chain does not apply, crafted patterns can still crash workers or exhaust memory. The hosted registry is fixed; self-hosted deployments running commits before the fix remain exposed. No version range is given.
Como funciona
An authenticated user pushes a gem to the upload endpoint, and its gemspec carries YAML metadata. The validator checks the YAML tree against a schema, but it ignored the !ruby/regexp tag, so a tagged text field such as summary passed as plain text. The host then converted the YAML into Ruby objects, and Psych built a live Regexp and compiled the attacker's pattern. This happened before the Pusher checked ownership. Compiling is where it goes wrong: in the local test a memory corruption bug in the regex compiler let code run in the worker, while elsewhere it could crash the worker or exhaust memory.
Por que é vulnerável
The root cause is a mismatch between the validator and the parser: the validator treated the regexp tag as ignorable plain text, while Psych, called through an unrestricted to_ruby conversion, turned it into a real object. Deserialization also ran before the ownership check, so any push key reached it. The fix removes the regexp tag from the ignored list so such fields return HTTP 422, and replaces to_ruby with safe_to_ruby, which blocks YAML aliases and allows only the classes a valid gemspec needs. It also disallows Ruby classes in the checksum file, caps OIDC access policy patterns at 255 characters and handles invalid patterns differently during token exchange.
Onde está
The push endpoint POST /api/v1/gems: GemValidator::Package, GemValidator::NodeInfo::IGNORED_TAGS (which listed !ruby/regexp), the gemspec_ast.to_ruby call (now safe_to_ruby), the Pusher ownership check and OIDC::AccessPolicy; the validation change entered the public repository on November 4 (UTC).
Como foi descoberta
The articles do not say who found the flaw or how. The advisory was published on November 26, 2026, and the validation change had entered the public repository on November 4, about three weeks earlier. Maintainers reviewed production telemetry and 29,100 gems pushed from October 5 to November 4, 2026, and found no direct evidence of exploitation. Earlier attempts cannot be ruled out because log retention was short and upload payloads were not logged.
PoC existente, privada
O exploit existe, mas quem o tem não o publicou.
Maintainers demonstrated remote code execution in local testing on Ruby 4.0.9, chaining the validation flaw with a memory corruption bug in Ruby's regex compiler, with the upload worker's privileges. It was not reproduced against the live registry, and the advisory does not say which memory bug was used. securityonline.info states that no public exploit code exists, so treat it as a private demonstration. Self-hosted operators should still patch promptly, since the flaw needs only a push-capable API key.
Explicação gerada por IA a partir da matéria e dos artigos, em 30/11/2026 12:19.
Detalhes técnicos
- Weakness: CWE-502, unsafe deserialization (securityonline.info).
GemValidator::NodeInfo::IGNORED_TAGSlisted!ruby/regexp, so a tagged text field such assummarypassed schema validation as plain text (securityonline.info, thehackernews.com).- The host then called
gemspec_ast.to_ruby, so Psych built and compiled a live Regexp beforePusherchecked ownership. The attacker therefore needed only a push-capable API key, not ownership of any gem (securityonline.info, thehackernews.com). - The validator and Psych interpreted the same gemspec YAML differently (gbhackers.com).
- The test ran on Ruby 4.0.9, which is affected by seven regexp-engine and string case-conversion flaws that Ruby patched on November 18. The advisory does not say which memory corruption bug the chain used (thehackernews.com).
- On builds not vulnerable to code execution, crafted patterns could still crash workers or exhaust memory (securityonline.info, gbhackers.com, thehackernews.com).
- Code execution ran with the privileges of the upload worker in a local environment. The advisory does not say whether an attacker could have reached published gems or publishing credentials (thehackernews.com).
- The flaw affects server-side processing, not gem installation on developer machines. It is separate from the GemStuffer campaign, which abused documentation generation (gbhackers.com).
Remediação
- Gem users and authors on RubyGems.org: no action needed (all sources).
- Self-hosted operators: update to a commit that includes the fix. Updating application dependencies does not apply it (gbhackers.com).
- The fix removes
!ruby/regexpfromIGNORED_TAGS, so regexp-tagged fields now return HTTP 422. It replacesto_rubywithsafe_to_ruby, which blocks YAML aliases and allows only the classes a valid gemspec needs, and disallows Ruby classes in the checksum file. It also capsOIDC::AccessPolicyregex patterns at 255 characters and handles invalid patterns differently during token exchange (securityonline.info, gbhackers.com, thehackernews.com). - The validation change entered the public repository on November 4 (UTC), about three weeks before disclosure (thehackernews.com).
- Ruby applications: upgrade to Ruby 4.0.10, 3.4.13 or 3.3.14, released November 18, 2026, which fix the seven runtime flaws (securityonline.info, thehackernews.com).
Linha do tempo
-
RubyGems.org upload service YAML deserialization flaw (GHSA-7h7w-m82c-x2xg) allowed RCE in local testing; fixed, no exploitation found
ler a análise desta fonte ocultar
RubyGems.org disclosed a critical flaw in its package upload service. An authenticated account holding a publishing API key could reach a vulnerable gem-metadata parser without owning an existing gem. The advisory, published November 26, 2026, rates it CVSS v4 9.0 and tracks it as GHSA-7h7w-m82c-x2xg. No CVE is listed. Maintainers demonstrated remote code execution only in local testing on Ruby 4.0.9 and did not reproduce it against the live registry. A review of production telemetry and 29,100 gems published from October 5 to November 4, 2026 found no direct evidence of exploitation, but log retention was limited and upload payloads were not logged. This article is the only source used, and no vendor page was opened.
Technical Details
The registry validator and Ruby's Psych parser interpreted the same gem specification YAML differently. Metadata that passed validation as plain text became a regular expression during deserialization. The local demonstration chained this with a memory corruption bug in Ruby's regex compiler to run code with the upload worker's privileges. On builds where that chain did not apply, compiling untrusted patterns could still crash a worker or exhaust its memory. The flaw affects server-side processing, not gem installation on developer machines. It is separate from the GemStuffer campaign, which abused documentation generation.
Remediation
The fix makes the validator reject regex tags before deserialization. It replaces unrestricted object conversion with a restricted parser that blocks YAML aliases, disallows Ruby classes in the checksum file and permits only the classes a valid gem specification needs. Regex patterns in OIDC access policies are now limited to 255 characters, and invalid patterns are handled differently during token exchange. Users of hosted RubyGems.org need to do nothing. Operators of self-hosted deployments must update to a commit that includes the fix, because updating application dependencies does not apply it.
-
RubyGems.org fixes critical YAML regexp flaw (GHSA-7h7w-m82c-x2xg) enabling code execution on the registry via gem metadata
ler a análise desta fonte ocultar
RubyGems.org fixed a critical flaw, tracked as GHSA-7h7w-m82c-x2xg (CVSS 9.0, no CVE assigned), that let any account with a push-capable API key feed an attacker-controlled regular expression into gem upload metadata. In local testing the maintainers chained it with a memory corruption bug in Ruby's regexp compiler and reached remote code execution. A review of production telemetry and 29,100 gems published between October 5 and November 4 found no direct evidence of exploitation. Logs were retained too briefly and upload payloads were not recorded, so earlier attempts cannot be ruled out. The hosted registry is fixed and gem users need to take no action. This summary is based on the article alone; no additional sources were researched.
Technical Details
The gemspec metadata validator ignored the
!ruby/regexpYAML tag, so a tagged field passed schema checks as plain text. Psych, Ruby's YAML library, then turned it into a real regular expression and compiled the attacker's pattern. This ran before the registry checked gem name ownership, so the attacker needed no gem of their own, only a push-capable API key. The test ran on Ruby 4.0.9, which is affected by seven flaws in the regexp engine and string case conversion that the Ruby project patched on November 18. The advisory does not say which memory corruption bug the chain used. Even on a Ruby build not vulnerable to code execution, compiling an attacker's pattern can crash an upload worker or exhaust its memory. The 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 could have reached published gems or publishing credentials.Fix Details
The validation change entered the public repository on November 4 (UTC), about three weeks before disclosure. 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 compilation.
Remediation
- Gem users: no action needed.
- Self-hosters of the RubyGems.org software: update to a commit containing the fix.
- Ruby applications: the seven runtime flaws are fixed in Ruby 4.0.10, 3.4.13 and 3.3.14.
-
RubyGems.org push API flaw (GHSA-7h7w-m82c-x2xg): unsafe YAML deserialization enables RCE on upload workers; hosted site patched
ler a análise desta fonte ocultar
RubyGems.org fixed a critical flaw (CVSS 9.0 per the article) tracked as GHSA-7h7w-m82c-x2xg on November 26, 2026. Any user holding a push API key could trigger unsafe YAML deserialization at
POST /api/v1/gemsbefore gem ownership checks ran. On Ruby 4.0.9, staff chained it with a regex compiler memory bug to run code in the upload worker. Staff tested this chain only locally. The hosted service is already patched. Self-hosted registries running earlier commits are exposed. No CVE ID has been assigned. Per the advisory, a review of live logs and 29,100 gems pushed from October 5 to November 4, 2026 found no evidence of exploitation, though short log retention cannot rule out earlier attempts. No public exploit code exists. This summary rests on the article alone, because no web research was done.Technical Details
- Weakness: CWE-502.
GemValidator::NodeInfo::IGNORED_TAGSlisted!ruby/regexp, so schema validation let a text field such assummarythrough.- The host then called
gemspec_ast.to_ruby, so Psych built and compiled a live Regexp beforePusherchecked ownership. - Even on patched Ruby builds, crafted patterns could crash workers or exhaust memory.
- Prerequisite: a valid push API key. No gem ownership is needed.
Remediation
- Gem users and authors on RubyGems.org do not need to act.
- Self-hosted operators should pull the latest fix commit.
- The fix removes
!ruby/regexpfromIGNORED_TAGS, so bad tags now return HTTP 422. It also replacesto_rubywithsafe_to_ruby, which blocks YAML aliases and limits classes. Finally, it capsOIDC::AccessPolicymatch rules at 255 characters. - Upgrade Ruby to 4.0.10, 3.4.13 or 3.3.14. These releases, published November 18, 2026, fix seven regex and string memory bugs.