
Ruby2Shell CVE-2026-132825: one-byte heap overflow in Ruby case conversion
Veria Labs disclosed Ruby2Shell (CVE-2026-132825), a one-byte heap overflow in Ruby case conversion reachable by default in Rails and classic Sinatra. Fixed Ruby releases are available.
Veria Labs has disclosed Ruby2Shell, tracked as CVE-2026-132825, a vulnerability in Ruby string case conversion. The flaw is a one-byte heap overflow that can be reached by default in Rails and classic Sinatra applications. Users should upgrade to fixed Ruby releases or vendor patches where applicable.
Affected Ruby versions and frameworks
Ruby 4.0.0 through 4.0.9, 3.4.0 through 3.4.12, and 3.3.0 through 3.3.13 are affected; fixed releases are 4.0.10, 3.4.13, and 3.3.14. Ruby 3.2 and older releases back to 2.4.0 are also listed as affected and are end of life. The issue is reachable in default configurations of Rails and classic Sinatra. Other frameworks and plain Rack are not exposed by default, though application code that upcases strings received in a legacy encoding may also be vulnerable.
Self-hosted software
Products that bundle their own Ruby require vendor fixes. GitLab 19.6.0 and earlier, GitHub Enterprise Server 3.22.5 and earlier, and Chatwoot 4.20.0 and earlier are listed as vulnerable with no fixed release yet, so every current version is vulnerable. Mastodon 4.7.5 and earlier is patched in 4.7.6, 4.6.12, 4.5.22, and 4.4.29. OpenProject 17.9.7 and earlier is patched in 17.9.8 and 17.8.3, while the Discourse base image before 2.0.20261119-0203 is patched in 2.0.20261119-0203.
Technical details
The root cause involves single-byte encodings that have no capital ß. When upcasing, the code writes two bytes, SS, but the loop only checks room for one byte. The output buffer is allocated as the input length plus 20 bytes, and each ß adds one byte, so an input with 21 of them overflows the buffer by one byte. The affected loop appears in several ISO-8859 and Windows-125x encodings and has been present since Ruby 2.4.0.
The primitive is a one-byte heap overflow. The byte written is S (0x53) when upcasing or s (0x73) when case-folding, and it lands directly after the output buffer. The attacker controls the size of the buffer through the input length, and copying the result out of the buffer then reads one byte out of bounds. The issue is reached through upcase, swapcase, downcase with :fold, and casecmp?. UTF-8 strings use a different code path and are not affected. The upstream fix is ruby/ruby@d582f8f.
Remediation and disclosure
Deployments should upgrade Ruby to a fixed release: 3.3.14, 3.4.13, or 4.0.10. Self-hosted installations should install the vendor's fixed release. The Veria Labs advisory was updated on 20 November 2026 at 02:29 UTC. Veria Labs found the vulnerability independently and was the first to demonstrate remote code execution. The Ruby security advisory also credits Stephan Lipp (Ada Logics) and Anthropic with reporting the underlying primitive, and additional discoverers include Moritz Sanft in collaboration with OpenAI. A proof of concept demonstrating remote code execution on stock Rails is scheduled for publication on 25 November 2026, or later if major vendors have not shipped a fix by then.
Earlier coverage: Ruby fixes seven Regexp and String case conversion vulnerabilities
SiTech — AI-powered web development
We build fast, modern websites and bring AI into real business workflows. Have a project or a question? We'd love to help.