# ruby2shell (CVE-2026-132825): One-Byte Heap Overflow in Ruby Case Conversion Could Allow RCE in Rails and Self-Hosted Apps

> CVE-2026-132825 is a one-byte heap-based buffer overflow in Ruby's string case conversion for single-byte legacy encodings (ISO-8859-x, Windows-125x): the German sharp s (0xDF) expands to 'SS' but only one output byte is reserved. Ruby 4.0.10, 3.4.13 and 3.3.14 (released 2026-11-18) fix it; the Ruby core team says non-public PoCs can trigger code execution in some scenarios, and no in-the-wild exploitation has been reported.

- **Published:** 2026-11-20T02:16:35Z
- **Last reviewed:** 2026-11-20T20:53:42.869Z
- **Canonical:** https://intel.threadlinqs.com/threat/TL-2026-6524
- **ID:** TL-2026-6524
- **Severity:** CRITICAL (CVSS 7.4)
- **Category:** VULNERABILITY
- **Status:** MONITORING
- **Detections:** 9 (1 shown free below) · **IOCs:** 23 (3 shown free below)
- **CVEs:** CVE-2026-132825

## Description

CVE-2026-132825 (GHSA-34m4-m9fh-gqp5, nicknamed 'ruby2shell' / 'ruby2ßhell') is a heap-based buffer overflow (CWE-122, with an off-by-one component, CWE-193) in the Ruby interpreter's string case-conversion code. When a string in a single-byte encoding such as ISO-8859-1, ISO-8859-2 (and other ISO-8859 variants), Windows-1250, Windows-1252, Windows-1254 or Windows-1257 contains the German sharp s (byte 0xDF), upcasing expands it to the two characters 'SS'. The conversion loop checked for only one byte of room in the output buffer (sized at input length plus 20 bytes per Veria Labs), so a crafted string writes one byte ('S', or 's' for case-folding) past the end of a heap buffer, followed by a one-byte out-of-bounds read. UTF-8 strings take a different code path and are not affected. The reachable methods are String#upcase, String#swapcase, String#downcase(:fold) and String#casecmp?. The vulnerable code has existed since Ruby 2.4.0.

Affected versions: Ruby 4.0.0-4.0.9, 3.4.0-3.4.12, and 3.3.13 and earlier. Fixed in 4.0.10, 3.4.13 and 3.3.14, all released 2026-11-18; the fix (upstream commit d582f8f per Veria) ensures two bytes of output space are available when the sharp s is converted. Ruby 3.2 and earlier are end of life and receive no fix. Linux distributions may ship backported fixes without changing the Ruby version string. Because the bug is in the interpreter, `bundle update` does not remediate it, and there is no official workaround.

The Ruby advisory (Ruby 2026-11-18, 'multiple vulnerabilities in Regexp and String case conversion') states that changing the case of a crafted string may allow remote code execution and that the Ruby team is aware of PoCs for some scenarios; credits are Stephan Lipp (Ada Logics) and Anthropic. Veria Labs claims first demonstration of RCE and says Rails and classic-style Sinatra apps are reachable by unauthenticated requests in default configuration (plain Rack is not exposed by default); that claim is not independently confirmed by the other sources, and NVD's secondary CVSS 3.1 vector is local (AV:L/AC:H) with a base score of 7.4 HIGH, while the Ruby core team rated the issue critical. A public research write-up (evenomn/CVE-2026-132825, dated 2026-11-19) reports only a local ASAN crash reproduction on Ruby 3.4.12 and heap-metadata corruption on glibc 2.31, states a full weaponization chain was designed but not executed, and says no remote delivery path was verified. Veria plans to publish its PoC on or after 2026-11-25 if vendors have not shipped fixes, which is likely to accelerate exploitation attempts.

Self-hosted software named as exposed includes GitLab (19.6.0 and earlier, no fix listed by Veria), GitHub Enterprise Server (3.22.5 and earlier, no fix listed), Chatwoot (4.20.0 and earlier, no fix listed), Mastodon (fixed in 4.7.6, 4.6.12, 4.5.22, 4.4.29), OpenProject (fixed in 17.9.8, 17.8.3) and Discourse (base image fixed in 2.0.20261119-0203). GitLab's omnibus-gitlab bumped Ruby to 3.3.14 and 3.4.13 on 2026-11-18. The same Ruby release also fixes six further memory-safety flaws tracked only by GHSA IDs (no CVEs assigned yet): GHSA-87fm-7w84-j2px (integer overflow in case conversion, heap overflow), GHSA-7x2q-68qv-6p8x (double free in regexp compilation, critical), GHSA-3p8q-wmhx-vm2w (heap overflow in regexp compilation, critical), GHSA-7whj-cfh7-xgm4 (heap overflow in Regexp#to_s), GHSA-wpqw-5qxg-m68r (OOB read in case-insensitive matching) and GHSA-pvgc-g7gj-pv6h (OOB read in case-insensitive backreference matching). CISA SSVC (via NVD) records exploitation 'none', automatable 'no', technical impact 'total'. No threat actor, malware or network IOCs are attributed in any source. Defender-level indicators are limited to version inventory and post-factum worker crashes ('Segmentation fault at 0x0' inside String#upcase-family frames); multipart request parts declaring legacy charsets are inherently suspicious per Veria.

