Ruby2Shell (CVE-2026-132825): How to Check and Patch Rails Apps
The Solo Toolbox · Software Help for One-Person Businesses
Ruby2Shell (CVE-2026-132825) is a one-byte heap overflow in how the Ruby interpreter changes the case of a string, and researchers say a default Rails app reaches it before login. The fix is to upgrade to Ruby 4.0.10, 3.4.13 or 3.3.14 and then restart every app server and worker; bundle update does nothing, because the bug is in Ruby itself, not in a gem.
Ruby released the fixed versions on November 18, 2026, along with patches for six related memory bugs. This guide shows how to find the Ruby version your app is really running, how to upgrade it, which self-hosted products bundle an affected Ruby, and what to do if you can’t patch today.
Before you start
- You’ll need: shell access to the server or container that runs your Ruby app, and permission to deploy and restart it.
- Applies to: CRuby 2.4.0 through 3.3.13, 3.4.0 through 3.4.12, and 4.0.0 through 4.0.9. JRuby and TruffleRuby do not share these memory bugs, according to Semgrep’s testing.
- Time: 5 minutes to check; 30 minutes or more to upgrade and redeploy.
- How we checked this: Ruby’s official security advisory and release notes, Semgrep’s technical analysis and Cloudflare Radar’s ruby2shell notice, all read on November 22, 2026. We did not run an exploit, and none of these sources reports attacks in the wild so far.

