Ruby2Shell (CVE-2026-132825): Ruby String Flaw, Detection, Fix
Ruby2Shell is a one-byte heap overflow in Ruby's case conversion. Why Rails is reachable before login, why scanners miss it, how to check and what to update.
Zyberum Security Team · Published · 12 min read
Ruby2Shell is the nickname for CVE-2026-132825, a one-byte heap overflow in the Ruby interpreter. It was fixed on 18 November 2026, the same day as the nginx HTTP/2 flaws, and it is the member of the 2Shell series that people argue about most: the Ruby maintainers call it critical, one vendor calls it “more marketing than actual risk”.
Both views have a point. This page explains the bug, who is reachable, why your dependency scanner says nothing, and what to do. In short: it is one update and one restart, but you have to find every Ruby first.
The facts in one table
| CVE | CVE-2026-132825 (assigned by MITRE, published 19 Nov 2026) |
| Advisory | GHSA-34m4-m9fh-gqp5, “Heap buffer overflow in case conversion of strings” |
| Component | The Ruby interpreter (CRuby): string case conversion. Not a gem, not Rails, not Rack |
| Bug class | Off-by-one: one byte written past the end of a heap buffer |
| Affected | Ruby 4.0.0 to 4.0.9, 3.4.0 to 3.4.12, 3.3.13 and earlier. Present since Ruby 2.4 |
| Fixed | Ruby 4.0.10, 3.4.13, 3.3.14 (18 Nov 2026). Ruby 3.2 and older are end of life and get no upstream fix |
| Severity | CVE record: 7.4 (CVSS 3.1, local vector). Red Hat: 9.8 (network vector). Ruby maintainers: critical, no score. Ubuntu: priority medium |
| Reach | Full-stack Rails and classic-style Sinatra: before login, in the default setup |
| In the wild | No confirmed exploitation as of 4 Dec 2026. Not in CISA KEV |
| Credit | Stephan Lipp (Ada Logics) and Anthropic, per the Ruby advisory. Veria Labs reports an independent find and coined the name |
The same Ruby releases fix six further memory safety bugs in regular expressions and case conversion. They share the affected and fixed versions, so the one update covers all seven.
Which systems are exposed?
Every unpatched Ruby has the bug, but only some applications let a stranger reach it. Three conditions have to come together: an affected interpreter, a string in one of 14 legacy single-byte encodings, and a case conversion of that string.
| Setup | Reachable without login? |
|---|---|
| Full-stack Rails | Yes, in the default configuration (Veria Labs) |
Rails with config.api_only = true | Not through the default middleware (Semgrep) |
Classic-style Sinatra (require 'sinatra') | Yes (Veria Labs) |
Modular Sinatra (Sinatra::Base) | No (Semgrep) |
| Rodauth with account creation | Yes, through a comparison before login (Semgrep) |
| Plain Rack and other frameworks | Not by default |
| Any code that case-converts external text in a legacy encoding | Yes, whatever the framework |
The last row is the one that a framework list cannot answer for you: importers for CSV files from old systems, mail processing, EDI and anything else that still handles ISO-8859-1 or Windows-1252.
Then there are the products that bring their own Ruby. An operating system update does not touch them. Fixed versions, as listed by Veria Labs and, for GitLab, in GitLab’s release note:
| Product | Fixed in |
|---|---|
| GitLab CE/EE | 19.6.1, 19.5.8, 19.4.10, with backports to 19.3.10, 19.2.11, 19.1.11, 19.0.12 and 18.11.15 |
| GitHub Enterprise Server | 3.22.6, 3.21.11, 3.20.13, 3.19.17 |
| Mastodon | 4.7.6, 4.6.12, 4.5.22, 4.4.29 |
| OpenProject | 17.9.8, 17.8.3 |
| Chatwoot | 4.20.1 |
| Discourse | base image 2.0.20261119-0203 |
- Step 1/5An affected interpreter. Ruby before 4.0.10, 3.4.13 or 3.3.14, including every end-of-life version back to 2.4.
- Step 2/5A string in a legacy encoding. ISO-8859-1, Windows-1252 and twelve relatives. UTF-8, the Ruby default, takes a different code path.
- Step 3/5A case conversion.
upcase,swapcase,downcase(:fold)orcasecmp?on that string. - Step 4/5The result: one byte is written past the buffer. The realistic outcome is a crashed worker. Code execution needs much more and is disputed.
- Step 5/5The fix removes the first condition. Update the interpreter and restart. Nothing else on this list is a repair.
How does Ruby2Shell work?
Upper-casing one particular character makes the string one byte longer than the conversion loop planned for. The advisory says it in one line: the case conversion “could write one byte past the end of the output buffer”.
The character is “ß”. In the single-byte encodings it is one byte (0xDF), and its upper-case form is “SS”, two bytes. Before writing, the loop checked that one byte was free and then wrote two. If the “ß” sits exactly where one byte is left, the second “S” lands outside the buffer.
- Step 1/5Ruby reserves an output buffer and converts the string byte by byte. Most characters turn into exactly one byte.
- Step 2/5The last free cell. The next input byte is 0xDF, the letter ß. The loop checks: is one byte free? Yes.
- Step 3/5The upper-case form of ß is "SS". The first S goes into the last cell.
- Step 4/5The second S has no cell left. It is written anyway, into whatever the allocator placed behind the buffer.
- Step 5/5The fix: before writing, the loop now makes sure that there is room for both bytes.
Two details limit what an attacker gets out of this. The overflowing byte is not chosen freely: it is the letter S. And it is exactly one byte. Veria Labs describes the result as a one-byte out-of-bounds write plus an out-of-bounds read when the result is copied.
How a request reaches it in Rails
A default Rails application upcases a form field before it knows who is asking, and the sender of the form can influence the field’s encoding. Veria Labs only states that Rails and classic Sinatra are reachable by default without authentication. The path below is the one Semgrep and Corelight describe.
- Step 1/5A client sends a POST with a multipart form body. No session, no login.
- Step 2/5Rack parses the form. A form part can declare its own charset, and Rack applies it. The application default of UTF-8 does not decide this.
- Step 3/5
Rack::MethodOverridereads the_methodform field and upcases it, so that HTML forms can send PUT, PATCH and DELETE. Semgrep: this runs before routing, CSRF protection and authentication. - Step 4/5The upcase runs in the interpreter, on a string in a legacy encoding. This is where the faulty loop sits.
- Step 5/5Routing, CSRF check and login would come next. The request never needed to get that far.
This is the pattern of the whole 2Shell series: the flaw is reached in a layer that runs before the application’s own checks.
How bad is it really?
A crash is realistic, code execution is disputed, and nobody has reported an attack. The positions, with their sources:
- The Ruby maintainers rate the flaw critical and write that they are “aware of PoCs that prove this flaw can be used to trigger RCE in some scenarios”.
- Veria Labs says it was the first to demonstrate remote code execution, against stock Rails. As of its last update on 29 November it had not published the proof of concept.
- watchTowr expects that exploitation in production needs a specific memory layout, allocator, runtime and application, plus a way around address randomisation, and considers denial of service the more likely outcome.
- OX Security calls the name “more marketing than actual risk”.
- The public study referenced from the CVE record reaches crashes and heap corruption. Its own README says it did not reach code execution.
- CISA rates exploitation as none and automation as no, and has not listed the flaw in KEV. One tracker shows an “in the wild” entry for 19 November and, on the same page, zero attacker addresses: that is a rule match, not a confirmed compromise.
Our reading: do not drop everything, and do not wait for the next quarterly cycle either. Crashing workers of an internet-facing Rails application is a problem on its own, and the history of the series is that reliable exploits appear after the argument about whether they are possible.
How to identify Ruby2Shell
You cannot probe for it from outside. Semgrep puts it plainly: “there is no safe request that tells a vulnerable server from a fixed one”. So you check versions, on every system that runs Ruby.
1. Find every Ruby
Look where the application runs, not where you are logged in. A host often has a system Ruby, a version manager with several more, and containers with their own.
# The interpreter on the path of this shell
ruby -v
# The interpreters that running processes actually use
for p in $(pgrep -f 'puma|unicorn|sidekiq|passenger|rails'); do readlink /proc/$p/exe; done | sort | uniq -c
# Inside an image
docker run --rm --entrypoint ruby your-image:tag -v
Fixed upstream versions are 4.0.10, 3.4.13 and 3.3.14.
2. On distributions, check the package, not the version string
Debian, Ubuntu and Red Hat patch their Ruby without raising the upstream version. ruby -v still shows an old number on a fixed system.
# Debian, Ubuntu
dpkg -l | grep -E '^ii +(ruby[0-9.]+|libruby[0-9.]+)'
# RHEL and relatives (command from the Red Hat bulletin)
rpm -q ruby ruby3.3 ruby4.0
| Release | Fixed package |
|---|---|
| Debian 13 (trixie) | ruby3.3 3.3.14-0+deb13u1 |
| Debian 12 (bookworm, LTS) | ruby3.1 3.1.7-1~deb12u2 |
| Ubuntu 26.10 | ruby3.3 3.3.8-2.2ubuntu4.1 |
| Ubuntu 26.04 LTS | ruby3.3 3.3.8-2ubuntu3.2 |
| Ubuntu 24.04 LTS | ruby3.2 3.2.3-1ubuntu0.24.04.9 |
| Ubuntu 22.04 LTS | ruby3.0 3.0.2-7ubuntu2.14 |
Official Docker ruby image | tags 4.0.10, 3.4.13, 3.3.14 |
Red Hat lists RHEL 8, 9 and 10 and several products as affected. Take the fixed package versions from the Red Hat CVE page for your release. Older Ubuntu releases get the fix through Ubuntu Pro.
3. Do not rely on the dependency scanner
bundler-audit and every tool that reads the Gemfile.lock look at gems. This flaw is in the interpreter. A green dependency report says nothing here. A software bill of materials helps only if it records the runtime of each image and not just the libraries.
4. Check whether your application is on the short path
If you cannot update at once, find out whether the default middleware is in play:
# Rails: is the middleware in the stack?
bin/rails middleware | grep -i MethodOverride
Semgrep has published a detection script (detect-ruby2shell.sh in its detection-scripts repository) that reads the interpreter version from running processes, checks package changelogs for the backport and looks for the middleware.
5. Look for traces
The realistic trace of an attempt is a crashed worker. Look for segmentation faults and “[BUG]” reports of the Ruby interpreter in the logs of your application servers, and for workers that the process manager restarted without a deploy. Corelight has published network rules that look for multipart posts with a _method field containing the byte 0xDF. They need to see the traffic after TLS termination, and a match is an attempt, not proof of code execution.
What to do
Update the interpreter, rebuild, restart. In that order, and verify the running version afterwards.
- Update Ruby to 4.0.10, 3.4.13 or 3.3.14, or install the fixed distribution package. On Ruby 3.2 or older there is no upstream fix: use a distribution that backports, or move to a supported line.
- Rebuild and redeploy images. A new base image tag does nothing until your image is rebuilt on it.
- Restart everything that runs Ruby: application servers, background workers, schedulers. A process started before the update keeps the old code.
- Update products that bundle Ruby: GitLab, GitHub Enterprise Server, Mastodon, OpenProject, Chatwoot, Discourse and whatever else your inventory shows.
- Verify with the process check from above, not with the package list.
Stopgaps until the update is through
Neither Ruby nor Veria Labs lists a workaround. The following are temporary measures from third parties. They narrow the default path and do not cover your own code that handles legacy encodings.
- Remove the middleware where you do not need it (Semgrep). In Rails:
config.middleware.delete Rack::MethodOverride. In Sinatra:disable :method_override. Side effect: HTML forms that send PATCH, PUT or DELETE through the hidden_methodfield stop working. Applications that only speak JSON usually do not need it. - Reject legacy charsets at the edge (Red Hat): block requests that declare ISO-8859-x or Windows-125x charsets and enforce UTF-8. Mind where you look: Semgrep warns that a rule searching the URL for
%DFlooks in the wrong place, because the bytes travel raw in the multipart body. - Restrict exposure of administrative and internal Rails applications. Corelight’s wording fits: these are “temporary exposure controls, not a repair”.
Hardening that limits the damage
What limits a successful exploit is the same as for every flaw in this series: application processes without root, no long-lived cloud credentials or database superuser within reach of the web process, outbound connections only to the destinations the application needs, and an alert on worker crashes.
What it means for a penetration test
A penetration test does not find Ruby2Shell by attacking it, and it should not try: crashing production workers proves nothing you could not read from a version number. What a test adds is the part around it. We check which interpreter versions really run behind your Rails and Sinatra applications and inside the products you operate, whether the path before login exists in your configuration, and what the web process could reach if one request did succeed: credentials, the database, the internal network.
That is the question behind every entry in the 2Shell overview, and the one a web application penetration test answers. The fix for this flaw is one update. The next one will again be in a layer you did not write, and how fast you can say where that layer runs is covered by your vulnerability management process.
FAQ
Frequently asked questions
Is my application affected if it only uses UTF-8?
Possibly yes. UTF-8 strings take a different code path and are not affected, but the encoding of a form field is not always yours to choose: according to Semgrep and Corelight, a multipart form part can declare its own charset, and Rack applies it. A full-stack Rails application that is UTF-8 everywhere can therefore still receive a string in a legacy encoding and upcase it before login.
Does bundler-audit or a Gemfile.lock scan find Ruby2Shell?
No. The flaw is in the Ruby interpreter, not in a gem. Dependency scanners that read the Gemfile.lock do not see it, and updating gems does not fix it. You have to check the version of the interpreter that actually runs the application, in every image and on every host.
Is Ruby2Shell exploited in the wild?
As of 4 December 2026 there is no confirmed exploitation. The flaw is not in the CISA KEV catalogue, and CISA rates exploitation as none. The Ruby maintainers say they know of proof-of-concept code that reaches code execution in some scenarios, and Veria Labs says it has demonstrated it. A public study of the flaw reaches crashes and heap corruption, not code execution.
Why do the severity scores differ so much?
Because the scorers answer different questions. The CVE record carries 7.4 with a local attack vector and high complexity, which describes the bug in the interpreter on its own. Red Hat scores 9.8 with a network vector, which describes a Rails application reachable without login. The Ruby maintainers call it critical without a score, Ubuntu sets the priority to medium. For planning, treat internet-facing Rails and Sinatra applications as the 9.8 case.
Is a restart needed after the update?
Yes. A process that was started before the update keeps running the old interpreter. Restart application servers and background workers, and rebuild and redeploy container images.
Sources
- Ruby: Multiple vulnerabilities in Regexp and String case conversion (18 Nov 2026)
- GitHub Advisory GHSA-34m4-m9fh-gqp5: Heap buffer overflow in case conversion of strings
- CVE record CVE-2026-132825
- Veria Labs: Ruby2Shell
- Red Hat Security Bulletin RHSB-2026-021
- Red Hat: CVE-2026-132825
- Ubuntu: CVE-2026-132825
- Debian security tracker: CVE-2026-132825
- GitLab patch release 19.6.1, 19.5.8, 19.4.10
- Semgrep: Ruby2Shell (CVE-2026-132825)
- Corelight: Ruby2Shell detection
- OX Security: Ruby2Shell, is it an actual risk?
- watchTowr: Ruby CVE-2026-132825 FAQ
- SecurityWeek: Ruby patches Ruby2Shell vulnerability that could lead to RCE
- CISA: Known Exploited Vulnerabilities Catalog
Related pages
- InsightsThe 2Shell Vulnerabilities: React, PHP, Brotli, Java, NGINX, RubyReact2Shell, PHP2Shell, HTTP2Shell, Java4Shell, NGINX2Shell, Ruby2Shell: what the 2Shell flaws have in common, which are exploited and what to do first.
- InsightsPHP2Shell (CVE-2026-109618/109619): Analysis, Detection, FixPHP2Shell: two memory corruption bugs in the PHP core allow unauthenticated RCE. The longjmp and stale-global mechanics, how to detect them and what to do.
- InsightsJava4Shell (CVE-2026-114938): JVM Base64 Flaw, Detection, FixJava4Shell is a heap overflow in the OpenJDK Base64 decoder on AVX-512 CPUs. How the masked store goes wrong, which systems are exposed, how to check and fix.
- InsightsNGINX2Shell (CVE-2026-123007): nginx HTTP/2 Flaws, Detection, Fixnginx 1.31.9 and 1.30.7 fix two HTTP/2 memory bugs and eight further issues. Which setups are exposed, how to check them and why a reload is not enough.
- GlossaryCVECVE (Common Vulnerabilities and Exposures) gives every public vulnerability one ID. How CVE records are created, what they contain and how to use them.
- InsightsVulnerability Management: A Process That Works in PracticeHow to set up vulnerability management that holds: sources, triage with CVSS and exploit data, SLAs by severity, SBOM, coordinated disclosure and the duties the CRA adds.
- ServicesYour web app has a login. We check what is behind it.Manual web application and API pentests beyond the scanner: business logic, access control (IDOR, BOLA, BFLA), authentication and OWASP Top 10. Fixed price.
