Ruby2Shell: one byte past the heap, and an exploit not yet public

Abhishek Dash11 min read
An exposed brass lever lock lies open on a dark workbench, eight steel levers standing side by side with the last one sitting fractionally lower and the bolt partly withdrawn, a pair of steel callipers resting beside it.

In short

Ruby2Shell is CVE-2026-132825, a one-byte heap overflow in Ruby case conversion, fixed on 18 November 2026 in Ruby 4.0.10, 3.4.13 and 3.3.14. A multipart _method field with 21 sharp-s bytes reaches it before login in a default Rails app through Rack::MethodOverride. Veria Labs and Durendal claim pre-authentication RCE and the public exploit is due 25 November 2026; as of writing none exists.

Key takeaways

  • Ruby 4.0.10, 3.4.13 and 3.3.14, released on 18 November 2026, fix seven memory-safety bugs including CVE-2026-132825.
  • The one-byte write is 0x53 on upcase or 0x73 on case-fold, past a buffer sized at input length plus 20 bytes; 21 sharp-s bytes overflow it by one.
  • Rack::MethodOverride upcases a client-controlled _method multipart field before routing, CSRF or authentication; Semgrep confirmed the path at runtime on Rails 8.1 and 7.2.
  • The fix is in the interpreter; as of 20 November 2026 GitLab 19.6.0, GitHub Enterprise Server 3.22.5 and Chatwoot 4.20.0 still bundled affected Rubies.
  • Veria Labs says its Rails exploit is due 25 November 2026; as of writing no public exploit exists and no in-the-wild exploitation has been reported.
  • Confidence is high on the mechanism, versions, fix and Rails reachability, medium on who found the bug first and on real-world exploit reliability.

Ruby 4.0.10, 3.4.13 and 3.3.14 were released on 18 November 2026 with fixes for seven memory-safety bugs in the interpreter's regular-expression engine and string case conversion. Three are rated critical. The headline bug, GHSA-34m4-m9fh-gqp5 and CVE-2026-132825, is a one-byte heap overflow that writes the value 0x53, an uppercase S, just past the end of a buffer. It has been in Ruby since 2.4.0, released in 2016.

Two research teams published exploit claims within a day of the release. Veria Labs named the flaw Ruby2Shell and published a root-cause writeup. Moritz Sanft of Durendal, working with OpenAI, published a fuller account naming the Rails path, the affected encodings, and a second, larger overflow in the same function. Ruby's own advisory credits Stephan Lipp of Ada Logics and Anthropic, neither of the two teams publishing exploit claims.

The overflow is real and well understood. The claim that it yields remote code execution before login in a default Rails application has been demonstrated privately and is asserted by Ruby's advisory, but no public exploit existed as of 20 November 2026. Veria Labs says it will publish its Rails exploit on 25 November 2026. This post is written before that date, so the RCE is treated here as a claim, not a demonstrated result.

The one-byte write

Ruby's case_map functions for 14 legacy single-byte encodings convert the sharp-s character, 0xDF, into two bytes, SS, when uppercasing. The conversion loop checks that the output buffer has room for one byte, then writes two. Its condition is while (*pp < end && to < to_end), which leaves space for a single byte, but the sharp-s branch writes S and then falls through to a second *to++ = code. That second write is unchecked.

The output buffer is allocated at the input length plus 20 bytes, a constant named CASE_MAPPING_ADDITIONAL_LENGTH in the source. Each sharp-s adds one extra byte to the output. A string of 21 sharp-s characters therefore overflows a buffer sized for 20 extra bytes by exactly one byte. The stray byte's value is fixed: 0x53 on upcase and 0x73 on case-fold. The attacker controls where it lands by choosing the input length and the position of the sharp-s bytes, but not what it contains.

The affected encodings are the ISO-8859 family members 1, 2, 3, 4, 9, 10, 13, 14, 15 and 16, plus Windows-1250, 1252, 1254 and 1257, according to the Durendal writeup and the upstream patch. Reachable methods include upcase, upcase!, swapcase, swapcase!, downcase with the fold option, casecmp?, and the matching Symbol methods. UTF-8 strings take a different code path and are not affected.

The primitive is narrow. A fixed-value one-byte write needs the neighbouring heap state arranged so that the byte corrupts something useful, such as the size field of the next allocation. Ruby's advisory says the maintainers are aware of proof-of-concept exploits that trigger remote code execution in some scenarios. That is the maintainers' statement about scenarios, not a demonstration against arbitrary deployments.

