ruby2shell vulnerability: Patch Ruby Now for Rails and Sinatra
A critical Ruby bug disclosed November 19 can reach default Rails and Sinatra apps before login. Cloudflare's WAF blocks it, but upgrading Ruby is the real fix.
On November 19, 2026, the Ruby team disclosed the ruby2shell vulnerability (CVE-2026-132825), a heap buffer overflow in the way Ruby changes the case of strings. Ruby rates it Critical and says it knows of proofs of concept that achieve remote code execution in some scenarios. The Cloudflare Blog explains that fixes shipped in Ruby 3.3.14, 3.4.13 and 4.0.10, and that its web application firewall (WAF) now blocks known attack attempts for all customers.
What the ruby2shell vulnerability actually is
Ruby strings carry an encoding, and Ruby still supports many older single-byte encodings alongside UTF-8. In those older encodings, changing a string to uppercase normally gives you output of the same length. The German sharp s (ß) breaks that rule, because its uppercase form is two characters, SS.
According to Cloudflare, in 14 older encodings Ruby writes both bytes but only checks for room for one. Veria Labs reports that a string with 21 sharp s characters overflows the buffer by a single byte. The methods that reach the bug are upcase, swapcase, downcase(:fold) and casecmp?. UTF-8 strings take a different code path and are not affected.
One byte sounds trivial. Cloudflare notes that in a memory-corruption exploit, a single byte written past the end of a buffer can be enough to corrupt a neighboring object or memory bookkeeping data. Veria Labs says it will publish its own proof of concept about a week after disclosure, and Cloudflare expects scanning to begin soon after.
Why default Rails and Sinatra apps are exposed
Web forms can only send GET and POST requests, so many frameworks accept a hidden _method value to simulate other request types such as PUT or DELETE. Rack, which most Ruby web frameworks build on, handles this in a piece of middleware that converts that value to uppercase. Rails includes it by default, and classic-style Sinatra apps turn it on.
An attacker can send a specially built POST request that declares an older character set and includes a run of sharp s characters. The framework changes the case of that value while it is still deciding where to route the request. That happens before any application code or login check runs, so the attacker does not need an account.
Veria Labs reports that other frameworks and plain Rack apps are not exposed by default. Still, any application code that changes the case of strings arriving in an older encoding could be affected, no matter where those strings come from.
Who is affected
Per Cloudflare's summary, the affected Ruby versions are 3.3.13 and earlier, 3.4.0 through 3.4.12, and 4.0.0 through 4.0.9. Veria Labs says the bug has been present since Ruby 2.4.0. Ruby 3.2 and earlier have reached end of life and will not receive the fix, so those apps need to move to a supported series.
Many organizations do not write Ruby themselves but run software that bundles it. As of November 19, Veria Labs lists these latest releases as shipping an affected Ruby:
- GitLab 19.6.0
- GitHub Enterprise Server 3.22.5
- Mastodon 4.7.5
- OpenProject 17.9.7
- Discourse 2026.10.1
- Chatwoot 4.20.0
Discourse moved its Docker base image to Ruby 4.0.10 on November 19, so rebuilding a Docker install picks up the fix. Cloudflare also warns that Linux distribution packages can backport fixes without changing the Ruby version number, so check the full package version against your distribution's advisory.
The same Ruby releases fix six other memory safety flaws, and Ruby says several can lead to code execution. One is an integer overflow in the same string conversion code. The other five are in Ruby's regular expression engine and mostly need an application to use a pattern supplied by an attacker. Cloudflare calls that uncommon but possible in search features, filtering rules and admin tools.
What Cloudflare's WAF covers, and what it misses
Cloudflare says it added two managed rules, one for ruby2shell and one for the related integer overflow, with Block as the default action. They are in both the Free Managed Ruleset and the Cloudflare Managed Ruleset. On the Free plan the rules run automatically. On paid plans they are active wherever the Managed Ruleset is deployed, and Cloudflare recommends confirming it is actually running on every zone.
Cloudflare is direct about the limits. A WAF only sees traffic that passes through it. Requests sent straight to your server's IP address, and traffic between internal services, skip it. Ruby code that handles strings from email, file imports, message queues or background jobs can also reach the bug without any web request. In Cloudflare's words, the WAF is a compensating control, and the only complete fix is to upgrade Ruby.
For extra protection, Cloudflare points to its WAF attack score, which uses machine learning to flag requests that look like remote code execution attempts. It suggests custom rules on Enterprise and Business plans for that.
What to do this week
Cloudflare expects a public proof of concept within days, so the window is short. Here is a practical order of work:
- Find out where Ruby runs. Ask your developer, host or IT provider whether any site, app or self-hosted tool you use is built on Ruby, Rails or Sinatra.
- Upgrade Ruby to 3.3.14, 3.4.13 or 4.0.10, then restart every Ruby process, including background workers. Rebuild container images.
- Move off Ruby 3.2 or earlier. Those versions will not get a fix.
- Update bundled products such as GitLab, GitHub Enterprise Server, Mastodon, OpenProject and Chatwoot as each vendor releases a fix. Rebuild Discourse Docker installs now.
- Check your WAF. If you use Cloudflare on a paid plan, confirm the Managed Ruleset is deployed and the new rules have not been overridden.
- Lock down direct access. Configure your origin server to accept traffic only from Cloudflare, so attackers cannot go around the WAF.
If you are not sure what is running behind your website or forms, talk to a Formidable Masterminds developer about taking inventory and planning updates. Cloudflare says it has patched its own Ruby systems and found no sign of compromise.
Sources
- How Cloudflare WAF protects against ruby2shell (CVE-2026-132825) The Cloudflare Blog
This post was drafted with AI from the reporting linked above and published by The Jones Foundry. For full details, read the original sources.