Cloud Security Cloud Workload Security

Cloudflare adds WAF rules for Ruby ruby2shell vulnerability

Cloudflare says it has added web application firewall (WAF) protections for ruby2shell, a critical Ruby vulnerability disclosed on November 19, 2026. The flaw, tracked as CVE-2026-132825, is a heap buffer overflow in Ruby string case conversion. Ruby reports that proofs of concept can achieve remote code execution in some scenarios.

The new rules are included in both the Cloudflare Free Managed Ruleset and the Cloudflare Managed Ruleset, with Block as the default action. Cloudflare says they are available to all customers, including those on the Free plan. The company describes the rules as a temporary, additional layer of defense—not a replacement for upgrading affected Ruby installations.

How the vulnerability can be reached

Ruby strings carry an encoding, and Ruby supports legacy single-byte encodings such as ISO-8859-1 and Windows-1252 as well as UTF-8. In a single-byte encoding, a character ordinarily occupies one byte. The German sharp s character, ß, is an exception when converted to uppercase: its uppercase form is two characters, SS.

According to Veria Labs, in 14 ISO-8859 and Windows-125x encodings, Ruby can write both output bytes while checking that space is available for only one. A string containing 21 sharp s characters can consequently overflow the output buffer by one byte. The affected methods are upcase, swapcase, downcase(:fold) and casecmp?. UTF-8 strings follow a different code path and are not affected by this flaw.

Although the overflow is one byte, memory corruption can affect an adjacent object or allocator metadata. Ruby says it is aware of proofs of concept that turn the issue into code execution. Veria Labs said it planned to publish its own proof of concept about a week after disclosure.

Veria Labs reports that Ruby on Rails and classic-style Sinatra applications can expose the vulnerable code in their default configurations, before authentication. Rack, the interface used by many Ruby web frameworks, includes MethodOverride middleware that converts the value of a POST request’s _method parameter to uppercase. Rails includes that middleware by default, and classic-style Sinatra applications enable it.

An attacker can send a multipart POST request with a legacy character set and a run of sharp s characters in the _method part. The middleware processes the value during request routing, before application code or authentication checks. Veria Labs says other frameworks and plain Rack applications are not exposed by default, although any application code that changes the case of attacker-controlled strings in a legacy encoding may still be vulnerable.

Affected versions and Cloudflare rules

The fixes are in Ruby 3.3.14, 3.4.13 and 4.0.10. Affected versions include Ruby 3.3.13 and earlier, 3.4.0 through 3.4.12, and 4.0.0 through 4.0.9. Veria Labs reports that the bug has existed since Ruby 2.4.0; Ruby 3.2 and earlier are end-of-life and will not receive the fix. Distribution packages may backport security patches without changing the upstream version number, so administrators should check their distribution’s advisory and package version.

Cloudflare added one managed rule for CVE-2026-132825 and another for GHSA-87fm-7w84-j2px, a related integer overflow in Ruby’s string case conversion code fixed in the same Ruby releases. The ruby2shell rule IDs are 7328f23691e44b07892ebd25b19210f1 in the Free Managed Ruleset and 1afa543a1ed84893b01df04c34402c88 in the Cloudflare Managed Ruleset. The related integer-overflow rules are 8660e37e86444f9f9267ba22e9855f05 and 6defac6a52334542adf4a162daf25922, respectively.

On the Free plan, the Free Managed Ruleset runs automatically. For paid plans, Cloudflare says customers should verify that the Cloudflare Managed Ruleset is deployed on each relevant zone and that the new rules have not been overridden. The paid-plan ruleset may not be active on every zone because customers have more control over deployment.

Patch runtimes and check indirect exposure

The vulnerability also matters for products that bundle Ruby. As of November 19, Veria Labs listed the latest releases of GitLab, GitHub Enterprise Server, Mastodon, OpenProject, Discourse and Chatwoot as containing affected Ruby versions. Discourse moved its Docker base image to Ruby 4.0.10 on November 19, so rebuilding a Docker installation picks up the fix. Administrators should follow each product vendor’s updates rather than assume that updating an application package has updated its bundled runtime.

Cloudflare cautions that its WAF can inspect only malicious input sent in HTTP requests that pass through its network. Direct-to-origin traffic, internal service requests and vulnerable code reached through email, file imports, message queues or background jobs may bypass the WAF. Organizations can restrict origin access to Cloudflare, including through Cloudflare Tunnel or Authenticated Origin Pulls, but should also inventory other paths to the affected code.

Cloudflare additionally points to WAF attack score as a way to help identify remote-code-execution payloads and post-exploitation traffic that signature rules might miss. It says Enterprise customers can create a rule using cf.waf.score.rce le 20, while Business customers can use cf.waf.score.class eq “attack”.

Cloudflare says it has patched its own Ruby-using systems and has found no indication of compromise. For customers, the primary remediation is to upgrade to a fixed Ruby release, restart Ruby processes including background workers, and rebuild affected container images. The WAF rules can reduce exposure during that work, but they cannot provide complete protection from every route to vulnerable code.