## MITRE ATT&CK

- T1190 Exploit Public-Facing Application
- T1203 Exploitation for Client Execution
- T1499.004 Endpoint Denial of Service: Application or System Exploitation
- T1587.004 Develop Capabilities: Exploits
- T1588.005 Obtain Capabilities: Exploits
- T1059 Command and Scripting Interpreter
- T1059.004 Command and Scripting Interpreter
- T1105 Ingress Tool Transfer
- T1595.002 Active Scanning
- T1588.006 Obtain Capabilities: Vulnerabilities

## Free detection (Splunk SPL, Microsoft KQL, Sigma)

**ruby2shell: Ruby Worker Crash in String Case-Conversion Frames (CVE-2026-132825)** (`TL-2026-6524-SPL-001`)

Detects a Ruby worker crash ('Segmentation fault' / [BUG] dump) whose backtrace contains the case-conversion methods reachable by the CVE-2026-132825 (ruby2shell) one-byte heap overflow: String#upcase, String#swapcase, String#downcase(:fold) and String#casecmp?. Per Veria Labs this is the primary post-factum indicator of a failed or probing exploit attempt against Rails/Sinatra or self-hosted Ruby apps (GitLab, Mastodon, Discourse, OpenProject, Chatwoot). Repeated crashes from one host warrant immediate triage and a Ruby upgrade to 3.3.14 / 3.4.13 / 4.0.10.

- **Languages:** Splunk SPL, Microsoft KQL, Sigma
- **ATT&CK:** T1499.004, T1190, T1203
- **Data sources:** ruby_stderr, puma_logs, rails_production_log, container_logs
- **Severity:** high
- **Confidence:** high

### Splunk SPL

````spl
index=app sourcetype IN ("ruby:stderr","puma:stderr","rails:production","docker:json","syslog") earliest=-24h ```CVE-2026-132825 ruby2shell: crash dump naming case-conversion frames```
| search "Segmentation fault" ("String#upcase" OR "String#swapcase" OR "String#downcase" OR "String#casecmp?" OR "rb_str_upcase" OR "rb_str_casemap" OR "rb_str_casecmp_p")
| stats count as crash_count min(_time) as first_seen max(_time) as last_seen values(sourcetype) as sourcetypes by host
| eval cve="CVE-2026-132825", technique="T1499.004"
| convert ctime(first_seen) ctime(last_seen)
````

### Microsoft KQL

```kql
ContainerLogV2
| where TimeGenerated > ago(24h)
| where LogMessage has "Segmentation fault"
| where LogMessage has_any ("String#upcase","String#swapcase","String#downcase","String#casecmp?","rb_str_upcase","rb_str_casemap","rb_str_casecmp_p")
| summarize CrashCount=count(), FirstSeen=min(TimeGenerated), LastSeen=max(TimeGenerated) by Computer, PodName, ContainerName
| extend CVE="CVE-2026-132825"
```

### Sigma

```yaml
title: ruby2shell Ruby Crash In Case Conversion Frames CVE-2026-132825
id: 3b7f1c52-8d4e-4a6b-9c21-5e0a7d94b6a1
status: experimental
description: Detects Ruby segmentation-fault crash dumps containing String#upcase/swapcase/downcase/casecmp? frames, the post-factum indicator of CVE-2026-132825 (ruby2shell) exploitation attempts.
references:
    - https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/
    - https://nvd.nist.gov/vuln/detail/CVE-2026-132825
    - https://verialabs.com/ruby2shell/
    - https://orca.security/resources/blog/ruby2shell-ruby-heap-overflow-rce/
author: Threadlinqs Team
date: 2026/11/20
tags:
    - attack.impact
    - attack.t1499.004
    - attack.initial-access
    - attack.t1190
    - attack.execution
    - attack.t1203
    - cve.2026.132825
logsource:
    category: application
    product: ruby
detection:
    keywords_crash:
        - 'Segmentation fault'
    keywords_frame:
        - 'String#upcase'
        - 'String#swapcase'
        - 'String#downcase'
        - 'String#casecmp?'
        - 'rb_str_upcase'
        - 'rb_str_casemap'
    condition: keywords_crash and keywords_frame
falsepositives:
    - Unrelated native-extension crash that happens to be inside a case-conversion call
    - Memory-safety bugs from the six other GHSA flaws fixed in the same Ruby release (regexp compilation)
level: high

```

