The ruby2shell vulnerability (CVE-2026-132825) is a heap buffer overflow in how Ruby changes the case of strings. On Nov 19, 2026, the Ruby team disclosed the vulnerability and released fixes in Ruby 3.3.14, 3.4.13 and 4.0.10. Rails and classic-style Sinatra applications in their default configuration can hit the bug before the authentication step.
Quick summary
- ruby2shell is a heap buffer overflow caused by Ruby’s string case conversion; Ruby rates it Critical.
- The fix is in Ruby 3.3.14, 3.4.13 and 4.0.10; Ruby 3.2 and earlier have reached end of life and will not receive a patch.
- Rails and classic-style Sinatra in their default configuration reach the bug before authentication.
- Cloudflare WAF blocks ruby2shell for all customers, but it is only a compensating control and does not replace upgrading Ruby.
What’s new in the ruby2shell vulnerability?
Ruby rates the ruby2shell vulnerability as Critical and says it is aware of proof-of-concept exploits that achieve remote code execution in some scenarios. Veria Labs said it will publish its own proof of concept about a week after the disclosure date.

In the same release, Ruby 3.3.14, 3.4.13 and 4.0.10 also fix six other memory-safety bugs. One is GHSA-87fm-7w84-j2px, an integer overflow in the same case-conversion code. The other five are in Ruby’s regular expression engine, and most require the application to compile or match a regex pattern supplied by an attacker.
How does ruby2shell work?
The bug stems from an assumption about output length during case conversion. A Ruby string carries 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 case conversion usually produces output of the same length.
The German character ß breaks that assumption because its uppercase form is two characters, SS. In 14 ISO-8859 and Windows-125x encodings, Ruby writes two bytes but only checks for room for one. According to Veria Labs, a string containing 21 ß 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 sounds harmless, but in memory-corruption exploitation, a single byte written past the end of a heap buffer can be enough to corrupt an adjacent object or allocator metadata.
Why are default Rails and Sinatra exposed?
Rails and classic-style Sinatra are exposed because of Rack’s MethodOverride middleware. HTML forms can only send GET and POST, so many frameworks accept a _method parameter in a POST request to emulate PUT, PATCH or DELETE. Rack, the interface that most Ruby web frameworks are built on, implements this in the MethodOverride middleware and converts the _method value to uppercase. Rails includes this middleware by default, and classic-style Sinatra applications enable it.
An attacker can send a multipart POST request in which the _method part declares a legacy character set and contains a string of ß characters. The framework converts that value to uppercase as soon as it routes the request, before application code or any authentication check runs.
Veria Labs said other frameworks and plain Rack applications are not exposed by default. Application code that changes the case of strings received in a legacy encoding can still be affected, regardless of where the string comes from.
Which versions and software are affected?
The affected Ruby 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 said the bug has existed since Ruby 2.4.0, and Ruby 3.2 and earlier have reached end of life and will not receive a patch.
Self-hosted products that bundle Ruby are also affected. Veria Labs listed 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 the latest versions still shipping an affected Ruby (as of Nov 19, 2026). Discourse moved its Docker base image to Ruby 4.0.10 on Nov 19, so rebuilding a Docker installation picks up the fix.
Linux distribution packages may backport the fix without changing the Ruby version number, so compare the full package version number against the distribution’s advisory.
What does Cloudflare WAF block, and what can’t it see?
Cloudflare WAF blocks ruby2shell for all customers, including the Free plan. Cloudflare added two rules to the Free Managed Ruleset and the Managed Ruleset with a default action of Block: one for ruby2shell and one for GHSA-87fm-7w84-j2px. Cloudflare stressed that the WAF is a compensating control, not a replacement for patching.
The WAF can only block when the malicious data is in an HTTP request that passes through Cloudflare. Requests sent directly to the origin IP address and traffic between internal services never pass through the WAF. Ruby code that changes the case of strings from email, imported files, message queues or background jobs can also reach ruby2shell without any HTTP request.
Impact on developers
If you run Rails or classic-style Sinatra, treat upgrading Ruby as something to do soon, because Veria Labs expects to publish a proof of concept about a week after the disclosure date. Cloudflare recommends the following steps:
- Check WAF coverage: on a paid plan, 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, and move Ruby 3.2 and earlier applications to a supported version.
- Update self-hosted products that bundle Ruby when the vendor releases a patch, and rebuild Discourse Docker installations right away.
Cloudflare also suggests an additional layer of defense: WAF attack score uses machine learning to score each request against remote code execution payloads. The two conditions below are for custom rules, copied from Cloudflare’s post:
cf.waf.score.rce le 20
cf.waf.score.class eq "attack"
The first line is for the Enterprise plan and the second is for the Business plan; the rule can block or challenge requests that match the condition.
Impact assessment
| Audience | Impact | Severity | What to do |
|---|---|---|---|
| Developers | Default Rails or classic-style Sinatra applications can hit the bug before authentication. | High | Upgrade Ruby to a patched version and restart every process. |
| BrSE / PM | Projects using Ruby or products that bundle Ruby may need an unplanned update. | Medium | Review Ruby versions and ask customers about the self-hosted products they use. |
| Managers | Ruby 3.2 and earlier will not receive a patch, so they need to move to a supported version. | Medium | Consider allocating resources for runtime upgrades and image rebuilds. |
Industry perspective
From Toratech Blog’s perspective, ruby2shell shows that a length calculation that is off by one byte in case conversion can become a path to code execution when it sits on the pre-authentication request-handling path. The form’s _method parameter may get little attention as an attack surface, so it is worth reviewing seemingly harmless input-handling code.
In the short term, what can be done right away is to inventory Ruby runtimes and rebuild images. In the long term, teams can consider a process for tracking advisories for the runtime and for products that bundle Ruby; this patch round is also a chance to clean up applications still running Ruby 3.2 and earlier.
For Vietnam–Japan offshore projects running Rails or using self-hosted products such as GitLab, Mastodon and Discourse, the BrSE may need to tell the customer early about the affected versions and the update timing. Because a WAF does not replace a patch, reports to customers should state both measures clearly.
Frequently asked questions
Which Ruby versions does ruby2shell affect?
Ruby 3.3.13 and earlier, 3.4.0 through 3.4.12 and 4.0.0 through 4.0.9 are all affected. Veria Labs said the bug has existed since Ruby 2.4.0. The fix is in Ruby 3.3.14, 3.4.13 and 4.0.10.
Do I still need to patch if I use Cloudflare WAF?
Yes, because Cloudflare states clearly that the WAF is a compensating control, not a replacement for patching. Requests sent directly to the origin or data coming in from a message queue do not pass through the WAF. You still need to upgrade Ruby and restart your processes.
Which applications are not exposed by default?
According to Veria Labs, other frameworks and plain Rack applications are not exposed by default. Even so, code that changes the case of strings received in a legacy encoding can still be affected. UTF-8 strings take a different code path and are not affected.
References
- Cloudflare Blog (primary source)
This article was compiled with the help of AI from the sources below.
