On November 19, 2026, the Ruby team disclosed ruby2shell (CVE-2026-132825), a heap buffer overflow in the way Ruby changes the case of strings. Ruby rates the flaw Critical and says it is aware of proofs of concept that achieve remote code execution in some scenarios. Fixes shipped in Ruby 3.3.14, 3.4.13, and 4.0.10.
The reach is wide. Veria Labs reports that Ruby on Rails and classic-style Sinatra applications reach the bug in their default configuration, before any authentication. Self-hosted products that bundle Ruby, including GitLab, GitHub Enterprise Server, Mastodon, OpenProject, Discourse and Chatwoot, shipped an affected Ruby in their latest release at the time of disclosure.
Cloudflare WAF blocks ruby2shell for all customers, including those on the Free plan. We have added two rules to both the Cloudflare Free Managed Ruleset and the Cloudflare Managed Ruleset, with Block as the default action: one for ruby2shell and one for GHSA-87fm-7w84-j2px, a related integer overflow in Ruby string case conversion fixed in the same releases.
The WAF is a compensating control, not a replacement for patching. Exploits can reach the bug through paths a WAF does not see, and the only complete fix is to upgrade Ruby. Our team continues to monitor attack traffic and will update the rules as new techniques appear. You can track rule changes in the WAF changelog and get the latest on the vulnerability in the Cloudflare Zero Wire briefing.
Cloudflare has patched its own systems that use Ruby, and we have found no indication of compromise.
What we know about ruby2shell
Ruby strings carry an encoding, and 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 says it is aware of proofs of concept that turn this flaw into code execution, and Veria Labs says it will publish its own proof of concept about a week after disclosure. We expect 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, implements 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.
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.
Who is affected
Condition
Details
Ruby version
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 the fix.
Framework
Rails and classic-style Sinatra in their default configuration. Any other code that changes the case of attacker-controlled strings in a legacy single-byte encoding.
Bundled software
As of November 19, 2026, 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 release. 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 check the full package version against your distribution's advisory.
Six more Ruby 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, GHSA-87fm-7w84-j2px, is an integer overflow in the same string case conversion code, and our second WAF rule covers it. The other five are in Ruby's regular expression engine. Most of them require the 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.
How Cloudflare WAF protects you
Upgrading every Ruby runtime takes time, especially when Ruby is bundled inside self-hosted products and container images. Cloudflare WAF reduces your exposure while you patch.
New managed rules, on for every customer
Both rules are part of the Cloudflare Free Managed Ruleset and the Cloudflare Managed Ruleset (Ruleset ID efb7b8c949ac4650a09736fc376e9aee), with Block as the default action.
Rule description
Rule ID
Ruleset
Default action
Ruby - Heap Overflow - CVE:CVE-2026-132825
7328f23691e44b07892ebd25b19210f1
Cloudflare Free Managed Ruleset (Free plan)
Block
Ruby - Heap Overflow - CVE:CVE-2026-132825
1afa543a1ed84893b01df04c34402c88
Cloudflare Managed Ruleset (Pro, Business and Enterprise plans)
Block
Ruby - Integer Overflow - GHSA-87fm-7w84-j2px
8660e37e86444f9f9267ba22e9855f05
Cloudflare Free Managed Ruleset (Free plan)
Block
Ruby - Integer Overflow - GHSA-87fm-7w84-j2px
6defac6a52334542adf4a162daf25922
Cloudflare Managed Ruleset (Pro, Business and Enterprise plans)
Block
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 give you more control over how rulesets are deployed, the Cloudflare Managed Ruleset may not be active on every zone. We recommend checking its status to confirm that it is running. You can use the links in the Zero Wire briefing to go straight to the rules in your dashboard.
What the WAF cannot see
A WAF can block an exploit when the malicious input arrives in an HTTP request that passes through Cloudflare. It cannot block every path to the vulnerable code:
- Traffic that bypasses Cloudflare. Requests sent directly to your origin IP address, and traffic between internal services, never reach the WAF. Configure your origin to accept traffic only from Cloudflare, for example with Cloudflare Tunnel or Authenticated Origin Pulls.
- Other entry points into the same code. Ruby code that changes the case of strings from email, file imports, message queues or background jobs can reach ruby2shell without an HTTP request.
Adding defense in depth with WAF attack score
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, and then interact with the compromised server. WAF attack score uses machine learning to score each request for remote code execution payloads, which helps catch exploit variations and post-exploitation traffic that signature-based rules can miss. Create a custom rule that blocks or challenges requests with cf.waf.score.rce le 20 on Enterprise plans, or cf.waf.score.class eq "attack" on Business plans.
Impact on Cloudflare infrastructure
Cloudflare has patched its systems that use Ruby against ruby2shell. We have found no indication of compromise and continue to monitor.
Patch now
ruby2shell turns a one-byte miscalculation in string case conversion into a pre-authentication path to code execution in default Rails and Sinatra apps. With a public proof of concept expected within days, the window to patch is short. Here is what to do:
- Check your WAF coverage. On the Free plan, the ruby2shell rules are already blocking. On paid plans, confirm the Cloudflare Managed Ruleset is deployed and the rules have not been overridden.
- Upgrade Ruby to 3.3.14, 3.4.13 or 4.0.10 and restart every Ruby process, including background workers. Rebuild container images. Move applications on Ruby 3.2 or earlier to a supported series.
- Update self-hosted products that bundle Ruby, such as GitLab, GitHub Enterprise Server, Mastodon, OpenProject and Chatwoot, as each vendor releases a fix. Rebuild Discourse Docker installs now.
- Inventory your runtimes. The Zero Wire briefing includes a prompt you can give an AI agent to find every affected Ruby runtime in your infrastructure.
Our WAF analysts will keep updating protections as new techniques appear. Follow the WAF changelog for rule updates.