---
title: "Ruby’s ruby2shell bug: one wrong byte, ten years old, pre-auth in Rails"
description: "Cloudflare ships a WAF rule for CVE-2026-132825 while vendors patch a decade-old overflow"
author: "Luis Goa"
published: 2026-11-20T20:24:38.514Z
modified: 2026-11-21T00:32:52Z
url: https://rews.cc/a/ruby-s-ruby2shell-bug-one-wrong-byte-ten-years-old-pre-auth--71b6bf
language: en
tags: ["ruby", "security", "vulnerability", "waf", "rails", "tech"]
publisher: "Rews (https://rews.cc)"
---

# Ruby’s ruby2shell bug: one wrong byte, ten years old, pre-auth in Rails

*Cloudflare ships a WAF rule for CVE-2026-132825 while vendors patch a decade-old overflow*

By Luis Goa · November 20, 2026 · https://rews.cc/a/ruby-s-ruby2shell-bug-one-wrong-byte-ten-years-old-pre-auth--71b6bf

## In brief

- Ruby patches ruby2shell (CVE-2026-132825), a 1-byte heap overflow in string case conversion, Nov 19, 2026
- Bug is reachable pre-authentication in default Rails and classic Sinatra apps via Rack’s method-override routing
- GitLab, Mastodon, OpenProject, Discourse and Chatwoot shipped vulnerable Ruby; GitHub Enterprise Server had no fix yet
- Cloudflare WAF blocks both flaws for every customer, including Free plan, via two managed rules
- Veria Labs plans to publish a working exploit against stock Rails on Nov 25, 2026

