Skip to navigation

Threat reportVulnerabilityTL-2026-7070

Critical RubyGems.org Gemspec YAML Regexp Deserialization Flaw Could Have Allowed Code Execution on the Registry (GHSA-7h7w-m82c-x2xg)

criticalPATCHED

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.

By

Key facts

IdentifiersTL-2026-7070, CVE-2024-35221
Also known asGHSA-7h7w-m82c-x2xg
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)
First disclosed
EPSSCVE-2024-35221: 0.8% (56.1th percentile)
Affected productsRubyGems RubyGems.org (self-hosted deployments); Ruby Ruby (regexp compiler, chained memory corruption)
Weaknesses (CWE)CWE-502
MalwareRuby
ToolsPsych
MITRE ATT&CK techniquesT1059 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
MotivationUNKNOWN
Target sectorstechnology, software-supply-chain, open-source
Target regionsGlobal
Detection rules9 (1 shown free)
Sources7 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_pushes

Microsoft 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, LastSeen

Sigma

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: medium

Known 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.

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] 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.

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

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

Previous and next in vulnerability

AI-drafted from 7 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