Skip to navigation

Threat reportVulnerabilityTL-2026-7066

Critical RubyGems.org Gem-Push Deserialization Vulnerability (GHSA-7h7w-m82c-x2xg, No CVE) via !ruby/regexp YAML Tag Enables Code Execution on Registry Servers

criticalPATCHED

A critical CWE-502 flaw in the RubyGems.org gem-push validator let any account holding a push-capable API key make Psych deserialize attacker-controlled gemspec fields into Ruby Regexp objects. Chained with a separate memory-corruption bug in Ruby's regexp compiler (Ruby 4.0.9), maintainers achieved code execution locally; they found no direct evidence of exploitation on the public registry, but log limits mean earlier attempts cannot be ruled out.

By

Key facts

IdentifiersTL-2026-7066, CVE-2017-0903
Also known asGHSA-7h7w-m82c-x2xg, RubyGems.org Gem Push RCE via !ruby/regexp
SeverityCRITICAL
CVSS9 (CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H)
EPSSCVE-2017-0903: 15.8% (97.5th percentile)
Affected productsRubyGems.org (Ruby Central) rubygems.org registry application (gem push API, POST /api/v1/gems); Ruby Ruby regexp compiler (memory-corruption bug chained for code execution in local testing)
Weaknesses (CWE)CWE-502
MalwareRuby
ToolsPsych
MITRE ATT&CK techniquesT1078 Valid Accounts, T1190 Exploit Public-Facing Application, T1195.002 Supply Chain Compromise: Compromise Software Supply Chain, T1499.004 Endpoint Denial of Service: Application or System Exploitation, T1587.004 Develop Capabilities: Exploits
MotivationUNKNOWN
Target sectorstechnology, software-supply-chain, open-source
Target regionsGlobal
Detection rules9 (1 shown free)
Sources6 cited sources

Detection coverage

As of 2026-11-30, Threadlinqs Intelligence publishes 9 detection rule(s) for TL-2026-7066 across Splunk SPL, Microsoft KQL and Sigma, covering 9 indicator(s) of compromise. The whole corpus is readable without an account. Every threat comes with one complete detection in Splunk SPL, Microsoft KQL and Sigma, free for everyone; a free account adds daily TL Creds to unlock the rest. Paid plans add a larger daily allowance, correlation and the MCP server. Threadlinqs MCP server · View plans.

Free detection: RubyGems.org Gem Push Tagged Gemspec (!ruby/regexp) Rejection - GHSA-7h7w-m82c-x2xg (SPL, Exploitation)

Detects POST /api/v1/gems activity in RubyGems.org application logs that carries the !ruby/regexp YAML tag or the patched validator's HTTP 422 'expected no tag, but got' error (GHSA-7h7w-m82c-x2xg, CWE-502, no CVE). On a fixed instance each hit is a rejected exploitation attempt; on an unfixed instance only logs that capture the payload will match. Per the advisory there is no evidence of in-the-wild exploitation and upload payloads were historically not logged, so treat hits as high-value leads rather than confirmed compromise. Groups by source and API-key owner to surface a push-capable key probing the validator.

  • Languages: Splunk SPL, Microsoft KQL, Sigma
  • ATT&CK: T1190, T1195.002, T1078, T1587.004
  • Data sources: rails_production_log, linux_syslog, ruby_on_rails_application_log
  • Severity: high
  • Confidence: high

Splunk SPL

index=rubygems sourcetype="rails:production" "/api/v1/gems" ("expected no tag, but got" OR "!ruby/regexp") | eval src=coalesce(clientip, src_ip, remote_ip, "unknown"), key_owner=coalesce(user, current_user, api_key_owner, "unknown") | stats count AS attempts, earliest(_time) AS first_seen, latest(_time) AS last_seen, values(status) AS http_status BY host, src, key_owner | convert ctime(first_seen) ctime(last_seen) | sort - attempts

Microsoft KQL

Syslog
| where TimeGenerated > ago(24h)
| where SyslogMessage has "/api/v1/gems"
| where SyslogMessage has_any ("expected no tag, but got", "!ruby/regexp")
| summarize Attempts = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated), Samples = make_set(substring(SyslogMessage, 0, 200), 5) by Computer, HostIP
| order by Attempts desc

Sigma

title: RubyGems.org Gem Push Tagged Gemspec Field (!ruby/regexp) Rejected
id: a1f3c7e2-5b8d-4e19-9c2a-7d4e6f1b8a30
status: experimental
description: Detects Rails application log entries for POST /api/v1/gems carrying the YAML tag !ruby/regexp or the HTTP 422 'expected no tag, but got' validator error (GHSA-7h7w-m82c-x2xg, CWE-502). Repeated hits suggest exploitation attempts against RubyGems.org registry instances.
references:
    - https://github.com/rubygems/rubygems.org/security/advisories/GHSA-7h7w-m82c-x2xg
