Ruby2Shell Explained: The ß That Overflows Ruby's Heap

By 11 min read
Ruby2Shell, the Ruby interpreter heap overflow CVE-2026-132825 in string case conversion

Ruby2Shell is what happens when the German letter ß meets a buffer that was one byte too short. Uppercase it in an old Latin-1 string and Ruby turns one character into two (“SS”), but before the fix it only checked that there was room for one.

In short: Ruby2Shell (CVE-2026-132825) is a one-byte heap overflow in the Ruby interpreter’s case conversion that researchers say an unauthenticated request can reach in default Rails and Sinatra apps. Ruby fixed it on 18 November 2026 in 4.0.10, 3.4.13 and 3.3.14, and only upgrading Ruby itself, then restarting, removes it.

What is Ruby2Shell?

Ruby2Shell is a heap buffer overflow in the Ruby interpreter’s string case conversion, tracked as CVE-2026-132825 and GitHub advisory GHSA-34m4-m9fh-gqp5. Some write-ups spell it “ruby2ßhell”. A heap buffer overflow means the program writes past the end of a block of memory it allocated, corrupting whatever sits next to it.

Ruby’s own advisory describes it plainly: when changing the case of a string in some single-byte encodings, Ruby “could write one byte past the end of the output buffer.” Veria Labs, the firm that named the bug and says it was first to demonstrate code execution with it, adds that the output buffer is sized at the input length plus 20 bytes, and the conversion loop checked for one free byte but wrote two.

Who found it?

Credit is shared and slightly contested. Ruby’s advisory credits Stephan Lipp of Ada Logics and Anthropic for this flaw and three of the other six. Veria Labs says it found the bug independently, and its page also credits researcher Moritz Sanft, working with OpenAI. None of the sources settles who was first, and it does not change what defenders need to do.

Four headline figures: seven Ruby flaws fixed, one byte overflow, CVSS 7.4, zero KEV entries
Ruby2Shell is small in bytes and moderate in score, but it sits inside the interpreter every Ruby app runs on. Data: Ruby, MITRE CNA, CISA KEV.

Why does Ruby2Shell matter now?

It is the latest in a run of named “2Shell” interpreter and server bugs this autumn. CrowdSec framed it as Ruby’s turn after PHP2Shell and Java4Shell, and Sonatype titled its write-up “November2Shell”. We covered the neighbours in phpAfterShell, the PHP session flaw PHP2Shell’s fix missed and Java4Shell’s 65 characters that corrupt the Java heap.

What makes Ruby2Shell different is where it lives. Because the flaw is in the interpreter, Rails version, Gemfile.lock and bundle update are irrelevant. Sonatype, CrowdSec and Netics all make the same point: this is an inventory problem first. You need to know every Ruby binary running in production, including the ones hidden in containers and vendor appliances.

The 18 November release fixed seven bugs

Ruby2Shell was one of seven memory-safety issues in a single advisory. Only Ruby2Shell had a CVE at publication; Ruby said identifiers for the rest had been requested.

Advisory Component Bug class Ruby’s PoC statement
GHSA-34m4-m9fh-gqp5 (CVE-2026-132825) String case conversion One-byte heap overflow RCE PoC exists
GHSA-7x2q-68qv-6p8x Regexp compilation Double free RCE PoC exists
GHSA-87fm-7w84-j2px String case conversion Integer overflow to heap overflow RCE PoC exists
GHSA-3p8q-wmhx-vm2w Regexp compilation Integer overflow to heap overflow RCE PoC exists
GHSA-7whj-cfh7-xgm4 Regexp#to_s Heap buffer overflow RCE PoC exists
GHSA-wpqw-5qxg-m68r Case-insensitive Regexp matching Out-of-bounds read Memory corruption
GHSA-pvgc-g7gj-pv6h Case-insensitive backreferences Out-of-bounds read None stated

Ruby says it is aware of proofs of concept that reach code execution “in some scenarios” for five of the seven. Those PoCs were not public when Ruby published.

How does Ruby2Shell work?

