---
title: "Ruby2Shell: Heap Overflow in Ruby's String Case Conversion"
url: https://erroneo.us/security/briefs/ruby2shell-ruby-case-conversion-overflow-cve-2026-132825/
description: "A one-byte heap overflow in Ruby's string upcase is reachable pre-auth in default Rails. Fixed in 4.0.10, 3.4.13, 3.3.14. Not exploited; patch before Nov 25."
type: security-brief
section: "Security Digest"
date_published: 2026-11-18
date_modified: 2026-11-21
publisher: erroneo.us
author: erroneo.us Security Desk
verdict: "Patch this week"
cves: ["CVE-2026-132825"]
severity: "critical"
exploited: "none-known"
kev: false
license: All rights reserved. Quote with attribution and a link.
---

# Ruby2Shell: Heap Overflow in Ruby's String Case Conversion

**Verdict: Patch this week.** Upgrade Ruby on every server and image before November 25, when a remote exploit for stock Rails is due to go public: the trigger needs no login in default Rails, but turning it into code execution is hard and nobody has been seen doing it.

- **Who must act:** Teams running Rails (other than API-only apps), classic-style Sinatra or other Rack apps on Ruby before 3.3.14, 3.4.13 or 4.0.10, and admins of products that bundle Ruby, such as GitHub Enterprise Server, GitLab, Mastodon, OpenProject, Chatwoot and Discourse.
- **Who can relax:** GitLab.com users, since GitLab says it has already remediated the service, and developers who only run Ruby locally for scripts that never change the case of untrusted text; they can upgrade on their normal schedule.
- **Affected:** Ruby 3.3.13 and earlier; Ruby 3.4.0 through 3.4.12; Ruby 4.0.0 through 4.0.9; Ruby 3.2 and earlier back to 2.4.0 (end of life, no upstream fix); GitHub Enterprise Server 3.22.5 and earlier (no fix as of Nov 21, per Veria Labs); GitLab CE/EE before 19.4.10, 19.5.x before 19.5.8, 19.6.x before 19.6.1
- **Fixed:** Ruby 4.0.10; Ruby 3.4.13; Ruby 3.3.14; GitLab 19.6.1, 19.5.8, 19.4.10; Mastodon 4.7.6, 4.6.12, 4.5.22, 4.4.29; OpenProject 17.9.8, 17.8.3; Chatwoot 4.20.1; Discourse base image 2.0.20261119-0203
- **CVEs:** CVE-2026-132825
- **CISA KEV:** no · **Exploitation:** No known exploitation

## What to do

1. Inventory every Ruby interpreter on servers, CI runners, workers and container images with ruby -v, and check each app's running version with bin/rails runner 'puts RUBY_DESCRIPTION'.
2. Upgrade to Ruby 4.0.10, 3.4.13 or 3.3.14 and update the version pins in .ruby-version, .tool-versions and the Gemfile ruby line.
3. Rebuild container images from fixed base tags such as ruby:3.4.13, redeploy, and restart every Puma, Unicorn and Sidekiq process.
4. Install vendor fixes for products that bundle Ruby, such as GitLab 19.6.1 and Mastodon 4.7.6, and limit network access to GitHub Enterprise Server until GitHub ships a fix.
5. Move anything still on Ruby 3.2 or earlier to a supported branch, unless your distribution vendor confirms a backported fix.
6. For distribution Ruby packages, confirm the fix in the package changelog or security tracker rather than trusting the version string.

### How to check if you are affected

- Run Semgrep's open-source Ruby2Shell detector on hosts and Kubernetes nodes to find running processes that use an unpatched interpreter.
- Search application server logs and the systemd journal for Ruby [BUG] Segmentation fault reports or glibc malloc()/free() abort messages from web workers.
- Treat any unexplained web worker crash on an unpatched Ruby as a possible exploitation attempt and preserve logs and core dumps before restarting.
- No indicators of compromise have been published; a clean search does not prove a server was not attacked.

## What happened

