Skip to content
Ruby2Shell Flaw in Ruby Exposes Default Rails Apps to Unauthenticated Code Execution

Ruby2Shell Flaw in Ruby Exposes Default Rails Apps to Unauthenticated Code Execution

Cyberkendra •Sulochana • November 19, 2026

Ruby has patched Ruby2Shell, a one-byte heap overflow in the interpreter’s string case conversion that researchers say lets an unauthenticated attacker run code on a default Ruby on Rails application.

Ruby2Shell is tracked as GHSA-34m4-m9fh-gqp5 and CVE-2026-132825 . Ruby rates it Critical, while the CVE record from the MITRE CNA scores it 7.4 (High) on CVSS 3.1.

The bug has been in Ruby since version 2.4.0, released in 2016, and sits in code that Rails, classic-style Sinatra and self-hosted products such as GitLab, GitHub Enterprise Server and Mastodon reach before any login.

The name comes from Veria Labs , which published a write-up styled “ruby2ßhell” after Ruby released fixed versions on Wednesday, November 18. A second team, Moritz Sanft of Durendal working with OpenAI, published a separate technical account on November 19 describing working pre-auth exploits against a fresh rails new app.

As of November 20, the fix exists only in upstream Ruby 4.0.10, 3.4.13, and 3.3.14. Ruby 3.2 and earlier are end of life and will not be patched, and Veria Labs lists the latest releases of six popular self-hosted Ruby products as still bundling a vulnerable interpreter.

How the Ruby2Shell Flaw Works

Ruby2Shell lives in the case_map routines Ruby uses for several legacy single-byte encodings. When Ruby uppercases the German sharp s (ß), it has to write two bytes, “SS”, but the conversion loop only checks that one byte of room is left in the output buffer. The second byte lands past the end of the heap allocation.

Ruby sizes that output buffer at the input length plus 20 spare bytes, and each ß consumes one extra byte, so a string of 21 ß characters overflows by exactly one byte. According to Veria Labs, the stray byte is always 0x53 (“S”) when uppercasing or 0x73 (“s”) when case-folding, and copying the result also reads one byte out of bounds.

Durendal lists the affected encodings as ISO-8859-1, -2, -3, -4, -9, -10, -13, -14, -15 and -16, plus Windows-1250, 1252, 1254 and 1257. The reachable methods are upcase , swapcase , downcase(:fold) , casecmp? , their bang variants and the matching Symbol methods. UTF-8 strings are not affected. Ruby fixed the bug in commit d582f8f , which ensures two bytes of space before writing the expanded character.

Ruby’s security advisory credits the bug to Stephan Lipp of Ada Logics and Anthropic. Durendal says it found the same flaw while using OpenAI’s Codex to map Ruby’s pre-auth attack surface, and that OpenAI reported it to the Ruby security team on November 5. Ruby’s advisory does not credit Durendal or OpenAI for this bug.

Why a Default Rails App Is Exposed

The route into Rails runs through Rack, the web server interface underneath it. Rack’s MethodOverride middleware, enabled by default in Rails, lets a browser form fake a PUT or DELETE request by sending a _method field, and it calls .upcase on that value. Rack also honours a charset parameter on each multipart form field and tags the string with that encoding.

An attacker therefore sends a multipart POST whose _method field declares charset=ISO-8859-1 and contains a run of ß bytes. Rack uppercases it before any controller or authentication code runs, and the interpreter writes past its buffer. Durendal says a plain rails new application is enough to be exploitable.

Durendal’s timeline puts its first end-to-end exploit against a toy Rails app on October 26. OpenAI researcher Sylvie then demonstrated code execution against a stock Rails app using the jemalloc allocator on November 5 and reproduced it with glibc’s default allocator on November 6. Veria Labs says Rails and classic Sinatra are exposed by default, while plain Rack and other frameworks are exposed only if application code uppercases text in a legacy encoding. Veria Labs has not published its own exploit chain.

Why Ruby and the CVE Record Disagree on Severity

Ruby and GitHub label GHSA-34m4-m9fh-gqp5 Critical without publishing a numeric score. The CVE-2026-132825 record, published by the MITRE CNA on November 19, carries the vector CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H, a local attack vector with high complexity, which produces 7.4.

That local rating conflicts with Veria Labs, which lists the access needed as “network, no authentication,” and with Durendal’s network exploits against Rails. MITRE has not published a rationale for the local vector. NVD had not completed its own analysis as of November 20.

Which Ruby Versions and Products Have a Fix

Veria Labs compiled the self-hosted list on November 19 at 04:35 UTC. Cyber Kendra found no patched release from GitLab, GitHub, Mastodon, OpenProject, Discourse, or Chatwoot as of November 20.

A public root-cause analysis indexed on Sploitus reports that, as of November 19, Ubuntu listed the CVE as “Needs evaluation”, Debian’s tracker had not triaged it, and Red Hat had opened tracking bug 2576211.

The same Ruby release fixes six more memory-safety bugs, five of which are in the Onigmo regular expression engine. One of them, GHSA-87fm-7w84-j2px , is a second case-conversion bug: an integer overflow that causes a much larger heap overwrite. Ruby credits it to a researcher named baba__yaga. Durendal says it demonstrated code execution with it against a Rails app pinned to Rack 3.2.0, and that Rack 3.2.2 and later block the payload with multipart size limits.

Is CVE-2026-132825 Being Exploited?

No vendor has reported attacks using CVE-2026-132825, and it is not in CISA’s Known Exploited Vulnerabilities catalogue as of November 20. Ruby’s advisory says the team is aware of proof-of-concept exploits demonstrating that the flaw can lead to remote code execution in certain scenarios.

Veria Labs says it will publish a proof of concept a week after disclosure, once people have had time to upgrade. A third-party GitHub repository, evenomn/CVE-2026-132825, already contains a root-cause analysis and a crash reproducer for both case-conversion bugs, but not a working code-execution exploit.

What Ruby and Rails Admins Should Do Now

Ruby2Shell is fixed in the interpreter, so updating Rails, Rack, or Sinatra gems does not remove it. Upgrade Ruby to 4.0.10, 3.4.13, or 3.3.14, then restart every application server process, since running workers keep the old interpreter in memory. Run ruby -v inside each deployed container or host to confirm the running version, and rebuild Docker images that pin an older Ruby base.

Applications still on Ruby 3.2 or older need to move to a supported branch, because Ruby will not backport the fix. Operators of GitLab, GitHub Enterprise Server, Mastodon, OpenProject, Discourse and Chatwoot need the vendor’s own release, since those products ship their own Ruby. Aikido Security advises removing such servers from the public internet until a vendor fix is available.

Ruby lists no workaround. Durendal says OpenAI has been working with WAF vendors on protections, and CrowdSec has a proposed virtual patch that blocks multipart fields declaring the affected legacy charsets. Edge rules of this kind cover only the known Rack path, not application code that uppercases legacy-encoded text elsewhere.

Join the conversation. Ask questions, solutions, and help others.

Be the first to start the discussion!