Why Rails reaches it before login

The reason a one-byte overflow in an encoding edge case matters is the call site, not the encoding. Rack's MethodOverride middleware lets an HTML form fake PUT, PATCH or DELETE by sending a _method field, and it calls upcase on the value:

method = method_override_param(req) ||
  env[HTTP_METHOD_OVERRIDE_HEADER]
begin
  method.to_s.upcase

Rack also honours a charset parameter on each multipart form part and tags the resulting Ruby string with that encoding:

if k == "charset"
  encoding = find_encoding(v)
end

Put those together and a multipart POST with a _method part declared text/plain; charset=ISO-8859-1 and holding 21 or more 0xDF bytes reaches the vulnerable conversion before routing, before CSRF protection and before authentication. Durendal says a plain rails new application is enough.

That reachability claim has independent support. Semgrep confirmed at runtime that the client-controlled value arrives at the upcase call with its encoding intact on Rails 8.1 and 7.2, Sinatra 4.2 and 3.2, and Rack 3.2 and 2.2. Semgrep did not build an exploit, so it verifies the path and not the code execution. Veria Labs asserts the same default reachability but has not published the Rails path or its exploit chain, so its claim rests on the other two teams' evidence rather than its own.

Reachability is the load-bearing question because everything else in the story is either a fixed bug or a disputed capability. The memory write is understood, the patch exists, and the versions are known. Whether an unauthenticated request can reach the write in a stock deployment is what separates an interpreter bug from an internet-facing one. On that specific question the evidence is strong, and it is graded high: the path is a default middleware call, confirmed independently at runtime.

Which deployments are exposed

Not every Ruby application is on the path. Classic Sinatra exposes it by default; modular Sinatra does not unless it enables method override. Plain Rack apps are exposed only if they mount MethodOverride. Rails configured with config.api_only = true does not go through the middleware, though application code that upcases multipart parameters could still reach the function. The Rodauth account-creation path reaches casecmp? on a login confirmation field, but that comes from Semgrep's reading rather than a working exploit.

HTTP headers, JSON bodies, query strings and ordinary URL-encoded forms arrive as binary or UTF-8 and do not carry the bug. The bytes travel raw inside a multipart body. A WAF rule scanning for repeated percent-encoded DF in a URL is looking in the wrong place.

The fix and the patch gap

The fix is in the interpreter, not in Rails, Rack, Sinatra or any gem. The upstream commit d582f8f, dated 28 October 2026, corrects the case-mapping loop and adds regression tests. Its author line carries a co-author credit to Claude Mythos 5.1 of Anthropic.

Updating a web framework does nothing for this bug. Containers pinned to an old Ruby base keep it. Application servers restarted with a phased restart can keep the old interpreter in the master process. The upgrade has to reach the Ruby binary itself.

As of 20 November 2026, several self-hosted products still bundled affected Rubies. The table is a snapshot; vendor status changes daily.

Product Bundled Ruby Status on 20 November 2026
GitLab 19.6.0 3.3.13 Affected, no vendor fix found
GitHub Enterprise Server 3.22.5 4.0.9 Affected, no vendor fix yet
Chatwoot 4.20.0 3.4.4 Affected, no vendor fix yet
Mastodon 4.7.6 4.0.10 Fixed
OpenProject 17.9.8 4.0.10 Fixed
Discourse, base image 2.0.20261119-0203 4.0.10 Fixed

GitHub Enterprise Server 3.22.5 was released on 17 November 2026, one day before the Ruby advisory, and its release notes contain no Ruby2Shell entry. The practical exposure is concentrated in source-code hosts and CI systems, where a compromised Ruby process would expose repository credentials, deploy keys and pipeline secrets. That consequence is a derived risk, not an observed compromise. No Rails installation is reported as compromised by this bug.

WAF coverage exists but is partial. InfraStack reports that Cloudflare and AWS WAF shipped rules, and CrowdSec published a virtual patch that blocks a POST whose _method field holds 21 or more 0xDF bytes. The CrowdSec rule has stated limits: a part with no Content-Disposition header takes its name from Content-ID and is missed; fields other than _method are not covered; the integer-overflow bug described below uses a UTF-8 payload and is not covered. WAF rules buy time, not a fix.

