How Cloudflare WAF protects against ruby2shell (CVE-2026-132825)
Published 21 November 2026 · AI-generated hosts
ruby2shell lets attackers corrupt memory in default Rails and Sinatra apps without logging in. Cloudflare WAF blocks it for every customer, including Free plans. Upgrade Ruby now, and use the WAF to cover the gap.
Transcript
Mara A one-byte mistake in how Ruby capitalizes the German letter ß is now a critical security flaw. On November 19, 2026, the Ruby team disclosed it as ruby2shell, CVE-2026-132825. It's a heap buffer overflow in Ruby's string case conversion, and Ruby rates it Critical. Cloudflare wrote about its protections on November 20.
Mara Here's the mechanism. Ruby still supports many legacy single-byte encodings, like Latin-1 and Windows-1252. In those, changing case normally keeps a string the same length. But the uppercase of ß is two characters, SS. In 14 of those encodings, Ruby writes both bytes but checks for room for only one. According to Veria Labs, a string with 21 sharp s characters overflows the buffer by one byte. The methods that reach it are upcase, swapcase, downcase with fold, and casecmp?. UTF-8 strings take a different code path and aren't affected.
Mara One byte sounds harmless, but Cloudflare notes that a single byte past the end of a heap buffer can be enough to corrupt an adjacent object or allocator metadata. Ruby says it knows of proofs of concept that reach remote code execution in some scenarios.
Mara What makes this serious is the reach. Veria Labs reports that Ruby on Rails and classic-style Sinatra apps hit the bug in their default configuration, before any authentication. The reason is Rack's MethodOverride middleware, which lets HTML forms simulate PUT or DELETE through a _method parameter and uppercases that value. An attacker can send a multipart POST whose _method part declares a legacy character set and contains a run of ß characters. The framework upcases it during routing, before any application code or login check runs. Other frameworks and plain Rack apps aren't exposed by default, though any code that upcases attacker-controlled legacy-encoded strings could be.
Mara Affected versions are Ruby 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 dates back to Ruby 2.4.0. Fixes are in 3.3.14, 3.4.13 and 4.0.10. Ruby 3.2 and earlier are end of life and won't get a fix.
Mara Self-hosted software is a big part of the exposure. As of November 19, Veria Labs lists GitLab 19.6.0, GitHub Enterprise Server 3.22.5, Mastodon 4.7.5, OpenProject 17.9.7, Discourse 2026.10.1 and Chatwoot 4.20.0 as bundling an affected Ruby in their latest releases. Discourse moved its Docker base image to Ruby 4.0.10 on November 19, so rebuilding a Docker install picks up the fix. Distributions can also backport fixes without changing the version number, so check your distribution's advisory.
Mara 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 case conversion code. The other five are in the regular expression engine, and most need an app to compile or match an attacker-supplied pattern. That's uncommon, but it can happen in search features, filtering rules and admin tools.
Mara On the defense side, Cloudflare added two WAF rules, one for ruby2shell and one for the related integer overflow, to its Free Managed Ruleset and its Managed Ruleset, both set to Block by default. Free plans are covered automatically. On paid plans, Cloudflare recommends confirming the Managed Ruleset is actually deployed, since it may not be active on every zone. Cloudflare says it has patched its own Ruby systems and found no sign of compromise.
Mara Cloudflare is blunt that the WAF is a compensating control, not a fix. It only sees HTTP requests passing through Cloudflare, so traffic sent straight to your origin IP, internal service traffic, or strings arriving via email, file imports, queues or background jobs can bypass it. For extra coverage it points to WAF attack score, which scores requests for code-execution payloads.
Mara The clock matters. Veria Labs says it will publish its own proof of concept about a week after disclosure, and Cloudflare expects scanning to start soon after. The advice: upgrade Ruby, restart every Ruby process including background workers, rebuild container images, and move off Ruby 3.2 or earlier. Update bundled products as vendors ship fixes. The open question is how quickly those vendors can do that before a public exploit lands.
Sources