On November 18, 2026, the Ruby core team [released Ruby 4.0.10, 3.4.13 and 3.3.14](https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/) to fix seven memory-safety bugs in the regular expression engine and in string case conversion. The team says it is "aware of PoCs that prove some of them can be used to trigger remote code execution." The one drawing attention is a one-byte heap overflow in case conversion, [GHSA-34m4-m9fh-gqp5](https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5), which MITRE assigned [CVE-2026-132825](https://www.cve.org/CVERecord?id=CVE-2026-132825) on November 19 with a CVSS 3.1 score of 7.4. Veria Labs, which says it independently found the bug and first showed code execution, named it Ruby2Shell. Ruby credits Stephan Lipp (Ada Logics) and Anthropic.

[Veria's write-up](https://verialabs.com/ruby2shell/) explains the root cause. Several ISO-8859 and Windows-125x encodings, including ISO-8859-1 and Windows-1252, have no capital ß, so upcasing it produces two bytes, SS. The loop checks room for only one. The output buffer is the input length plus 20 bytes, so 21 ß characters overflow it by one byte. The code is reached through `upcase`, `swapcase`, `downcase(:fold)` and `casecmp?` and has existed since Ruby 2.4.0. UTF-8 strings take a different path and are not affected.

## Who is affected

Ruby 3.3.13 and earlier, 3.4.0 through 3.4.12, and 4.0.0 through 4.0.9 are affected. Ruby 3.2 and earlier are end of life and get no upstream fix. The bug is in the interpreter, so updating Rails or other gems does not help.

A UTF-8 app is still exposed because attackers can choose the encoding. Veria says Rails and classic-style Sinatra are reachable without authentication in their default configuration. Semgrep, in its [detection scripts](https://github.com/semgrep/detection-scripts/pull/16), says it confirmed the path: `Rack::MethodOverride`, which Rails mounts unless the app is API-only, lets a multipart part's declared charset reach the case-conversion call before authentication. Other frameworks and plain Rack are not exposed by default.

Bundled Rubies need vendor updates. [GitLab](https://docs.gitlab.com/releases/patches/patch-release-gitlab-19-6-1-released/) fixed it in 19.6.1, 19.5.8 and 19.4.10 on November 20. Veria lists Mastodon, OpenProject, Chatwoot and the Discourse base image as patched, and GitHub Enterprise Server 3.22.5 and earlier as vulnerable with no fix. GitHub's own advisory was not disclosed as of Nov 21, 2026. [Ubuntu's tracker](https://ubuntu.com/security/CVE-2026-132825) still showed its ruby3.0, ruby3.2 and ruby3.3 packages as "Needs evaluation" on November 21.

## Do you really need to act?

**Yes, this week, and before November 25.** The ratings disagree. Ruby and GitLab call it Critical. MITRE's 7.4 assumes a local attack vector and high complexity. CISA's assessment in the CVE record marks it not automatable with no known exploitation, and none had been reported as of Nov 21, 2026.

Exploitation is hard. [watchTowr](https://watchtowr.com/intelligence/ruby-cve-2026-132825-faq/)'s Yordan Ganchev told [SecurityWeek](https://www.securityweek.com/ruby-patches-ruby2shell-vulnerability-that-could-lead-to-rce/) that attackers "would also need the right non-glibc memory allocator, runtime configuration, and application logic preconditions," and must defeat ASLR. A stock glibc system is not proof of safety, though. An [independent public analysis](https://github.com/evenomn/CVE-2026-132825) found that glibc's alignment absorbs the naive trigger, but a crafted string still corrupted glibc heap metadata in local tests.

The timing is what makes this urgent. The trigger needs no login in a default Rails app, and Veria plans to publish a remote code execution exploit for stock Rails on November 25. Five of the six other bugs are in the regex engine, so apps that compile patterns from user input have another reason to upgrade.

## What to do now

1. Find every Ruby you run: hosts, CI runners, workers and images. Check `ruby -v`, `docker run --rm --entrypoint ruby <image> -v`, and `bin/rails runner 'puts RUBY_DESCRIPTION'` inside each app.
2. Upgrade to 4.0.10, 3.4.13 or 3.3.14. Update the pins in `.ruby-version`, `.tool-versions` or the Gemfile `ruby` line, then install, for example `rbenv install 3.4.13` or `asdf install ruby 3.4.13` after updating ruby-build or the asdf plugin.
3. Rebuild images from fixed tags such as `ruby:3.4.13`, which [Docker Hub](https://hub.docker.com/_/ruby) published on November 19. Redeploy and restart every Puma, Unicorn and Sidekiq process; running processes keep the old interpreter.
4. For distribution packages, confirm the fix in the changelog or tracker rather than trusting the version string, which backports may not change.
5. Patch products that bundle Ruby. Limit network access to GitHub Enterprise Server until GitHub ships a fix.
6. Move anything on Ruby 3.2 or earlier to a supported branch.

## How to tell if you were hit

No exploitation or indicators of compromise had been published as of Nov 21, 2026. Semgrep's detectors report which running processes and containers use an unpatched interpreter. They find exposure, not compromise. Failed heap exploits often crash the process, so look for unexplained web worker crashes, such as Ruby's `[BUG] Segmentation fault` report or glibc `malloc()` or `free()` aborts. A first pass is `journalctl -u <app-service> | grep -E '\[BUG\]|malloc\(\)|free\(\)'`. A clean result proves little: a successful exploit need not crash anything. If an unpatched server shows such crashes, preserve its logs and investigate before you restart it.

## Timeline

- Nov 18, 2026 — Ruby publishes seven advisories and releases 4.0.10, 3.4.13 and 3.3.14.
- Nov 19, 2026 — MITRE assigns CVE-2026-132825 (CVSS 3.1 7.4). Docker Hub publishes fixed ruby images, and Semgrep merges its detection scripts.
- Nov 20, 2026 — GitLab ships 19.6.1, 19.5.8 and 19.4.10 with the patched Ruby.
- Nov 21, 2026 — Veria lists GitHub Enterprise Server 3.22.5 and earlier as still vulnerable.
- Nov 25, 2026 — Veria plans to publish a remote code execution exploit for stock Rails, or later if major vendors have not shipped fixes by then.

## Sources

1. [Ruby — Security advisories: multiple vulnerabilities in Regexp and String case conversion](https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/)
2. [CVE record — CVE-2026-132825](https://www.cve.org/CVERecord?id=CVE-2026-132825)
3. [GitHub ruby/ruby — GHSA-34m4-m9fh-gqp5: Heap buffer overflow in case conversion of strings](https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5)
4. [Veria Labs — Ruby2Shell (CVE-2026-132825)](https://verialabs.com/ruby2shell/)
5. [watchTowr — Frequently Asked Questions About the Ruby Remote Code Execution (Ruby2Shell CVE-2026-132825)](https://watchtowr.com/intelligence/ruby-cve-2026-132825-faq/)
6. [GitLab — Critical Patch Release: 19.6.1, 19.5.8, 19.4.10](https://docs.gitlab.com/releases/patches/patch-release-gitlab-19-6-1-released/)
7. [oss-security — Re: Ruby: multiple vulnerabilities in Regexp and String case conversion](https://www.openwall.com/lists/oss-security/2026/11/20/5)
8. [Ubuntu — CVE-2026-132825](https://ubuntu.com/security/CVE-2026-132825)
9. [Semgrep detection-scripts — PR #16: Add CVE-2026-132825 "Ruby2Shell" detection](https://github.com/semgrep/detection-scripts/pull/16)
10. [evenomn — Ruby2Shell Research: independent root-cause analysis and reproduction](https://github.com/evenomn/CVE-2026-132825)
11. [Docker Hub — ruby official image](https://hub.docker.com/_/ruby)
12. [Previdian — Ruby2Shell (CVE-2026-132825): What We Know So Far](https://blog.previdian.com/ruby2shell-cve-2026-132825-what-we-know-so-far/)
13. [SecurityWeek — Ruby Patches Ruby2Shell Vulnerability That Could Lead to RCE](https://www.securityweek.com/ruby-patches-ruby2shell-vulnerability-that-could-lead-to-rce/)

---
Source page: https://erroneo.us/security/briefs/ruby2shell-ruby-case-conversion-overflow-cve-2026-132825/ · Security Digest: https://erroneo.us/security/ · More: https://erroneo.us/llms.txt
