Ruby2Shell Patch Alert: Upgrade Ruby on Your Rails or Sinatra App Now
Quick answer: A Ruby bug lets strangers attack default Rails and classic Sinatra apps before login. Upgrade Ruby to 3.3.14, 3.4.13 or 4.0.10. How to check and patch an old app.
The problem
On November 18, 2026 the Ruby team released Ruby 3.3.14, 3.4.13 and 4.0.10 to fix seven memory-safety bugs. The most serious one is nicknamed Ruby2Shell (CVE-2026-132825, GitHub advisory GHSA-34m4-m9fh-gqp5). Ruby rates it Critical and says it knows of proof-of-concept exploits that "can be used to trigger RCE in some scenarios" (RCE means remote code execution). In plain English, that means an attacker may be able to run their own commands on your server.
The researchers who named it, Veria Labs, say a default Rails app or a classic-style Sinatra app can be hit before anyone logs in. They said they planned to publish a working exploit for stock Rails on or after November 25, 2026 ("or later if major vendors have not shipped a fix by then"). Once an exploit is public, expect bots to scan for unpatched apps.
If you vibe-coded a Rails or Sinatra app, deployed it, and haven't touched it since, it's very likely still on a vulnerable Ruby. This guide shows how to check it and patch it.
Facts on this page were checked on November 22, 2026 against the official Ruby advisory, the GitHub advisory, the CVE record and Veria Labs' write-up. This is a developing story, so check those links for updates.
What the hole is, in plain words
Ruby can change text to upper or lower case. For some old text encodings (such as ISO-8859-1 / Latin-1 and Windows-1252), the German letter ß turns into two letters, SS, when upper-cased. Ruby only checked that it had room for one, so a string with enough ß characters writes one byte past the end of its memory buffer. One stray byte sounds harmless, but in skilled hands that kind of memory corruption can be turned into running code. UTF-8 text, which most modern apps use, takes a different code path and isn't affected.
How does a stranger reach it in a Rails app? HTML forms can only send GET and POST, so Rails and Sinatra accept a hidden _method field to fake PUT, PATCH and DELETE. A small piece of middleware, Rack::MethodOverride, upper-cases that field. An attacker can send a form upload that says "this field is in Latin-1" and fill it with ß. According to Veria Labs, Cloudflare and Semgrep, this happens while the request is still being routed, before your login check or any of your code runs.
The bug is in Ruby itself, not in Rails, Sinatra or Rack. That means updating Rails or running bundle update does not fix it. You have to upgrade the Ruby version your app runs on.
Who's affected
Ruby versions (from Ruby's advisory):
- Ruby 3.3.13 and earlier: fixed in 3.3.14
- Ruby 3.4.0 to 3.4.12: fixed in 3.4.13
- Ruby 4.0.0 to 4.0.9: fixed in 4.0.10
- Ruby 3.2 and older have reached end of life and will not get a fix. Veria Labs says the bug goes back to Ruby 2.4.0.
Frameworks (per Veria Labs, also confirmed by Cloudflare and Semgrep; Ruby's own advisory doesn't name frameworks):
- Full-stack Rails (a normal
rails newapp): exposed by default. - Classic-style Sinatra (
require 'sinatra'with routes at the top level): exposed by default. - Rails API-only apps (
config.api_only = true), modular Sinatra (class App < Sinatra::Base) and plain Rack apps aren't exposed through this route by default. They can still be hit if your own code changes the case of user input that arrives in a legacy encoding (for example, CSV or Excel imports, email parsing, or uploaded file names). Upgrade them too.
The same releases also fix six other bugs. One is a second overflow in case conversion (GHSA-87fm-7w84-j2px), and five are in Ruby's regular expression engine. Ruby says several of them can also lead to code execution. That's one more reason to upgrade even if you're not on Rails.
Fixes
1. Find out which Ruby your app actually runs
Your laptop's Ruby and your server's Ruby can be different. Check both. In the project folder:
ruby -v # Ruby on this machine
cat .ruby-version # version the project asks for (if the file exists)
grep -n "^ruby" Gemfile # a "ruby" line in the Gemfile, if any
grep -A1 "RUBY VERSION" Gemfile.lock # Ruby recorded in the lockfile
grep -n "RUBY_VERSION\|FROM .*ruby" Dockerfile # Docker-based deploys (Fly.io, Kamal, Render Docker, etc.)
Then check the live server. For example:
heroku run ruby -v -a your-app # Heroku
fly ssh console -C "ruby -v" # Fly.io
On Render, Railway or a VPS, open the service's shell or SSH in and run ruby -v. If the number is below the fixed version for its series, you're vulnerable.
If your Ruby comes from a Linux distribution package, the distro may have backported the fix without changing the version number. In that case, compare your full package version with your distro's advisory (for example, Ubuntu's CVE page).
2. Check whether your app is Rails or Sinatra, and which style
bundle exec rails -v # Rails version (if it's a Rails app)
grep -n "api_only" config/application.rb # "config.api_only = true" means API-only
bin/rails middleware | grep MethodOverride # shows Rack::MethodOverride if it's loaded
grep -n "sinatra \|rack " Gemfile.lock # Sinatra and Rack gem versions
grep -rn "Sinatra::Base\|require 'sinatra'" --include=*.rb . # classic vs modular Sinatra
The Rails version doesn't matter for this bug. A Rails 8 app on Ruby 3.4.12 is vulnerable, and a Rails 6.1 app on Ruby 3.3.14 isn't. This step just tells you how urgent the upgrade is.
3. Back up, then install the fixed Ruby locally
Commit or copy your project first (git add -A && git commit -m "before ruby upgrade"). Then pick the fixed version in the same series you're on. That's the smallest, safest jump:
- On 3.3.x → 3.3.14
- On 3.4.x → 3.4.13
- On 4.0.x → 4.0.10
- On 3.2 or older → there's no patch for your series, so you need to move to a supported one (3.3.14 is the smallest jump). This can need gem updates, so give it more time and test carefully.
Install it with whichever version manager you use:
# rbenv (update ruby-build first so it knows the new versions)
brew upgrade ruby-build # or: git -C "$(rbenv root)"/plugins/ruby-build pull
rbenv install 3.4.13
# mise
mise install ruby@3.4.13
# asdf
asdf install ruby 3.4.13
4. Point the project at the new Ruby
Change every place the old version is written:
.ruby-version: replace the number, for example3.4.13.Gemfile: if there's aruby "3.4.x"line with an exact old version, change it.Dockerfile: changeARG RUBY_VERSION=...or theFROM ruby:...tag (for exampleruby:3.4.13-slim).- CI files (for example
.github/workflows/*.yml) that pin a Ruby version.
Then update the lockfile and make sure the app still boots:
bundle install
bundle update --ruby # records the new Ruby in Gemfile.lock
bin/rails test # or bundle exec rspec, if the app has tests
bin/rails server # open the app locally and click around
5. Redeploy on your host
Push the change and make sure the host rebuilds with the new Ruby. Restarting alone keeps the old one.
- Heroku: reads the Ruby version from your Gemfile / Gemfile.lock. Commit, then
git push heroku main(or your usual deploy). - Render, Railway and other buildpack hosts: these read
.ruby-versionor the Gemfile. Commit and push, then trigger a new deploy. Clear the build cache if the host offers it. - Fly.io, Kamal or anything Docker-based: the Ruby version lives in your Dockerfile's base image. Update it, then rebuild and deploy (
fly deploy,kamal deploy, ordocker build --pulland push). A pinned image tag or digest won't pick up the fix on its own. - Your own server (VPS): install the new Ruby there too, switch the app to it, run
bundle install, then restart every Ruby process: Puma or Passenger, Sidekiq or other job workers, and cron jobs.
6. Confirm the fix is live
Run ruby -v on the live server again (step 1 commands), and check it from inside the app too:
heroku run 'bin/rails runner "puts RUBY_VERSION"' -a your-app # Heroku example
It should print 3.3.14, 3.4.13, 4.0.10 or newer. Then check that the site loads and your forms (sign-up, edit, delete) still work.
7. Can't patch today? Reduce the risk
Ruby's advisory lists no workaround. Upgrading is the fix. Until you can upgrade:
- If the app is abandoned and nobody needs it, turn it off (scale it to zero or pause the service). An app that isn't running can't be attacked.
- If the site is behind Cloudflare, Cloudflare says it has added blocking rules for Ruby2Shell to its managed rulesets, including the Free plan. Cloudflare itself calls this a stopgap, not a replacement for patching: it doesn't protect traffic that reaches your server directly.
Prompt to paste into Cursor, Claude Code, Lovable, Bolt or Replit
My Ruby app needs an urgent security upgrade for Ruby2Shell (CVE-2026-132825). The fix is upgrading the Ruby interpreter itself to 3.3.14, 3.4.13 or 4.0.10. Updating Rails or gems does not fix it. First, without changing anything, tell me: the Ruby version in .ruby-version, the Gemfile, Gemfile.lock (RUBY VERSION), the Dockerfile and any CI config; whether this is Rails (and whether config.api_only is true) or Sinatra (classic or modular); and how this app is deployed. Then upgrade to the fixed Ruby in the SAME series I'm on (3.3.x → 3.3.14, 3.4.x → 3.4.13, 4.0.x → 4.0.10). If I'm on Ruby 3.2 or older, tell me before doing anything, because that's a bigger upgrade. Update every place the version is pinned, run bundle install and bundle update --ruby, and run the tests. Do NOT upgrade Rails or other gems unless the new Ruby requires it, and if it does, explain why first. Finally, give me the exact steps to redeploy on my host and the command to confirm the live server reports the new Ruby version.
FAQ
Is updating Rails enough? No. The bug is in the Ruby interpreter. bundle update rails changes nothing here. You need Ruby 3.3.14, 3.4.13, 4.0.10 or newer.
Is there a real exploit yet? Ruby says it is aware of private proofs of concept that reach code execution "in some scenarios". Veria Labs said it planned to publish a remote-code-execution proof of concept for stock Rails on November 25, 2026, or later if major vendors hadn't shipped fixes. Check Veria Labs' page to see whether it's out. When we last checked, on November 22, 2026, we hadn't seen reports of attacks. Either way, patch now.
My app is API-only, or modular Sinatra. Am I safe? Probably not reachable through the default _method route, according to Veria Labs and Semgrep. Your own code may still upper- or lower-case user input in a legacy encoding, and the same Ruby release fixes six other memory bugs. Upgrade anyway.
Why does the CVE say "High 7.4" when Ruby says "Critical"? The CVE record's score (7.4, "local" attack) was filed with the CVE request. Ruby's GitHub advisory rates the bug Critical, and the known route into Rails and Sinatra is an ordinary web request with no login. Treat any internet-facing app as urgent.
I'm on Ruby 3.2 or older. What now? Ruby 3.2 and earlier are end of life and won't get this fix from Ruby. Move to a supported series (3.3.14 is the smallest jump). If your Ruby comes from a Linux distribution, check whether your distro shipped a backported fix.
I use GitLab, Mastodon, Discourse or another self-hosted app built on Ruby. Those bundle their own Ruby, so the fix has to come from the vendor. Install the vendor's patched release. Veria Labs keeps a list of fixed versions.
Sources
- Ruby: Security advisories: multiple vulnerabilities in Regexp and String case conversion (Nov 18, 2026)
- GitHub advisory GHSA-34m4-m9fh-gqp5: Heap buffer overflow in case conversion of strings
- CVE-2026-132825 on cve.org
- Ruby 4.0.10 release notes
- Veria Labs: Ruby2Shell
- Cloudflare: How Cloudflare WAF protects against ruby2shell
- Semgrep: Ruby2Shell (CVE-2026-132825)
Related guides
Still stuck? Paste your exact error into the free Error Fixer to get a plain-English cause, the fix, and a prompt to paste back into your AI tool.