Ruby2Shell: a one-byte overflow in Ruby's upcase gives pre-auth RCE on stock Rails, found three times over with AI help
Ruby 4.0.10, 3.4.13 and 3.3.14 fix seven memory-safety bugs, including a heap overflow triggered by uppercasing the German sharp s in legacy encodings. Two teams say it yields unauthenticated code execution on a default Rails app. Here is how it works, who found it and what to patch.
The Ruby core team released Ruby 4.0.10, 3.4.13 and 3.3.14 on November 18, 2026, alongside a security advisory covering seven memory-safety bugs in string case conversion and the regular expression engine. One of them, GHSA-34m4-m9fh-gqp5, is a one-byte heap overflow that fires when Ruby uppercases the German sharp s (ß) in a legacy single-byte encoding. A day later, the security firm Veria Labs gave it a name, Ruby2Shell, and said it has remote code execution, without authentication, against a stock Rails application.
The bug has been in every Ruby release since 2.4.0, which shipped in December 2016. What makes this disclosure unusual is how many people arrived at the same byte at the same time. The Ruby advisory credits Stephan Lipp of Ada Logics and Anthropic. Moritz Sanft of Durendal found it separately with OpenAI’s Codex and published his own account. Veria says it found it independently too. It is the third “2Shell” in six weeks, after Broccoli2Shell in October and Java4Shell two days earlier, and the first where the AI-assisted finders visibly collided.
How the bug works
Most of Ruby’s single-byte encodings have no capital form of ß, so uppercasing it produces two bytes, SS. Per Sanft’s write-up, the per-encoding case_map functions (he cites enc/iso_8859_1.c) loop while at least one byte of output space remains, then write both bytes of SS without checking for the second. The caller, rb_str_casemap in string.c, sizes the output buffer at the input length plus 20 bytes. Each ß grows the output by one byte, so a string of 21 sharp s characters overruns the buffer by exactly one byte.
Sanft’s minimal trigger is two lines: build a 21-byte string of 0xDF, tag it as ISO-8859-1, and call upcase. The same path is reachable through swapcase, downcase(:fold) and casecmp?, and the matching Symbol methods. The byte written out of bounds is fixed: S (0x53) when uppercasing, s (0x73) when case-folding. Sanft 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. UTF-8 strings take a different code path and are not affected by this bug.
A single constant byte past the end of a heap buffer sounds weak, but the Ruby team’s own wording is direct: it is aware of proofs of concept showing the flaw can be used for remote code execution in some scenarios.
How a request reaches it
The interesting part is the route from the network to upcase. Sanft points to Rack’s method override middleware, which Rails enables by default so HTML forms can send PUT and DELETE. It reads a _method field from a multipart form body and calls .upcase on the value. A multipart part can declare its own charset, so the attacker chooses the encoding: declare ISO-8859-1, send sharp s bytes, and an unauthenticated POST to any route reaches the vulnerable loop before the application’s own code runs.
That is why Veria marks Rails and classic-style Sinatra as affected in their default configuration, and other frameworks and plain Rack as not exposed by default. Application code that changes the case of strings received in a legacy encoding can be vulnerable regardless of framework.
Sanft covers a second bug in the same function, GHSA-87fm-7w84-j2px: rb_str_casemap tracks the output length in an int, which overflows when a huge string of characters that expand on uppercasing is processed. His example is about 716 million copies of U+0390 (a Greek letter that goes from 2 bytes to 6), producing an out-of-bounds write of roughly 4 GB. Over HTTP, he says, that one only works against Rack 3.2.1 and earlier, because Rack 3.2.2 added multipart field size limits. The Ruby advisory credits that bug to a HackerOne reporter, baba__yaga, so it too was found more than once.
Who found it, and how
Sanft’s timeline is the most detailed. He says he started on October 23 by asking Codex to map the parts of CRuby that a Rails app exposes before authentication, got findings back in under 24 hours, then triaged them and steered the model toward the promising ones. He does not give the model version or the token cost. By October 26 he had an exploit against a toy Rails app. He then brought in a researcher at OpenAI, and by his account they had code execution against a plain rails new app using jemalloc on November 4, and against the default glibc allocator on November 6. OpenAI reported both bugs to the Ruby security team on November 5 and sent working exploits two days later. Patch candidates were reviewed on November 10, more issues were found, and the fixes shipped on November 18.
The official credit for the sharp s bug goes elsewhere: Stephan Lipp of Ada Logics and Anthropic, who are also credited with three of the regex bugs in the same advisory (a double free in pattern compilation, an out-of-bounds read in case-insensitive matching, and a heap overflow in Regexp#to_s). The advisory does not say how they found them. Veria, for its part, says it found the bug independently and was first to demonstrate code execution, a claim Sanft’s dated timeline at least complicates.
Seen together, three groups using or working alongside AI tooling converged on a nine-year-old bug within a few weeks, in code that had been fuzzed and read by humans for most of a decade. That is the same pattern as Java4Shell, where the cost of the audit was the headline. Here the lesson is about collisions: if several teams can find the same bug in the same month, it is safe to assume people who do not file advisories can as well.
What to patch, and what is still unknown
Ruby itself. Upgrade to 4.0.10, 3.4.13 or 3.3.14. The advisory lists Ruby 3.3.13 and earlier, 3.4.0 to 3.4.12 and 4.0.0 to 4.0.9 as affected. Ruby 3.3 is in security maintenance; 3.2 and older are end of life and will not get the fix, though Veria says the bug goes back to 2.4.0. Neither source gives an application-level workaround. Updating Rack alone does not close the sharp s path.
Self-hosted Rails products. Veria lists fixed releases for GitLab (19.6.1, 19.5.8, 19.4.10), Mastodon (4.7.6, 4.6.12, 4.5.22, 4.4.29), Chatwoot (4.20.1), OpenProject (17.9.8, 17.8.3) and the Discourse base image (2.0.20261119-0203). It lists GitHub Enterprise Server 3.22.5 and earlier as affected with no fix available yet. Those version lists are Veria’s, so confirm against each vendor’s own advisory.
Open questions. Neither Veria nor Sanft has published the exploit details: there is no public description of how a single fixed byte becomes code execution, or how reliable it is. Sanft writes that the bugs should yield pre-auth RCE on GitHub and GitLab but does not say he tested either. Veria says it will publish a proof of concept for stock Rails on November 25, or later if major vendors have not shipped fixes. No source reports exploitation in the wild as of November 20. There is no CVSS score in either write-up, and the identifiers disagree: Veria uses CVE-2026-132825, while the Ruby advisory says CVE numbers have been requested but not yet assigned.
The practical deadline is November 25. A public exploit for an unauthenticated bug in default Rails, with the trigger already documented down to the byte count, leaves very little room for a slow upgrade cycle.
Get Insanely Good at AI
The book for developers who want to understand how AI actually works. LLMs, prompt engineering, RAG, AI agents, and production systems.
Keep Reading
How to Secure AI Agents With Google ADK
Learn how to secure your autonomous workflows and prevent unauthorized actions using Google ADK's hardware-backed tool binding and execution logs.
Java4Shell: an AI-assisted audit found a pre-auth RCE in OpenJDK's Base64 decoder for under $200 in tokens
Oracle and OpenJDK patched CVE-2026-114938 on November 17, a heap overflow in HotSpot's AVX-512 Base64 intrinsic that Calif says it found with OpenAI Codex in about an hour and turned into remote code execution in Jira, Confluence, Keycloak and Jenkins. Here is how the bug works, who is affected and what to do.
Broccoli2Shell: the Brotli Bug Gets a Census, and OpenAI Codex Security Gets the Credit
The Broccoli2Shell site published October 25 maps CVE-2026-111497 across every ecosystem: vendored copies in .NET, DuckDB, and Apache Arrow remain unfixed, non-C decoders are clean, and the original bug report came from OpenAI Codex Security.
HTTP2Shell: the Brotli Bug Behind PHP2Shell's Naming Season Reaches Node and Python
CVE-2026-111497, an out-of-bounds write in the Brotli decoder bundled with Node.js, escalated October 23 into 'HTTP2Shell' as Aikido confirmed Python HTTP libraries using Brotli are affected too; fixed Node releases shipped October 21 with no workaround for outbound fetch paths.
Microsoft's Ignite model drop: MAI Cyber 2 Flash, Code 2, Realtime 1 and Decision 1.1 aim at price, not the frontier
At Ignite on November 17, Microsoft AI announced seven first-party models, from a 1M-context security model priced at $0.50 per million output tokens to coding models in GitHub Copilot and an OpenAI-compatible speech-to-speech model at $0.01 a minute. Here is what each does, where it runs and what the benchmark fine print says.