One byte of heap memory separates a routine string operation from an unauthenticated path to remote code execution in Ruby. CVE-2026-132825, disclosed on November 19, 2026 and nicknamed ruby2shell by the security firm that found it, is a heap buffer overflow in the function Ruby uses to upper-case strings written in 14 legacy single-byte text encodings, including ISO-8859-1 and Windows-1252. Ruby’s own advisory rates it Critical and says the project has seen proof-of-concept exploit code that reaches remote code execution. Cloudflare has already shipped a WAF rule for every customer, including those on its Free plan, as [Cloudflare wrote in its own advisory](https://blog.cloudflare.com/ruby2shell-waf-protection/). The rule is a stopgap: the only real fix is upgrading Ruby itself.

## The arithmetic of the overflow

Ruby strings carry an encoding tag, and the interpreter still supports many single-byte legacy encodings alongside UTF-8. In a single-byte encoding, one character is one byte, so changing case should not change length. The German sharp s, ß, breaks that rule: its uppercase form, SS, is two bytes. According to [Veria Labs’ writeup](https://verialabs.com/ruby2shell/), Ruby allocates its output buffer at input length plus 20 bytes, so a string containing 21 sharp-s characters needs 21 extra bytes but gets only 20, overflowing the buffer by exactly one byte. The methods that reach the flaw are upcase, swapcase, downcase(:fold) and casecmp?; UTF-8 strings run a different, unaffected code path. The bug has sat in Ruby’s string-conversion code since Ruby 2.4.0, released in 2016, which puts its age at roughly ten years before anyone reported it.

## A pre-auth path through Rack

A web browser form can only submit GET or POST. To fake PUT, PATCH or DELETE requests, Rack, the request layer underneath Rails and most other Ruby web frameworks, accepts a \_method parameter on a POST and upper-cases its value to route the request. Rails enables this MethodOverride middleware by default, and so does classic-style Sinatra. An attacker can send a multipart POST whose \_method field declares one of the 14 affected encodings and contains a run of sharp-s characters, and the upcase runs while Rack is still deciding how to route the request, before any application code or login check executes. Cloudflare’s advisory and Veria Labs agree that other frameworks and plain Rack applications are not exposed by default, though application code anywhere that case-converts attacker-supplied text in a legacy encoding can still hit the same bug.

**How ruby2shell reaches an unpatched Rails app** The request path from attacker to heap overflow, before authentication

| From | To | How |
| --- | --- | --- |
| Attacker sends multipart POST *(\_method field in a legacy encoding, 21+ sharp-s characters)* | Rack MethodOverride middleware *(enabled by default in Rails, classic Sinatra)* |  |
| Rack MethodOverride middleware *(enabled by default in Rails, classic Sinatra)* | Middleware upcases \_method value *(to route PUT/PATCH/DELETE)* |  |
| Middleware upcases \_method value *(to route PUT/PATCH/DELETE)* | Output buffer sized input+20 bytes |  |
| Output buffer sized input+20 bytes | 1-byte heap overflow (CVE-2026-132825) | 21 ß = 21 extra bytes needed, 20… |
| 1-byte heap overflow (CVE-2026-132825) | Heap corruption / RCE in some PoCs |  |
| Middleware upcases \_method value *(to route PUT/PATCH/DELETE)* | App code and auth checks *(never reached — overflow happens first)* | bypassed |

Based on [Cloudflare and Veria Labs advisories](https://blog.cloudflare.com/ruby2shell-waf-protection/)

What the diagram shows is that the vulnerable code runs as part of routing, a layer below the application’s own logic, which is why the flaw is reachable without a username or password in a stock Rails app. Cloudflare has handled a similarly structured problem before: when two 9.2-rated PHP runtime flaws needed [emergency WAF cover ahead of patches](https://rews.cc/a/two-9-2-rated-php-flaws-are-due-for-emergency-patches-0a807d) last month, the pattern was the same — a runtime-level memory bug, a managed rule shipped same-day, and a patch window measured in days, not weeks.

## Who shipped it, who’s still shipping it

**Self-hosted products caught shipping the flaw** Bundled Ruby version at time of disclosure and patch status as of Nov 20, 2026

| Product | Vulnerable version | Fixed in | Status |
| --- | --- | --- | --- |
| GitLab | 19.6.0 and earlier | 19.6.1, 19.5.8, 19.4.10 | Patched |
| Mastodon | 4.7.5 and earlier | 4.7.6, 4.6.12, 4.5.22, 4.4.29 | Patched |
| OpenProject | 17.9.7 and earlier | 17.9.8, 17.8.3 | Patched |
| Discourse (base image) | before 2.0.20261119-0203 | 2.0.20261119-0203 | Patched |
| Chatwoot | 4.20.0 and earlier | 4.20.1 | Patched |
| GitHub Enterprise Server | 3.22.5 and earlier | none yet | Unpatched |

Source: [Veria Labs](https://verialabs.com/ruby2shell/)

Cloudflare’s own list of affected self-hosted products matches Veria Labs’ six entries, and as of Veria Labs’ tracking, GitHub Enterprise Server 3.22.5 had no fixed release at the time of disclosure, leaving every on-premises GitHub Enterprise deployment running an affected Ruby with no vendor patch to install. Container images are a separate problem: Discourse’s fix shipped as a new base image, which means operators who built their own image from an older base inherit the bug until they rebuild, not just update a gem.

## Critical, High, or overhyped

The severity numbers disagree, and the disagreement is informative. Ruby’s own advisory and GitHub’s advisory database rate the flaw Critical. The CVE record published through MITRE and listed on [NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-132825) scores it 7.4 on CVSS 3.1, in the High band, with a vector that marks the attack vector as Local and attack complexity as High — categories that sit oddly with a bug reachable over the open internet before login. The gap is a reminder that CVSS base scores and real-world exploitability are different measurements: one is a formula applied to a vulnerability in isolation, the other accounts for how an attacker actually reaches the code in a default Rails deployment. [OX Security’s analysis](https://www.ox.security/blog/ruby2shell-ruby-memory-corruption-flaws-expose-applications-to-remote-code-execution-but-is-it-an-actual-risk/) makes the skeptic’s case directly: turning a one-byte overwrite into working code execution still requires heap grooming tailored to the target process, and a failed attempt crashes the worker rather than compromising it quietly. No vendor has reported exploitation in the wild, and as of November 20, 2026 the CVE is not in CISA’s Known Exploited Vulnerabilities catalogue. Veria Labs says it will publish a working exploit chain against unmodified Rails on November 25, 2026, or later if major vendors have not shipped fixes by then — the date that will settle whether this stays theoretical.

## What Cloudflare’s rule covers, and what it can’t

Cloudflare added two rules, one for ruby2shell and one for the related integer-overflow flaw GHSA-87fm-7w84-j2px fixed in the same Ruby releases, to both the Free Managed Ruleset and the paid Cloudflare Managed Ruleset (ruleset ID efb7b8c949ac4650a09736fc376e9aee), with Block as the default action. Free-plan sites get the protection automatically; paid-plan customers need to confirm the Managed Ruleset is actually deployed on each zone, since Cloudflare’s dashboard lets them turn pieces of it off. For deeper filtering, Cloudflare recommends a custom rule on requests scoring cf.waf.score.rce le 20 on Enterprise plans, or cf.waf.score.class eq “attack” on Business plans, to catch the second-stage payload an attacker still needs after the memory corruption to actually run commands. None of this helps traffic that never passes through Cloudflare’s edge: requests sent straight to an origin IP, or Ruby processes consuming email, file uploads or message queues rather than HTTP requests, are invisible to the WAF and need the interpreter itself patched. Cloudflare says it has upgraded its own Ruby-using systems and found no indication of compromise.

The seven GHSA advisories bundled into this Ruby release also fix a double-free in regular expression compilation, two more heap overflows in the regex engine and Regexp#to\_s, and two out-of-bounds reads in case-insensitive matching — most reachable only when an application compiles a user-supplied regex pattern, which is rarer than string case conversion but not absent from search and filtering features. Ruby 3.2 and earlier are end of life and get no fix for any of it, which leaves the question of how many production Rails apps are still running on an unsupported Ruby series the moment Veria Labs’ proof of concept goes public on November 25.

## See also

- [GitHub Advisory Database entry for CVE-2026-132825](https://github.com/advisories/GHSA-8452-w857-wpmw) — github.com · Cross-referenced advisory record with affected version ranges
- [CrowdSec: Ruby2Shell virtual patch](https://www.crowdsec.net/blog/ruby2shell-virtual-patching) — crowdsec.net · A free WAF rule alternative for operators without Cloudflare
- [Sourcegraph: find vulnerable Ruby across your repos](https://sourcegraph.com/blog/ruby2shell-cve-2026-132825-find-vulnerable-ruby) — sourcegraph.com · Code-search method for inventorying affected Ruby versions
- [watchTowr: Ruby2Shell FAQ](https://watchtowr.com/intelligence/ruby-cve-2026-132825-faq/) — watchtowr.com · Operator-facing Q&A on exposure and remediation steps