author: Threadlinqs Team
date: 2026-11-30
tags:
    - attack.initial-access
    - attack.t1190
    - attack.t1195.002
    - attack.t1078
logsource:
    category: application
    product: ruby_on_rails
detection:
    keywords_endpoint:
        - '/api/v1/gems'
    keywords_tag:
        - 'expected no tag, but got'
        - '!ruby/regexp'
    condition: keywords_endpoint and keywords_tag
falsepositives:
    - Maintainers or researchers replaying the advisory test case
    - A developer whose tooling emits malformed gemspec tags
level: high

Known false positives:

  • Maintainers or security researchers replaying the advisory test case against a staging registry
  • Developers whose tooling emits a malformed or hand-edited gemspec that trips the same validator error

Tuning notes: Adjust index/sourcetype (rubygems / rails:production) to your Rails log pipeline and confirm the client-IP and API-key-owner field names. Make sure the application logs the 422 validator message; payload bodies were not logged upstream, so consider enabling gemspec metadata logging. Alert on attempts>=1 for any key, and raise priority when one key or source produces several distinct attempts (payload iteration, T1587.004 is inferred from this pattern). Exclude known staging hosts.

8 more detection rules (Splunk SPL, Microsoft KQL, Sigma) · unlock with TL Creds. Sign up free to unlock the detection rules or query them with the Threadlinqs MCP server (Purple and Gold in full, 2 calls a day on a free account)
  • [indicator] Gem Push Tagged [indicator] (!ruby/regexp) Rejection - GHSA-7h7w-m82c-x2xg (KQL, Exploitation) · unlock with TL Creds
  • [indicator] Gem Worker Spawning Shell/Download Tools or Crashing/OOM - GHSA-7h7w-m82c-x2xg (KQL, Post-Exploitation) · unlock with TL Creds
  • [indicator] Gem Worker Anomalous External Egress - GHSA-7h7w-m82c-x2xg (KQL, C2) · unlock with TL Creds
  • [indicator] Gem Push Tagged [indicator] (!ruby/regexp) Rejection - GHSA-7h7w-m82c-x2xg (Sigma, Exploitation) · unlock with TL Creds
  • [indicator] Gem Worker Spawning Shell/Download Tools - GHSA-7h7w-m82c-x2xg (Sigma, Post-Exploitation) · unlock with TL Creds
  • [indicator] Gem Worker Outbound Connection To Public Address - GHSA-7h7w-m82c-x2xg (Sigma, C2) · unlock with TL Creds
  • [indicator] Gem Worker Spawning Shell/Download Tools or Crashing/OOM - GHSA-7h7w-m82c-x2xg (SPL, Post-Exploitation) · unlock with TL Creds
  • [indicator] Gem Worker Anomalous External Egress / Beacon-Like Connections - GHSA-7h7w-m82c-x2xg (SPL, C2) · unlock with TL Creds

Indicators of compromise

As of 2026-11-30, Threadlinqs Intelligence tracks 9 indicators of compromise for TL-2026-7066.

9 indicators of compromise · unlock with TL Creds. Compare plans

Technical analysis

GHSA-7h7w-m82c-x2xg, published 2026-11-26 by the RubyGems.org maintainers, describes a gem-push remote code execution weakness in the RubyGems.org registry application (CVSS v4.0 9.0, CWE-502). No CVE was assigned. The advisory's package field lists 'bundler' (registry ecosystem rubygems) with a placeholder affected range of '-1' and no patched version; operators are told only to update to a commit containing the fix, and no commit hash is published.