The sources describe the mechanism clearly enough to understand it without exploit code. This is the conceptual version.

Why does ß break the buffer?

Most letters keep their length when you change case. The German sharp s (byte 0xDF in Latin-1) does not: its uppercase form is the two letters “SS”. In roughly 14 ISO-8859 and Windows-125x encodings, Ruby’s conversion loop wrote both bytes after checking room for only one. With enough ß characters, the output runs one byte past its heap allocation.

According to Veria Labs and OX Security, the affected methods are upcase, swapcase, capitalize, casecmp? and downcase(:fold) on strings in those encodings. UTF-8 strings are not affected.

What is the overflow worth to an attacker?

One byte sounds harmless. Astra cites a public AddressSanitizer reproduction in which that single byte lands on the size field of the next heap chunk in glibc. Corrupting a chunk size is a classic first step toward wider heap corruption, which is why Ruby and Veria treat it as a code execution risk. The result depends heavily on the heap layout of the specific process.

How does a request reach it in Rails?

This is the part that turned a niche bug into headline news. Veria Labs and CrowdSec describe the default Rails path: Rack’s method override middleware reads the _method form field on POST requests and uppercases it, before any controller or login check runs. A multipart form part can declare its own charset, such as ISO-8859-1, so the string arrives in a vulnerable encoding.

Veria says classic-style Sinatra apps are exposed the same way, while other frameworks and plain Rack apps are not exposed by default. Any application code that tags user input with a legacy encoding and then changes its case can also reach the bug.

Six-stage conceptual flow showing how a Ruby2Shell request reaches the heap overflow in default Rails
Every step before the overflow is normal framework behaviour, which is why no login is needed. Data: Veria Labs, CrowdSec, Ruby advisory.

How severe is Ruby2Shell really?

The sources disagree more than usual, and the disagreement is useful.

Source Verdict
MITRE CNA CVSS 3.1 7.4 High, local vector, high complexity
GitHub advisory Labelled Critical, no score
Veria Labs Critical, network reachable without authentication
OX Security “More Marketing Than Actual Risk”; upgrade, but not ASAP
watchTowr (to SecurityWeek) Production exploitation challenging; denial of service most likely
Ubuntu Medium priority, per Rescana

The case for caution

OX Security argues that turning a one-byte write into reliable code execution needs heap grooming tailored to each target, and a miss tends to crash the process. Yordan Ganchev of watchTowr told SecurityWeek that the most likely outcome of malformed requests is denial of service. Rescana recorded an EPSS score of 0.00174 on 19 November, which is low.

The case for urgency

Ruby itself says RCE PoCs exist. Veria says it demonstrated RCE on stock Rails and planned to publish a PoC on 25 November 2026, or later if major vendors had not shipped fixes. Its page was last updated on 29 November and still described the PoC as upcoming; we could not confirm whether it has been released. Even if RCE stays hard, a request that crashes Puma or Unicorn workers on demand is a real availability problem.

What is the honest reading?

It is not magic. Ruby2Shell needs a legacy encoding, a case-changing call and a favourable heap. But default Rails satisfies the first two for anyone on the internet, so internet-facing Rails and Sinatra apps should be patched this week, not this quarter.

Who is affected by Ruby2Shell?

Ruby branch Vulnerable Fixed in
4.0 4.0.0 to 4.0.9 4.0.10
3.4 3.4.0 to 3.4.12 3.4.13
3.3 3.3.13 and earlier 3.3.14
3.2 and older All, back to 2.4.0 per Veria No fix (end of life)

Ruby 3.3 is in its final maintenance phase, with support scheduled to end at the end of March 2027, according to the 3.3.14 release notes.

Exposure on the internet

Netics, citing Censys data from 19 November, reported about 4,500 internet-facing WEBrick hosts. Roughly 2,000 ran end-of-life Ruby 2.4 to 3.2, 285 ran a supported branch at a vulnerable version, and none ran a fixed release yet. WEBrick is only one Ruby web server, so treat this as a sample, not a total.