The severity labels disagree

Ruby and GitHub label the flaw Critical without a numeric score. MITRE's CVE record, CVE-2026-132825, assigns CVSS 3.1 base 7.4 High with vector AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H. The local attack vector contradicts the network-reachable Rails path that Durendal and OpenAI demonstrated end to end. MITRE has not published a rationale for the local vector, and NVD had not completed its own analysis as of 20 November 2026. Amazon calls it Important at 8.1 with a network vector, according to ComputingForGeeks. Veria Labs calls it Critical with network access and no authentication. OX Security argues it is more marketing than actual risk.

Those labels are not averages of one another, and this post does not reconcile them. The exploit demonstrations on stock Rails make the local vector hard to defend, but the score remains published until MITRE explains or revises it.

Who found it, and who gets credit

Three groups are attached to one bug, and their accounts do not agree on priority. Veria Labs published the writeup and the name, and says it will publish a proof of concept in a week; its research page also sells an autonomous pentester. Durendal and OpenAI published the fuller account. Sanft's timeline says he found the bug on 23 October 2026 using Codex, had a toy exploit by 26 October, and that OpenAI reported both bugs to the Ruby team on 5 November. The OpenAI researcher known as Sylvie demonstrated remote code execution on a stock rails new application on 5 November and reproduced it with glibc's default allocator the next day.

Ruby's advisory credits Stephan Lipp of Ada Logics and Anthropic, and the fix commit carries a Claude co-author line. The most defensible reading is that the bug was found independently at least twice in the same three-week window, both times with AI assistance, and Ruby's credit names the report it acted on. Priority cannot be settled from public documents. This post does not name a discoverer as settled; it records the conflict. Confidence in who found it first is graded medium, unlike the high confidence in the mechanism and the versions.

The AI provenance is part of the record rather than an aside. Codex mapped CRuby's pre-auth attack surface for Durendal and returned a handful of vulnerabilities in under 24 hours. Claude co-authored the fix. Anthropic is credited as a reporter. This case, plus the Java4Shell case covered earlier in this archive, is evidence for a pattern, not a measured industry trend.

The second overflow

The same release also fixes a separate bug in the same function, GHSA-87fm-7w84-j2px. It is an integer overflow in rb_str_casemap that produces a roughly 4 GB out-of-bounds write from a UTF-8 payload. Durendal demonstrated code execution with it against a Rails application pinned to Rack 3.2.0. Rack 3.2.2 and later block the payload with multipart size limits. This is a different bug from the one-byte overflow that Veria Labs calls Ruby2Shell.

What is demonstrated and what is claimed

Three things need separating. The one-byte write, the affected version ranges, the fix and the reachability through default Rails middleware are graded high: each is documented in a primary source and, for the path, confirmed at runtime by an independent team. Who found the bug first is graded medium because three groups have incompatible accounts and Ruby credits only one. Real-world exploit reliability is graded medium as well: the private demonstrations by Durendal and OpenAI were on stock applications, but success rates against arbitrary deployments with different allocators, WAFs and middleware stacks have not been measured.

On sources, the Ruby advisory and the upstream commit are the load-bearing primary documents. Durendal is the only public source that names the Rails path and the timeline. Veria Labs and the vendor writeups are secondary. Where a claim appears only in a secondary, this post labels it as such rather than passing it off as the primary's finding.

As of 20 November 2026 no public exploit existed, no in-the-wild exploitation had been reported, and EPSS was 0.00174 on 19 November, a figure computed before any public code-execution exploit appeared. Neither EPSS nor the absence of a KEV entry is a forecast. They describe the days before a public exploit, which is the window this post is written in.

Where this could be wrong

  • No public exploit existed as of 20 November 2026. The remote-code-execution result is demonstrated privately by Durendal and OpenAI and asserted by Ruby's advisory; the public cannot reproduce it yet. If Veria Labs publishes on 25 November 2026 and independent teams reproduce the chain, the claim moves from reported to verified. If it does not, the severity labels that assume a working chain lose their support.
  • Veria Labs has not published the Rails path or its exploit chain. Its default-reachability claim is corroborated by Durendal and Semgrep, not by Veria's own evidence.
  • The credit conflict is unresolved. Ruby's advisory does not mention Durendal or OpenAI, and Durendal says OpenAI reported the bug on 5 November 2026. Priority cannot be established from public documents.
  • MITRE's local-vector score is unexplained and conflicts with the demonstrated network path.
  • Exploitation reliability against real deployments is unknown. A fixed-value one-byte write needs heap grooming, and success rates in the wild are untested.
  • Vendor patch status is a 20 November 2026 snapshot. GitLab and GitHub may have shipped fixes after that date.
  • The Rodauth path and the api_only nuance come from Semgrep's reading, not a working exploit.
  • The claim that AI discovery is accelerating rests on this case and Java4Shell. It is not a measured trend across the industry.