Root cause: GemValidator::NodeInfo::IGNORED_TAGS included the YAML tag !ruby/regexp, so GemValidator::NodeInfo.read_tag returned nil for nodes carrying that tag. A gemspec string field (the advisory's example is summary) tagged with !ruby/regexp therefore passed schema validation as an ordinary untagged scalar. Afterwards gemspec_ast.to_ruby deserialized the field into a Regexp, compiling the attacker-supplied pattern. This occurs inside GemValidator::Package during POST /api/v1/gems, and validation plus deserialization run before Pusher checks gem ownership, so the ownership check did not protect against it.

Prerequisites: a RubyGems.org account with an API key that has push permission. Ownership of an existing gem is not required and no action by another user is needed. Impact: in local testing on Ruby 4.0.9, crafted regexp patterns were chained with a separate memory-corruption bug in Ruby's regexp compiler to achieve code execution with the privileges of the gem-upload worker process. Even on Ruby builds without that bug, attacker-controlled regexp compilation can crash a worker or exhaust its memory (denial of service). The advisory states the issue was reproduced locally, not against the live service, and no public PoC is described.

Fix: (1) !ruby/regexp was removed from IGNORED_TAGS so schema validation now rejects tagged fields before deserialization and returns HTTP 422 with an error of the form 'expected no tag, but got ...' plus the path (e.g. /summary); (2) unrestricted to_ruby calls in GemValidator::Package were replaced with safe_to_ruby, which uses Psych::ClassLoader::Restricted and Psych::Visitors::NoAliasRuby, refuses YAML aliases, disallows Ruby classes in checksums.yaml, and permits only Gem::Specification, Gem::Version, Gem::Requirement, Gem::Dependency, Gem::Version::Requirement, Symbol, Time and Date; (3) as defense in depth, OIDC::AccessPolicy string_matches patterns are capped at 255 characters before compilation and RegexpError during token exchange is converted to AccessError.

Exploitation evidence: maintainers reviewed production telemetry and the 29,100 gems published between 2026-10-05 and 2026-11-04 and found no direct evidence of exploitation. Log retention limits and the fact that upload payloads were not logged mean earlier attempts cannot be ruled out. Hosted RubyGems.org users need take no action; self-hosted operators should update to a revision containing the fix rather than wait for a patched gem release. The advisory lists no IOCs; the only concrete markers are the !ruby/regexp tag in gemspec fields and the HTTP 422 error text. A similar class of bug (CVE-2017-0903, unsafe YAML object deserialization in RubyGems) affected registry-side gem processing in 2017.

MITRE ATT&CK techniques by tactic:

Initial Access

T1078 Valid Accounts; T1190 Exploit Public-Facing Application; T1195.002 Supply Chain Compromise: Compromise Software Supply Chain

Impact

T1499.004 Endpoint Denial of Service: Application or System Exploitation

Resource Development

T1587.004 Develop Capabilities: Exploits

Remediation

Patches

  • Update to a rubygems.org commit that removes !ruby/regexp from GemValidator::NodeInfo::IGNORED_TAGS and uses safe_to_ruby in GemValidator::Package (no commit hash or patched version published in the advisory)

Immediate actions

  • Self-hosted RubyGems.org operators: update to a rubygems.org code revision that contains the fix; do not wait for a patched gem release
  • Review upload-worker and gem-push logs for HTTP 422 responses containing 'expected no tag, but got' and for gemspec YAML containing !ruby/regexp
  • Restrict and audit API keys with push scope; rotate keys that are unused or unrecognized

Workarounds

  • Hosted RubyGems.org: no user action required
  • No workaround documented for self-hosted instances other than applying the fix

Longer-term hardening

  • Use Psych restricted class loading (safe_to_ruby pattern with Psych::ClassLoader::Restricted and Psych::Visitors::NoAliasRuby) for all untrusted YAML
  • Log and retain uploaded package metadata long enough to support retrospective investigation
  • Run gem-processing workers with least privilege and memory/CPU limits to contain code execution and DoS
  • Cap and validate user-supplied regular expressions (for example OIDC access-policy string_matches limited to 255 characters)

Affected and fixed versions

  • RubyGems.org (Ruby Central) — rubygems.org registry application (gem push API, POST /api/v1/gems)
    Vulnerable versions: Revisions prior to the fix commit (advisory lists placeholder range '-1'; exact revisions not stated)
    Fixed in: A commit containing the fix (no commit hash published); hosted RubyGems.org already fixed
  • Ruby — Ruby regexp compiler (memory-corruption bug chained for code execution in local testing)
    Vulnerable versions: Ruby 4.0.9 (tested locally)

Timeline

Last updated · revalidated 1× · latest source

  • RubyGems publishes CVE-2017-0903 (unsafe YAML object deserialization), an earlier deserialization flaw that also affected registry-side gem processing
  • Start of the window of 29,100 published gems later reviewed by maintainers for signs of exploitation
  • End of the reviewed publication window; maintainers found no direct evidence of exploitation, but log retention limits and unlogged upload payloads prevent ruling out earlier attempts
  • Ruby 4.0.10, 3.4.13 and 3.3.14 released, fixing seven regex and string memory-safety flaws, including two critical regex-compilation RCE bugs (GHSA-7x2q-68qv-6p8x, GHSA-3p8q-wmhx-vm2w). A link to the RubyGems.org chain is not confirmed by the sources.
  • GHSA-7h7w-m82c-x2xg published on rubygems/rubygems.org (CVSS v4.0 9.0, CWE-502, no CVE); fix removes !ruby/regexp from IGNORED_TAGS and introduces safe_to_ruby
  • By advisory publication the fix (removal of !ruby/regexp from IGNORED_TAGS, safe_to_ruby, 255-character OIDC string_matches cap) is a commit on the hosted service; remediation developers credited are colby-swandale and dkw-oss, and no external reporter is named
  • Cyber Security News reports the flaw; hosted RubyGems.org users need no action and self-hosted operators should update to a revision containing the fix

Update history

Sources cited

Previous and next in vulnerability

AI-drafted from 6 cited sources; published ; last updated .

Threadlinqs Intelligence — Real-Time Threat Detection Platform

// threat_feed
$ sort --newest
Showing all threats

Live intelligence console

Threat level

Latest Threats