ruby2shell: Ruby flaw puts default Rails apps at risk, patch now
The Ruby team has fixed ruby2shell, a critical heap buffer overflow in how Ruby changes the case of strings, in Ruby 3.3.14, 3.4.13 and 4.0.10, released on November 18, 2026. Cloudflare, which tracks it as CVE-2026-132825, says an attacker can reach it in default Rails and classic-style Sinatra apps without logging in, and that it is blocking the attack for every customer, Free plans included. If you run a Ruby web app, upgrade Ruby and restart every Ruby process today.
What’s new
- What the bug is. Ruby’s advisory lists it as GHSA-34m4-m9fh-gqp5, “a one-byte heap buffer overflow in string case conversion”, and says changing the case of a crafted string may allow remote code execution. According to Cloudflare’s write-up, which cites an analysis by Veria Labs, the problem is in 14 legacy single-byte encodings (ISO-8859 and Windows-125x). The German sharp s (ß) becomes two letters, “SS”, when uppercased, but Ruby reserves room for only one, so a string with 21 of them overflows the buffer by one byte.
upcase,swapcase,downcase(:fold)andcasecmp?can all reach it. UTF-8 strings take a different code path and are not affected. - Why Rails is exposed by default. Rack’s
MethodOverridemiddleware upcases the_methodparameter that lets HTML forms send PUT or DELETE. Rails includes that middleware by default and classic Sinatra turns it on, so a multipart POST whose_methodpart declares a legacy charset and holds a run of sharp s characters reaches the bug before any authentication check runs. Veria Labs reports, per Cloudflare, that other frameworks and plain Rack apps are not exposed by default, but any code that changes the case of attacker-supplied, legacy-encoded strings may be. - Which Ruby versions. Ruby 3.3.13 and earlier, 3.4.0 to 3.4.12 and 4.0.0 to 4.0.9 are affected. Veria Labs says the bug goes back to Ruby 2.4.0. Ruby 3.2 and older are end-of-life and will not get a fix.
- How close is an exploit. The Ruby team says proofs of concept exist for some of the issues in this release and strongly recommends upgrading. Cloudflare reports that Veria Labs plans to publish its own proof of concept about a week after disclosure.
- Six more fixes in the same release. The update also fixes an integer overflow in the same case conversion code (GHSA-87fm-7w84-j2px) and five memory safety bugs in Ruby’s regular expression engine. Most of the regex bugs need an attacker to supply the pattern itself. Ruby says CVE numbers for all seven have been requested but not yet assigned in its advisory.
What it means for developers
Upgrade Ruby, then restart everything. Move to 3.3.14, 3.4.13 or 4.0.10, and restart web servers, background job workers and any other long-running Ruby process. Rebuild container images from a patched base image and replace the running containers. Check the version each app actually runs, from inside its own environment or container rather than your login shell:
bundle exec ruby -v
Linux distributions often backport fixes without changing the Ruby version number, so check your distribution’s security advisory too. Apps still on Ruby 3.2 or older need to move to a supported series to get the fix at all.
Check self-hosted tools that bundle Ruby. Cloudflare lists GitLab, GitHub Enterprise Server, Mastodon, OpenProject, Discourse and Chatwoot as products whose latest releases bundled an affected Ruby at disclosure (per Veria Labs, as of November 19). Discourse’s Docker base moved to Ruby 4.0.10 that day, so rebuild Discourse Docker installs; for the others, apply each vendor’s update as it ships.
If you are behind Cloudflare. Cloudflare added rules named “Ruby - Heap Overflow - CVE:CVE-2026-132825” and “Ruby - Integer Overflow - GHSA-87fm-7w84-j2px” to both its Free Managed Ruleset and its paid Managed Ruleset, set to block. On Pro, Business and Enterprise plans, make sure the Managed Ruleset is deployed on each zone and not overridden. Cloudflare also recommends accepting origin traffic only from Cloudflare (Cloudflare Tunnel or Authenticated Origin Pulls), so attackers can’t go around the WAF to reach your server directly. It calls the WAF a compensating control: the complete fix is the Ruby upgrade.
How it compares
It is another “Rails2Shell”-style scare, but a different kind of bug. KindaRails2Shell (CVE-2026-66066), fixed in July, was in Rails’ Active Storage and was fixed mainly by upgrading Rails. ruby2shell sits in the Ruby interpreter, so it reaches Rails apps that never touch file uploads, and the fix is a new Ruby rather than a bundle update.
It joins this week’s other flaws below the application code, Java4Shell in OpenJDK and nginx2root. For nginx2root, Cloudflare’s proxy shields origins from the HTTP/2 and HTTP/3 bugs without a WAF rule. In all three cases, every process running the old runtime stays vulnerable until it is upgraded and restarted.