This post was converted from a research dossier without fresh reporting. It sits below the house length target because the evidence is thin where it matters most: the exploit chain and the reliability against real deployments. That limit is stated here rather than filled with padding.

On this page

Sources

  1. Security advisories: multiple vulnerabilities in Regexp and String case conversionRuby, 2026
  2. Heap buffer overflow in case conversion of strings (GHSA-34m4-m9fh-gqp5)GitHub / Ruby, 2026
  3. Fix a heap buffer overflow in case mapping of the sharp s (d582f8f)Ruby, 2026
  4. CVE-2026-132825NIST NVD, 2026
  5. Ruby2ShellVeria Labs, 2026
  6. Yet another ẞugDurendal, 2026
  7. Ruby2Shell (CVE-2026-132825): Heap Overflow in RubySemgrep, 2026
  8. Ruby2Shell (CVE-2026-132825): Real RCE Risk or Just Hype?OX Security, 2026
  9. Ruby2Shell: critical Ruby RCE, affected versions and how to fix itAikido, 2026
  10. Ruby2Shell - RCE WAF RuleCrowdSec, 2026
  11. GitHub Enterprise Server 3.22 release notesGitHub, 2026

Frequently asked questions

What is Ruby2Shell CVE-2026-132825?

Ruby2Shell is the name Veria Labs gave to CVE-2026-132825, a one-byte heap buffer overflow in Ruby's case conversion for 14 legacy single-byte encodings. Ruby fixed it on 18 November 2026 in versions 4.0.10, 3.4.13 and 3.3.14. The bug has existed since Ruby 2.4.0 in 2016. The memory corruption is verified; the claim that it yields remote code execution before login is not publicly demonstrated yet.

Which Ruby versions are affected by Ruby2Shell?

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. The fixed releases are 4.0.10, 3.4.13 and 3.3.14, all published on 18 November 2026. Ruby 3.2 and older, back to 2.4.0 where the loop was introduced, have no fix because those series are end of life. Updating Rails or Rack does nothing; the Ruby interpreter itself must be upgraded.

How does Ruby2Shell reach Rails before login?

Rack::MethodOverride, which ships with Rails, calls upcase on the client-controlled _method form field. Rack also tags multipart parts with the charset the client declares. A multipart POST with a _method part tagged charset=ISO-8859-1 and holding 21 or more 0xDF bytes reaches the vulnerable conversion before routing, CSRF checks or authentication. Semgrep confirmed this path at runtime on Rails 8.1 and 7.2 but did not build an exploit.

Is there a public Ruby2Shell exploit?

No public exploit existed as of 20 November 2026. Veria Labs says it will publish its Rails exploit on 25 November 2026. Durendal and OpenAI say they demonstrated remote code execution privately on a stock rails new application. Ruby's advisory says it is aware of proof-of-concept exploits in some scenarios. No in-the-wild exploitation had been reported as of 20 November 2026, and EPSS was 0.00174 on 19 November, computed before any public exploit.

Who found Ruby2Shell?

Three groups have incompatible accounts and priority cannot be settled from public documents. Veria Labs published the writeup and the name. Durendal and OpenAI published the fuller timeline, with Moritz Sanft saying he found it on 23 October 2026 using Codex. Ruby's advisory credits Stephan Lipp of Ada Logics and Anthropic, and the fix commit carries a Claude co-author line. This post does not name a single discoverer.

Does Ruby2Shell affect every Rails application?

Full-stack Rails is exposed through the default Rack::MethodOverride middleware. Rails with config.api_only = true does not go through that middleware, though application code that upcases multipart parameters could still be affected. Classic Sinatra is exposed by default; modular Sinatra is not unless it enables method override. Plain Rack is exposed only if it mounts the middleware. Headers, JSON bodies and ordinary forms do not carry the bug.