**Known false positives:**

- Unrelated native-extension crashes whose backtrace happens to include a case-conversion frame
- The other memory-safety flaws fixed in the same Ruby release (regexp compilation) can produce similar crashes
- Developers reproducing the public ASAN crash in a lab

**Tuning notes:** Point the index/sourcetype list at wherever Ruby stderr and Rails/Puma logs land (Docker/K8s JSON, journald, file monitors). Alert on a single event for internet-facing apps; baseline and raise to a threshold only for dev/test. Pivot on host to the web access logs for the preceding multipart POST. Enrich with the Ruby version (fixed: 3.3.14, 3.4.13, 4.0.10); distro backports keep the old version string.

### 8 more detection rules (Splunk SPL, Microsoft KQL, Sigma), unlock with TL Creds

- ruby2shell: HTTP Request Declaring Legacy Single-Byte Charset (ISO-8859-x / Windows-125x) (locked: unlock with TL Creds)
- ruby2shell: Ruby One-Liner Forcing Legacy Encoding and Case Conversion (PoC Reproduction) (locked: unlock with TL Creds)
- ruby2shell: Endpoint Fetching Public CVE-2026-132825 Research/PoC Repository (locked: unlock with TL Creds)
- ruby2shell: Kernel Segfault Logged for Ruby Runtime (libruby) (locked: unlock with TL Creds)
- ruby2shell: Ruby Worker Writing Executable, Web Shell or Persistence File (locked: unlock with TL Creds)
- ruby2shell: Reverse Shell Command Line from Ruby Process or Worker Child (locked: unlock with TL Creds)
- ruby2shell: Ruby Application Server Spawning Shell or Downloader (Post-Exploitation) (locked: unlock with TL Creds)
- ruby2shell: Ruby Worker Outbound Connection to Non-Standard Port (C2 / Reverse Shell) (locked: unlock with TL Creds)

Sign up free to unlock the detection rules: https://threadlinqs.com/?modal=signup

## Sample indicators (3 of 23)

Defanged, TLP:CLEAR.

- URL: `hxxps://github[.]com/evenomn/CVE-2026-132825`
- File hash: `b53eef3371fa5d3e3b74340edcd015f06d5d8853968d4e539a5264fce41ed9f1`
- File hash: `1537f7a6003c436546ecab6b48b6e7725a9af2328f45a8af7f42f41c5df90ab8`

Full set of 23 indicators unlocks with TL Creds: https://threadlinqs.com/tl-creds

## Sources

- [Orca Security: ruby2shell - One-Byte Heap Overflow in Ruby Could Allow Remote Code Execution in Rails and Popular Self-Hosted Apps](https://orca.security/resources/blog/ruby2shell-ruby-heap-overflow-rce/)
- [Ruby: Multiple vulnerabilities in Regexp and String case conversion (security advisory)](https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/)
- [Ruby 4.0.10 Released](https://www.ruby-lang.org/en/news/2026/11/18/ruby-4-0-10-released/)
- [NVD: CVE-2026-132825](https://nvd.nist.gov/vuln/detail/CVE-2026-132825)
- [Veria Labs: ruby2shell](https://verialabs.com/ruby2shell/)
- [omnibus-gitlab: Bump Ruby to 3.3.14 and 3.4.13](https://gitlab.com/gitlab-org/omnibus-gitlab/-/commit/8fcf9d6372da3fe553bd21c3beae70634d6ba936)
- [Ubuntu Security: CVE-2026-132825](https://ubuntu.com/security/CVE-2026-132825)
- [Semgrep detection-scripts PR #16: ruby2shell host detection toolkit](https://github.com/semgrep/detection-scripts/pull/16)
- [evenomn/CVE-2026-132825 research write-up (unvetted)](https://github.com/evenomn/CVE-2026-132825)
- [Ruby Security Announcements](https://www.ruby-lang.org/en/security/)

## Full data

The other 8 detection rules (Splunk SPL / Microsoft KQL / Sigma) unlock with TL Creds; a free account includes daily creds: https://threadlinqs.com/?modal=signup
Indicator values unlock with TL Creds, at a lower price on Red and Purple; AI agents can query rules and IOCs through the Threadlinqs MCP server (Purple and Gold in full, 2 calls a day on a free account): https://intel.threadlinqs.com/mcp

Canonical: https://intel.threadlinqs.com/threat/TL-2026-6524
