· via Cloudflare blog
Ruby's critical ruby2shell heap overflow hits default Rails and Sinatra apps pre-auth
Ruby fixed CVE-2026-132825 (ruby2shell), a critical heap overflow in string case conversion with RCE proofs of concept. Default Rails and classic Sinatra apps are exposed before authentication.

The Ruby team disclosed a critical heap buffer overflow in the runtime's string case conversion code on November 19, 2026. Nicknamed ruby2shell and tracked as CVE-2026-132825, the flaw already has proofs of concept that achieve remote code execution in some scenarios, according to Ruby's own assessment. Fixed versions are Ruby 3.3.14, 3.4.13 and 4.0.10.
What the bug actually is
Ruby strings carry an encoding, and the runtime still supports legacy single-byte encodings such as ISO-8859-1 and Windows-1252 alongside UTF-8. In a single-byte encoding, uppercasing a string normally yields output of identical length. The German sharp s (ß) breaks that assumption: its uppercase form is the two-character sequence SS.
According to Cloudflare, in 14 ISO-8859 and Windows-125x encodings Ruby writes both bytes of the uppercase result while only allocating space for one. Veria Labs found that a string containing 21 sharp s characters pushes one byte past the end of the output buffer. The reachable methods are upcase, swapcase, downcase(:fold) and casecmp?. UTF-8 strings take a different code path and are unaffected.
A single stray byte sounds minor, but in memory-corruption exploitation it can be enough to damage an adjacent heap object or allocator metadata. Ruby says it is aware of proofs of concept that reach code execution, and Veria Labs intends to publish its own proof of concept roughly a week after disclosure. Cloudflare expects mass scanning to follow shortly.
Why default Rails and Sinatra apps are exposed
HTML forms can only issue GET and POST requests, so frameworks commonly fake PUT, PATCH and DELETE by honouring a _method parameter inside a POST body. Rack implements this in its MethodOverride middleware, which uppercases the parameter's value — precisely the operation that triggers the overflow. Rails ships this middleware by default, and classic-style Sinatra applications turn it on.
An attacker can submit a multipart POST whose _method part declares a legacy character set and carries a run of sharp s characters. The framework converts the value to uppercase while 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, though any code that changes the case of attacker-controlled strings in a legacy encoding remains at risk, wherever the string originates.
Who is affected
Cloudflare, citing Veria Labs, lists the affected versions as Ruby 3.3.13 and earlier, 3.4.0 through 3.4.12, and 4.0.0 through 4.0.9. The bug has been present since Ruby 2.4.0; Ruby 3.2 and older branches are end of life and will not receive the fix.
Several widely deployed self-hosted products shipped an affected Ruby in their latest release at disclosure time: 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. Discourse moved its Docker base image to Ruby 4.0.10 on November 19, so rebuilding a container installation picks up the patch. Distributions may backport the fix without bumping the Ruby version number, so operators should compare the full package version against their advisory.
Cloudflare WAF rules buy time, not safety
Cloudflare has added two blocking rules to both its Free and paid managed rulesets, covering ruby2shell and GHSA-87fm-7w84-j2px, a related integer overflow in the same case conversion code fixed in the same releases. Free customers get the rules automatically; on paid plans the managed ruleset may not be active on every zone, so Cloudflare advises verifying its status.
The company is explicit that a WAF is a stopgap rather than a substitute for upgrading. Rules only inspect HTTP requests that traverse Cloudflare: traffic sent straight to the origin, internal service-to-service calls, and non-HTTP paths such as email handling, file imports, message queues and background jobs can all reach the vulnerable code unseen. Cloudflare has patched its own Ruby-based systems and reports no indication of compromise.
Six more flaws in the same release
The three fixed releases also close six other memory safety bugs, several of which Ruby says can lead to code execution. Five sit in the regular expression engine and mostly require the application to compile or match an attacker-supplied pattern — uncommon in web apps, but plausible in search features, filtering rules and admin tooling.
Why it matters
This is pre-authentication remote code execution territory in the default configuration of Rails, the most widely used Ruby web framework, and of classic Sinatra. The blast radius extends well beyond hand-built applications: a long list of self-hosted products bundle their own Ruby runtime, and their upgrade cycles are slower than a single dependency bump. With a public proof of concept days away and scanning expected to follow, the workable response is narrow: upgrade Ruby to 3.3.14, 3.4.13 or 4.0.10, rebuild bundled runtimes and container images, and treat WAF rules only as cover while that work completes.
- #ruby
- #security
- #rails
- #vulnerability
- #cloudflare
- #waf