What Ruby2Shell is
The German letter ß becomes two letters, SS, when uppercased. In 14 older single-byte encodings, including ISO-8859-1 and Windows-1252, Ruby checked for room for one more byte and then wrote two. A string of 21 or more ß characters pushes one byte past the end of the buffer. Ruby’s advisory says proof-of-concept code turns that into remote code execution “in some scenarios”, and Ruby rates the flaw critical. The CVE record scores it 7.4 because it was assessed as a local attack.
The methods that reach the bug are upcase, swapcase, downcase(:fold) and casecmp?, plus their bang and Symbol forms. UTF-8 strings take a different code path and are not affected.
Why default Rails apps are exposed
Rails forms that need PUT, PATCH or DELETE send a hidden _method field. The Rack::MethodOverride middleware reads that field and upcases it. In a multipart form, each part can declare its own character set, and Rack keeps it. Semgrep confirmed on Rails 8.1 and 7.2, Sinatra 4.2 and 3.2, and Rack 3.2 and 2.2 that the value reaches upcase with the client’s chosen encoding, before routing, CSRF checks or authentication.
| Setup | Exposed by default? |
|---|---|
| Rails, full stack | Yes |
Rails with config.api_only = true | Not through the middleware; your own code can still be |
Sinatra, classic style (require 'sinatra') | Yes |
Sinatra, modular (Sinatra::Base subclass) | No, unless it enables method_override |
| Plain Rack | Only if the app mounts Rack::MethodOverride |
Rodauth with create_account | Yes, through a casecmp? on the sign-up form |
Your own code matters too. In Rails, multipart text parameters keep the client’s charset even in API mode, so a params[:name].upcase in a controller is the same bug through a different door.
Step 1: Find the Ruby version your app is running
Typing ruby -v in your shell often checks the wrong interpreter. Version managers, system packages and bundled copies mean one server can have several Rubies. Check from inside the app:
cd /path/to/your/app
bin/rails runner 'puts RUBY_DESCRIPTION'
Then confirm what the running processes use, since a worker started before an upgrade keeps the old code in memory:
pgrep -af 'puma|unicorn|passenger|sidekiq'
sudo readlink /proc/PID/exe
Replace PID with each process ID, then run the path that readlink prints with -v. For containers, run docker exec CONTAINER ruby -v for each running container.
Compare the result with this table:
| Ruby series | Affected | 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.0 to 3.3.13 | 3.3.14 |
| 3.2 and older | Back to 2.4.0 | No fix; end of life |
If you patched for Ruby’s October 23 regex release, you are on 4.0.9, 3.4.12 or 3.3.13, the newest versions this bug affects. Being recently updated doesn’t help here.
Ruby installed from Debian, Ubuntu, RHEL or SUSE packages is a special case: distributions backport fixes without changing the version number. Check your distribution’s security tracker for its Ruby package. Semgrep reported that Debian, Ubuntu and SUSE had not shipped a fix as of November 19.
Step 2: Upgrade Ruby
Pick the fixed release in the series you already use, so you don’t take on a major upgrade at the same time.
- rbenv: run
rbenv install 3.4.13(or 4.0.10 or 3.3.14). If the version isn’t found, update ruby-build first. - Docker: change your base image to a fixed tag, such as
FROM ruby:3.4.13, and rebuild. The officialrubyimages have fixed tags for all three versions. - Update
.ruby-versionand therubyline in yourGemfileif you pin one, then runbundle installsoGemfile.lockrecords the new version. - Run your test suite, then deploy.
- Restart every process: web servers, background job workers and any long-running consoles. Run the Step 1 checks again to confirm each one reports the fixed version.
If you are still on Ruby 3.2 or older, there is no patched release. Moving to 3.3.14 is the smallest supported jump, but expect gem compatibility work.
Self-hosted apps that bundle their own Ruby
Some products ship an embedded Ruby, so upgrading the system Ruby won’t fix them. Semgrep and Veria Labs reported this status on November 19, 2026; check each vendor’s release notes for anything newer.
| Product | Status on November 19 |
|---|---|
| GitLab self-managed | 19.6.0 bundles Ruby 3.3.13; no fixed release yet |
| GitHub Enterprise Server | 3.22.5 bundles Ruby 4.0.9; no fixed release yet |
| Mastodon | Fixed in 4.7.6, 4.6.12, 4.5.22 and 4.4.29; source installs must upgrade Ruby themselves |
| Discourse | New base image carries Ruby 4.0.10; each forum is fixed after a rebuild |
| OpenProject | Fixed in 17.9.8 |
| Chatwoot | 4.20.0 bundles Ruby 3.4.4; no fixed release yet |
For a product with no fix yet, Semgrep recommends putting it behind a VPN or an IP allowlist until one ships. GitLab administrators can use our earlier GitLab CVE-2026-97229 guide for the version check and upgrade steps.
If you can’t upgrade today
Neither Ruby nor Veria Labs lists a workaround other than upgrading. Two things reduce exposure in the meantime:
- Cloudflare WAF: Cloudflare Radar says its Free and Managed Rulesets include ruby2shell rules with Block as the default action, on free and paid plans. Cloudflare calls them a compensating control, not a fix.
- Restrict access: admin panels, staging servers and internal tools built on Rails can go behind a VPN or allowlist until they’re patched.
Semgrep also warns that a WAF rule looking for repeated %DF in URLs misses the attack, because the bytes travel raw inside a multipart body.
The six other bugs in the same release
Ruby’s advisory fixes six more memory bugs, listed only by GitHub advisory ID. Most need your code to build a regular expression from user input. Search your codebase for Regexp.new(params and similar calls without Regexp.escape. Semgrep also notes that a Rails server in development mode compiles request text into a regex at /rails/info/routes, so a dev server reachable from other machines is exposed.
Frequently asked questions
Is Ruby2Shell being exploited?
No attacks had been reported as of November 22, 2026. Veria Labs said on November 19 that it would publish a proof of concept about a week after disclosure, so patch before then.
Can I scan my server to test whether it’s vulnerable?
No. A patched and an unpatched Ruby return identical results, and the fix leaves no marker. Only the version of the running interpreter tells you. Semgrep’s free detection scripts read that version from running processes and containers.
Does this affect WordPress or PHP sites?
No. It is a Ruby interpreter bug. PHP had its own critical flaw in October; see our PHP2Shell guide for that one.
What to do next
List every server, container and hosted service that runs Ruby, including tools you didn’t write, such as GitLab or Discourse. Upgrade the ones you control to 4.0.10, 3.4.13 or 3.3.14, restart them, and confirm the running version. For products waiting on a vendor fix, restrict access and check their release notes daily this week.
Related guides
Sources
- Ruby: Security advisories, multiple vulnerabilities in Regexp and String case conversion (November 18, 2026)
- Semgrep: Ruby2Shell (CVE-2026-132825), heap overflow in Ruby
- Cloudflare Radar: ruby2shell notice and WAF coverage (reviewed November 19, 2026)
- Semgrep detection scripts for CVE-2026-132825
Last checked: November 22, 2026. Vendor fix status changes quickly. If something here is out of date, let us know.