Bar chart of WEBrick hosts on vulnerable and end-of-life Ruby versions the day after disclosure
The day after disclosure, almost half of the visible WEBrick hosts ran a Ruby that will never get this fix. Data: Censys, as reported by Netics.

Self-hosted products that bundle Ruby

Many teams run Ruby without writing any. Veria Labs lists these products and their fixed releases:

Product Affected Fixed
GitLab 19.6.0 and earlier 19.6.1, 19.5.8, 19.4.10
GitHub Enterprise Server 3.22.5 and earlier 3.22.6, 3.21.11, 3.20.13, 3.19.17
Mastodon 4.7.5 and earlier 4.7.6, 4.6.12, 4.5.22, 4.4.29
OpenProject 17.9.7 and earlier 17.9.8, 17.8.3
Chatwoot 4.20.0 and earlier 4.20.1
Discourse Base image before 2.0.20261119-0203 2.0.20261119-0203

How to check your exposure

Rescana and Sonatype suggest checking the Ruby that actually serves requests, not just the one on your laptop:

  • Run ruby -v as the application user, or log RUBY_DESCRIPTION at boot.
  • On hosts, list packages with dpkg -l 'ruby*', rpm -qa 'ruby*' or apk info -v ruby ruby-libs, and check the changelog for CVE-2026-132825. Distribution backports may not change the version string.
  • Inspect container images; official ruby images compile Ruby from source, so some SBOM tools may miss the interpreter.
  • After patching, look for processes still mapping a deleted libruby in /proc/*/maps, which means they never restarted.

How do you detect Ruby2Shell attempts?

None of the sources publishes indicators of compromise or an ATT&CK mapping. The closest technique is T1190, Exploit Public-Facing Application, and detection relies on behaviour.

Request patterns

  • POST requests with a multipart part that declares a legacy charset such as ISO-8859-1 or Windows-1252, especially on login and other pre-authentication routes.
  • A _method field that is long or full of 0xDF bytes. A valid _method is a short word like PATCH or DELETE, so anything else is suspect.

Process and log signals

Rescana lists the crash signatures to watch for: exit codes 139 (segmentation fault) and 134 (abort), Ruby [BUG] lines in error output, and bursts of worker restarts in Puma, Unicorn, Passenger or Sidekiq. A shell, curl or wget spawned by a Ruby worker is a strong signal for any successful RCE.

WAF coverage

Cloudflare added managed rules on 20 November for CVE-2026-132825 and for the related integer overflow GHSA-87fm-7w84-j2px, blocking by default on all plans including Free. Cloudflare said it found no indication of compromise on its own systems and expected scanning to follow. CrowdSec published a free virtual-patching rule, crowdsecurity/vpatch-CVE-2026-132825, which covers the default Rails pre-login path but not your own code. Both vendors present WAF rules as a stopgap.

Timeline of Ruby2Shell from the October fix commit to the planned November proof of concept
WAF rules arrived two days after the fix; the public PoC was planned for one week after. Data: Ruby, Astra, Veria Labs, Cloudflare, SecurityWeek.

How do you fix Ruby2Shell?

  1. Upgrade Ruby to 4.0.10, 3.4.13 or 3.3.14, or your distribution’s patched package. Start with internet-facing Rails and classic Sinatra apps.
  2. Restart every Ruby process. Web workers, Sidekiq and other job runners keep the old interpreter in memory until they restart.
  3. Rebuild and redeploy container images from a fixed base image, then confirm the running version.
  4. Update self-hosted products that bundle Ruby, such as GitLab and GitHub Enterprise Server, to the fixed releases listed above.
  5. Plan off Ruby 3.2 and older. No upstream fix exists. Until you migrate, put those apps behind a VPN or IP allowlist and a WAF rule.
  6. Enable a WAF rule as a temporary layer while you patch, not instead of patching.
  7. Review your own code for force_encoding or encode to ISO-8859 or Windows-125x followed by case changes, and for Regexp.new, Regexp.union or interpolation with untrusted input, which the other six bugs need.

Ruby2Shell vs other “2Shell” bugs

  Ruby2Shell phpAfterShell Java4Shell
Where Ruby interpreter PHP session handler OpenJDK Base64 decoder
CVE CVE-2026-132825 CVE-2026-126714 CVE-2026-114938
Bug class One-byte heap overflow Non-atomic file write 62-byte heap overwrite
Default exposure Rails, classic Sinatra Default files handler x86-64 with AVX-512 VBMI
Fix type Upgrade interpreter Upgrade PHP Upgrade JDK

The shared lesson: when the bug is in the runtime, dependency scanners that read lock files miss it. The same pattern showed up in our nginx2root breakdown, where the fix lived in the server binary, not the app.

What is still unknown?

  • PoC status. Veria planned to publish on 25 November; its page, updated 29 November, still described it as upcoming. Whether it is out now is unconfirmed.
  • Attack vector. MITRE says local and high complexity; Veria and the GitHub advisory treat it as remote and unauthenticated. The score may change.
  • The other six CVEs. As of the sources reviewed, none of the other six advisories had a CVE, so scanners keyed on CVE IDs may not flag them.
  • Real-world reliability. OX and watchTowr think RCE is hard; Ruby and Veria say they have it. No independent party has published a working exploit against a production app.

The bottom line

Ruby2Shell is a one-byte overflow in the Ruby interpreter that default Rails and Sinatra apps reach before login. Reliable code execution may be hard, but crashes are easy and the fix is simple: upgrade Ruby to 4.0.10, 3.4.13 or 3.3.14, rebuild your images and restart every worker. If you still run Ruby 3.2 or older, this is the bug that should end that.

Sources

This article is written for defenders and authorised security testers. Only test systems you own or have written permission to assess.

Frequently asked questions

What is Ruby2Shell?

Ruby2Shell is the name Veria Labs gave to CVE-2026-132825 (GHSA-34m4-m9fh-gqp5), a one-byte heap buffer overflow in the Ruby interpreter's string case conversion for legacy single-byte encodings such as ISO-8859-1 and Windows-1252.

Which Ruby versions are affected by CVE-2026-132825?

Ruby 4.0.0 to 4.0.9, 3.4.0 to 3.4.12 and 3.3.13 and earlier are affected. The fixed releases are 4.0.10, 3.4.13 and 3.3.14. Ruby 3.2 and older are end of life and get no fix.

Does bundle update fix Ruby2Shell?

No. The bug is in the Ruby interpreter, not in Rails or any gem. You need a fixed Ruby binary, rebuilt container images and a restart of every Ruby process.

Is Ruby2Shell being exploited in the wild?

Not according to the sources reviewed for this article. No in-the-wild exploitation had been reported, and CVE-2026-132825 was not in CISA's Known Exploited Vulnerabilities catalog as of version 2026.11.27.

Are Rails apps vulnerable to Ruby2Shell by default?

Veria Labs says yes: default Rails and classic-style Sinatra apps upcase a form field before any login check, so an unauthenticated request can reach the bug. Other frameworks and plain Rack are not exposed by default, per Veria.

Why is Ruby2Shell rated 7.4 if it can lead to RCE?

MITRE's CVSS 3.1 vector uses a local attack vector and high complexity. The GitHub advisory labels it Critical and Veria rates it critical. The sources disagree, so judge it by whether your apps are internet-facing Rails or Sinatra.

Is UTF-8 text affected by Ruby2Shell?

No. The overflow only happens in about 14 legacy single-byte encodings in the ISO-8859 and Windows-125x families. The risk comes from requests or code that tag text with one of those encodings.

Which self-hosted products bundle a vulnerable Ruby?

Veria Labs lists GitLab, GitHub Enterprise Server, Mastodon, Discourse, OpenProject and Chatwoot. Each has shipped fixed releases, such as GitLab 19.6.1, 19.5.8 and 19.4.10 and GitHub Enterprise Server 3.22.6.

Keep reading

Ruby2ShellCVE-2026-132825RubyRuby on Railsheap overflowvulnerability managementpatch management