Threat reportVulnerabilityTL-2026-7070
Critical RubyGems.org Gemspec YAML Regexp Deserialization Flaw Could Have Allowed Code Execution on the Registry (GHSA-7h7w-m82c-x2xg)
RubyGems.org fixed a critical flaw in gem metadata YAML parsing: the schema validator ignored the !ruby/regexp tag, so attacker-supplied patterns were compiled by Ruby's Psych library. Any account with a push-capable API key could trigger it without owning a gem, and chained with a Ruby regexp-compiler memory corruption bug on Ruby 4.0.9 it reached code execution in maintainers' local testing.
Key facts
| Identifiers | TL-2026-7070, CVE-2024-35221 |
|---|---|
| Also known as | GHSA-7h7w-m82c-x2xg |
| Severity | CRITICAL |
| CVSS | 9 (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) |
| First disclosed | |
| EPSS | CVE-2024-35221: 0.8% (56.1th percentile) |
| Affected products | RubyGems RubyGems.org (self-hosted deployments); Ruby Ruby (regexp compiler, chained memory corruption) |
| Weaknesses (CWE) | CWE-502 |
| Malware | Ruby |
| Tools | Psych |
| MITRE ATT&CK techniques | T1059 Command and Scripting Interpreter, T1078 Valid Accounts, T1190 Exploit Public-Facing Application, T1195.002 Compromise Software Supply Chain, T1499.004 Endpoint Denial of Service: Application or System Exploitation |
| Motivation | UNKNOWN |
| Target sectors | technology, software-supply-chain, open-source |
| Target regions | Global |
| Detection rules | 9 (1 shown free) |
| Sources | 7 cited sources |
Detection coverage
As of 2026-11-30, Threadlinqs Intelligence publishes 9 detection rule(s) for TL-2026-7070 across Splunk SPL, Microsoft KQL and Sigma, covering 4 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 Rejected With HTTP 422 - Regexp-Tagged Gemspec Probe (GHSA-7h7w-m82c-x2xg)
Exploitation-phase detection for self-hosted RubyGems.org instances. The fixed registry rejects gem push uploads whose gemspec carries a !ruby/regexp YAML tag with HTTP 422 (GHSA-7h7w-m82c-x2xg, CWE-502). Repeated 422 responses on POST /api/v1/gems from one client in an hour is the best web-tier signal of probing for the Psych regexp deserialization path, because the flaw is reachable with any push-capable API key before the ownership check. Unpatched instances will not return 422, so this also serves as a hunt for pre-patch probing once the fix is deployed. Exploitation is rated THEORETICAL and no in-the-wild abuse is confirmed; payloads are not in access logs, so treat hits as leads to be confirmed against upload logs.
- Languages: Splunk SPL, Microsoft KQL, Sigma
- ATT&CK: T1190, T1195.002, T1078
- Data sources: web:access_combined (nginx/Apache in front of self-hosted rubygems.org), azure_application_gateway_access_log
- Severity: medium
- Confidence: medium
Splunk SPL
index=web sourcetype=access_combined method=POST uri_path="/api/v1/gems" status=422 earliest=-24h | bin _time span=1h | stats count AS rejected_pushes dc(uri_path) AS distinct_paths values(useragent) AS user_agents min(_time) AS first_seen max(_time) AS last_seen BY clientip, _time | where rejected_pushes>=3 | eval threat_id="TL-2026-7070", advisory="GHSA-7h7w-m82c-x2xg", first_seen=strftime(first_seen,"%F %T"), last_seen=strftime(last_seen,"%F %T") | table threat_id advisory _time clientip rejected_pushes distinct_paths user_agents first_seen last_seen | sort - rejected_pushesMicrosoft KQL
AzureDiagnostics
| where TimeGenerated > ago(24h)
| where Category == "ApplicationGatewayAccessLog"
| where httpMethod_s == "POST" and requestUri_s startswith "/api/v1/gems" and httpStatus_d == 422
| summarize RejectedPushes = count(), UserAgents = make_set(userAgent_s, 5), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by clientIP_s, bin(TimeGenerated, 1h)
| where RejectedPushes >= 3
| project TimeGenerated, clientIP_s, RejectedPushes, UserAgents, FirstSeen, LastSeenSigma
title: RubyGems.org Gem Push Rejected With HTTP 422 (Regexp-Tagged Gemspec Probe)
id: 3b1f6c52-8a4e-4d7b-9c21-5e0a7d4f1b83
status: experimental
description: Detects POST requests to the RubyGems.org gem push endpoint answered with HTTP 422, the response the fixed registry returns for gemspec fields carrying the !ruby/regexp YAML tag (GHSA-7h7w-m82c-x2xg). Aggregate by client in the SIEM (3 or more per hour) to reduce noise from ordinary invalid pushes.
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: webserver
detection:
selection:
cs-method: 'POST'
cs-uri-stem|startswith: '/api/v1/gems'
sc-status: 422
condition: selection
falsepositives:
- Maintainers pushing gems with malformed or invalid gemspec metadata
- CI pipelines with a misconfigured gem build
level: mediumKnown false positives:
- Legitimate maintainers pushing gems with malformed gemspec metadata (any validation failure returns 422)
- CI/CD pipelines retrying a failing gem push in a loop
Tuning notes: Adjust the index/sourcetype to your reverse-proxy log source and the 3-per-hour threshold to your push volume. Exclude known CI egress IPs. Pivot on the API key or account ID in the Rails push log, since access logs do not carry the key. Only the fixed registry returns 422 for this tag, so deploy the fix commit first.
- [indicator] Application Log - !ruby/regexp Tag or Restricted YAML Loader Rejection · unlock with TL Creds
- [indicator] Worker Crash, Segfault or OOM Kill - Regexp Memory Corruption or Resource Exhaustion · unlock with TL Creds
- [indicator] Upload Worker Beaconing - Regular Outbound Connections With Low Jitter · unlock with TL Creds
- [indicator] OIDC AccessPolicy Regexp Error or Oversized Pattern (Trusted Publishing) · unlock with TL Creds
- [indicator] Upload Worker Spawning Download, Netcat or Persistence Tooling · unlock with TL Creds
- Reverse Shell Command Lines From Ruby Worker Host (dev/tcp, TCPSocket, mkfifo, nc -e) · unlock with TL Creds
- [indicator] Upload Worker Spawning a Shell Interpreter (Post-Exploitation of Regexp Chain) · unlock with TL Creds
- [indicator] Upload Worker Outbound Connection to Public IP (Post-Exploitation Callback) · unlock with TL Creds
Indicators of compromise
As of 2026-11-30, Threadlinqs Intelligence tracks 4 indicators of compromise for TL-2026-7070.
Technical analysis
GHSA-7h7w-m82c-x2xg (published 2026-11-26 by the RubyGems.org maintainers, no CVE assigned) describes an authenticated remote code execution path in the RubyGems.org gem push pipeline. The gemspec metadata validator kept !ruby/regexp on its IGNORED_TAGS list, so a field carrying that YAML tag passed schema validation as plain text. Psych's to_ruby then deserialized the field into a real Regexp object, compiling an attacker-controlled pattern (CWE-502, Deserialization of Untrusted Data).
This validation ran before the registry checked whether the pushing account owned the gem name. Any account holding a push-capable API key could therefore reach the code path; no ownership of any existing gem was required. On its own, compiling a malicious pattern could crash an upload worker or exhaust its memory, even on non-vulnerable Ruby builds. On Ruby 4.0.9, the maintainers chained it with a memory corruption bug in the Ruby regexp compiler and reached code execution with upload worker privileges in local testing. The chain was not reproduced against the live service, and the advisory does not identify which memory corruption bug was used.
Remediation in the RubyGems.org codebase: !ruby/regexp was removed from IGNORED_TAGS so regexp-tagged gemspec fields are rejected with HTTP 422; to_ruby was replaced by a restricted safe_to_ruby loader that refuses YAML aliases, blocks Ruby classes in checksums.yaml and allows only specific Gem and core classes; and OIDC::AccessPolicy string_matches patterns are capped at 255 characters, with RegexpError converted to AccessError. The schema validation change entered the public repository on 2026-11-04 (UTC). The hosted registry is fixed and gem users need no action; self-hosted operators must update to a commit containing the fix.
Exploitation status: a review of 29,100 gems published between 2026-10-05 and 2026-11-04 found no direct evidence of exploitation, but log retention was limited and upload payloads were not recorded, so earlier attempts cannot be ruled out. The advisory does not say whether an attacker could have reached published gems or publishing credentials. Separately, on 2026-11-18 the Ruby project patched seven regexp and string case-conversion memory-safety flaws (fixed in Ruby 4.0.10, 3.4.13 and 3.3.14), five of which have RCE PoCs; Ruby operators should update regardless of registry fix status. The advisory scores the flaw CVSS v4.0 9.0.
MITRE ATT&CK techniques by tactic:
Execution
T1059 Command and Scripting Interpreter
Initial Access
T1078 Valid Accounts; T1190 Exploit Public-Facing Application; T1195.002 Compromise Software Supply Chain
Impact
T1499.004 Endpoint Denial of Service: Application or System Exploitation
Remediation
Patches
- RubyGems.org commit removing !ruby/regexp from IGNORED_TAGS, adding safe_to_ruby and the 255-character OIDC pattern cap
- Ruby 4.0.10, 3.4.13, 3.3.14
Immediate actions
- Hosted RubyGems.org is already fixed; gem consumers need take no action
- Self-hosted RubyGems.org operators: update to a commit containing the fix (schema validation committed 2026-11-04 UTC)
- Upgrade Ruby to 4.0.10, 3.4.13 or 3.3.14 to remediate the seven regexp/case-conversion flaws patched 2026-11-18
Workarounds
- None listed in the advisory
Longer-term hardening
- Retain upload logs and record gem push payloads so past exploitation attempts can be assessed
- Never compile attacker-controlled regular expressions without length caps and timeouts
- Use restricted YAML loaders (no aliases, class allow-lists) for untrusted metadata
- Migrate off end-of-life Ruby 3.2 and earlier, which will not receive fixes
Affected and fixed versions
- RubyGems — RubyGems.org (self-hosted deployments)
Vulnerable versions: Deployments without the fix commit (advisory lists no explicit range)
Fixed in: Commit containing safe_to_ruby / !ruby/regexp rejection, 2026-11-04 UTC - Ruby — Ruby (regexp compiler, chained memory corruption)
Vulnerable versions: 4.0.0-4.0.9 (4.0.9 used in testing); 3.4.0-3.4.12; 3.3.13 and earlier
Fixed in: 4.0.10; 3.4.13; 3.3.14
Timeline
- Start of the telemetry review window: 29,100 gems published between 2026-10-05 and 2026-11-04 were later reviewed and showed no direct evidence of exploitation
- Schema validation change (reject !ruby/regexp, restricted YAML loader, 255-character OIDC pattern cap) entered the public rubygems.org repository (UTC)
- Ruby project announced fixes for seven regexp and string case-conversion flaws in Ruby 4.0.10, 3.4.13 and 3.3.14
- Ruby security announcement recorded as originally published at 2026-11-19 00:00 UTC
- RubyGems.org maintainers published GHSA-7h7w-m82c-x2xg (CVSS v4.0 9.0, CWE-502, no CVE)
- The Hacker News reported the flaw; logs and upload payloads were not retained, so earlier exploitation attempts cannot be ruled out
Sources cited
- GHSA-7h7w-m82c-x2xg: Authenticated RCE in RubyGems.org gem pushes via !ruby/regexp gemspec tags GitHub · Advisory · 2026-11-26
- CVE-2024-35221: RubyGems.org YAML alias denial of service in gem metadata (related prior issue) NVD (NIST) · Advisory
- GHSA-mqwr-4qf2-2hcv: Unsafe YAML deserialization in RubyGems via gem spec class allow-list bypass (related prior issue) cve.circl.lu · Advisory
- Multiple vulnerabilities in Regexp and String (Ruby security announcement) ruby-lang.org · Vendor report · 2026-11-18
- RubyGems.org statistics rubygems.org · Research
- Critical RubyGems Flaw Could Have Let Any Gem Publisher Run Code on the Registry The Hacker News · News · 2026-11-30
- Ruby Releases Fixes for 7 Regex and Case Conversion Flaws The Hacker News · News
Previous and next in vulnerability
- Critical RubyGems.org Gem-Push Deserialization Vulnerability (GHSA-7h7w-m82c-x2xg, No CVE) via !ruby/regexp YAML Tag Enables Code Execution on Registry Servers Previous report
- RabbitMQ Management Plugin OAuth2 Token Proxy Missing Authentication (GHSA-cfvg-5q96-8mhm) Allows Unauthenticated Admin Access Next report
AI-drafted from 7 cited sources; published ; last updated —.