The ruby2shell flaw, tracked as CVE-2026-132825, is a heap buffer overflow in the way Ruby changes the case of strings. The Ruby team disclosed it on November 19, 2026, and rated it Critical. Cloudflare said its web application firewall (WAF) now blocks the flaw for all customers, including those on the Free plan.
How the ruby2shell flaw works
Ruby strings carry an encoding. Ruby still supports many legacy single-byte encodings, such as ISO-8859-1 (Latin-1) and Windows-1252, alongside UTF-8. In a single-byte encoding, each character takes one byte, so changing the case of a string usually produces output of the same length.
The German sharp s (ß) breaks that assumption. Its uppercase form is two characters, SS. In 14 ISO-8859 and Windows-125x encodings, Ruby writes those two bytes but checks for room for only one. According to Veria Labs, a string with 21 sharp s characters overflows the output buffer by one 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.
A one-byte overflow can look harmless. In a memory-corruption exploit, though, a single byte written past the end of a heap buffer can be enough to corrupt an adjacent object or allocator metadata. Ruby said it is aware of proofs of concept that turn the flaw into code execution in some scenarios. Veria Labs said it will publish its own proof of concept about a week after disclosure, and Cloudflare expects scanning to start soon after.

Why default Rails and Sinatra apps are exposed
HTML forms can only send GET and POST requests. To simulate PUT, PATCH or DELETE, many web frameworks accept a _method parameter in a POST request. Rack, the interface most Ruby web frameworks build on, handles this in its MethodOverride middleware, which converts the value of _method to uppercase. Rails includes this middleware by default, and classic-style Sinatra applications enable it.
An attacker can send a multipart POST request whose _method part declares a legacy character set and contains a run of sharp s characters. The framework upcases the value while it is still routing the request, before any application code or authentication check runs. That is why Veria Labs describes the flaw as reachable before authentication in Rails and classic-style Sinatra applications in their default configuration.
Veria Labs reports that other frameworks and plain Rack applications are not exposed by default. Application code that changes the case of strings received in a legacy encoding may still be affected, wherever the string comes from.
Affected versions and products
The flaw affects Ruby 3.3.13 and earlier, 3.4.0 through 3.4.12, and 4.0.0 through 4.0.9. Veria Labs reports the bug has been present since Ruby 2.4.0. Ruby 3.2 and earlier have reached end of life and will not receive a fix.
Several self-hosted products bundle Ruby, and they inherit the exposure. As of November 19, 2026, Veria Labs lists the following latest releases as bundling 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. Distribution packages can backport fixes without changing the Ruby version number, so administrators should check the full package version against their distribution’s advisory.
Five more memory safety flaws in the same release
Ruby 3.3.14, 3.4.13 and 4.0.10 also fix six other memory safety flaws, and Ruby says several of them can lead to code execution. One of them, GHSA-87fm-7w84-j2px, is an integer overflow in the same string case conversion code. Cloudflare added a second WAF rule for it.
The other five flaws are in Ruby’s regular expression engine. Most require an application to compile or match a regular expression pattern supplied by the attacker. That is uncommon in web applications, but it does happen in search features, filtering rules and admin tools. Administrators running those features should treat the regex fixes as part of the same upgrade.
How Cloudflare WAF rules respond
Upgrading every Ruby runtime takes time, especially when Ruby is bundled inside self-hosted products and container images. Cloudflare said its WAF reduces exposure while customers patch. It added two rules to both the Cloudflare Free Managed Ruleset and the Cloudflare Managed Ruleset, with Block as the default action. One rule covers the ruby2shell flaw, and the other covers GHSA-87fm-7w84-j2px.
On the Free plan, the Cloudflare Free Managed Ruleset runs automatically, so there is nothing to turn on. On paid plans, the rules are active wherever the Cloudflare Managed Ruleset is deployed. Because paid plans offer more control over ruleset deployment, the managed ruleset may not be active on every zone, so Cloudflare recommends checking its status.
Cloudflare also stressed that the WAF is a compensating control, not a replacement for patching. A WAF can block an exploit when malicious input arrives in an HTTP request that passes through Cloudflare. It cannot block every path to the vulnerable code. Requests sent directly to an origin IP address, and traffic between internal services, never reach the WAF. Ruby code that changes the case of strings from email, file imports, message queues or background jobs can also reach the flaw without an HTTP request.
Defense in depth and what administrators should do
Memory corruption is usually only the first step. To run commands, an attacker still has to deliver a second-stage payload, such as shell commands or a reverse shell. Cloudflare’s WAF attack score uses machine learning to score each request for remote code execution payloads, which can catch exploit variations and post-exploitation traffic that signature rules miss. Enterprise customers can block or challenge requests with cf.waf.score.rce le 20, and Business customers can use cf.waf.score.class eq “attack”.
Cloudflare said it has patched its own systems that use Ruby and has found no indication of compromise. For other organizations, the recommended steps are to confirm WAF coverage, upgrade Ruby to 3.3.14, 3.4.13 or 4.0.10 and restart every Ruby process, including background workers, and move applications on Ruby 3.2 or earlier to a supported series. Self-hosted products should be updated as each vendor releases a fix. Cloudflare said it will keep updating its rules and will post changes in the WAF changelog. Veria Labs’ proof of concept, expected about a week after disclosure, will show how far the public exploit path goes.
