Internet & Files 12 min read Hard 7 steps

How to Check and Patch Ruby2Shell (CVE-2026-132825)

Find every Ruby your apps run, check whether Rails exposes Ruby2Shell, upgrade with apt, rbenv, or Docker, and switch off the attack path if you cannot patch yet.

Published · Last updated
Green Linux package upgrade output on a dark screen, with lines unpacking and setting up updated packages

When you finish, every Ruby process on your servers runs a version with the Ruby2Shell fix, and any app you could not upgrade yet has its pre-login path to the bug closed.

Ruby2Shell, CVE-2026-132825, is a one-byte heap overflow in how Ruby changes the case of the German sharp s (ß) in certain single-byte encodings. The Ruby team released 3.3.14, 3.4.13, and 4.0.10 on November 18, 2026, together with fixes for six related string and regular expression bugs, and says it knows of proof-of-concept code that runs commands through some of them. It follows NGINX2Root and Java4Shell this month.

We tested the process and version checks, the rbenv upgrade from 3.4.12 to 3.4.13, the Ubuntu package update and changelog check, and the Rails middleware check on Ubuntu 24.04 with Rails 8.1.4.1 in November 2026. The Debian, Red Hat, Docker, and GitLab details follow the vendors' own pages as of November 21, 2026.

What you’ll need

Shell access with sudo to each server A list of the apps that run on Ruby, including GitLab or other bundled products For containers: access to rebuild and redeploy the images

1

Find every Ruby on the server and the one each app runs

Ruby2Shell lives in the Ruby interpreter itself, so the version that counts is the one each running process uses. Look for all of them: the system package, one or more versions from rbenv, asdf, or mise, and the Ruby bundled inside products such as GitLab. List every ruby program on disk:sudo find / \( -path /proc -o -path /sys \) -prune -o -type f -path '*/bin/ruby' -print 2>/dev/nullRun each path it finds with -v added. Then check which Ruby your running apps actually loaded. Puma, Sidekiq, and Unicorn rename their processes, so ask the kernel for the real program behind each one:for p in $(pgrep -f 'puma|sidekiq|unicorn|ruby'); do echo "$p $(sudo readlink -f /proc/$p/exe)"; doneEach line shows a process ID and the Ruby it runs, such as /home/deploy/.rbenv/versions/3.4.12/bin/ruby, even when ps shows the process as puma 8.1.2. Ignore a line that shows a shell such as /usr/bin/bash, which is a script whose name matched the search. For GitLab, run sudo /opt/gitlab/embedded/bin/ruby -v. According to the Ruby team's advisory, these versions are affected:Ruby 4.0.0 to 4.0.9 fixed in 4.0.10 Ruby 3.4.0 to 3.4.12 fixed in 3.4.13 Ruby 3.3.13 and older fixed in 3.3.14 Ruby 3.2 and older end of life, no upstream fixA version number from a Linux distribution package does not settle it on its own, because distributions patch older versions without changing the number. Step 3 covers that check.

2

Check whether a web request can reach the bug

The overflow happens when upcase, swapcase, casecmp?, or downcase(:fold) runs on a string in one of 14 single-byte encodings, including ISO-8859-1 and Windows-1252. UTF-8 strings take a different code path and are not affected. Veria Labs, who published the Ruby2Shell research, say it is reachable without logging in on default Rails apps and on classic-style Sinatra apps. Semgrep traced the path to Rack::MethodOverride, the middleware that turns a form's hidden _method field into PUT, PATCH, or DELETE. It upcases that field before routing, before CSRF protection, and before any login check. To see whether a Rails app loads it, run this in the app folder:bin/rails middleware | grep MethodOverrideA new Rails 8.1.4.1 app prints use Rack::MethodOverride, and an app created with --api prints nothing. An API-only app is still exposed if its own code changes the case of a request value, such as params[:name].upcase, so patch either way. The same advisory fixes six other string and regular expression bugs that do not depend on this middleware.

3

If Ruby came from apt, update the package and check its changelog

Ubuntu 24.04 shipped the fix on November 19, 2026 in notice USN-9176-1, as ruby3.2 version 3.2.3-1ubuntu0.24.04.9, a backport to a branch the Ruby team no longer fixes. Debian fixed bookworm in ruby3.1 3.1.7-1~deb12u2 and trixie in ruby3.3 3.3.14-0+deb13u1, according to the Debian security tracker. Update first, replacing 3.2 with your version (3.1 on bookworm, 3.3 on trixie):sudo apt update && sudo apt install --only-upgrade ruby3.2 libruby3.2Then confirm the fix is in the installed package. Search for the GitHub advisory ID as well as the CVE number. Ubuntu's notice and changelog name only the advisory ID, GHSA-34m4-m9fh-gqp5, and Ubuntu's own CVE page still showed 24.04 as "Needs evaluation" on November 21, 2026. A search for CVE-2026-132825 alone returns 0 on a patched Ubuntu machine:zgrep -cE 'GHSA-34m4-m9fh-gqp5|CVE-2026-132825' /usr/share/doc/libruby3.*/changelog.Debian.gzAny number above 0 means the fix is installed. On Ubuntu 24.04 the patched package returns 2. Read the file on disk this way rather than running apt changelog, which downloads the changelog of the newest available version instead of the installed one. On Red Hat Enterprise Linux 7, 8, 9, and 10, Red Hat lists the ruby packages as affected, and no fixed package had shipped as of November 21, 2026. Apply step 7 there until it does.

4

If you use rbenv, asdf, or mise, install the fixed version

Update the build definitions first, because the new versions only exist in ruby-build v20261119 and later. With rbenv on Linux:git -C "$(rbenv root)"/plugins/ruby-build pull rbenv install 3.4.13 rbenv global 3.4.13If you installed ruby-build with Homebrew, run brew upgrade ruby-build instead of the git command. Use 3.3.14 or 4.0.10 if the app runs on those branches. For asdf, run asdf plugin update ruby before installing. mise has precompiled builds of all three versions. RVM had not added them as of November 21, 2026. On Windows, RubyInstaller 3.4.13-1, 3.3.14-1, and 4.0.10-1 are out. Compiling 3.4.12 took 9 and a half minutes on a 16-thread machine, so start the build before anything else. A new Ruby version starts with no gems, even for a patch release. After the switch, gem list shows none of the gems installed under the old version. In each app folder, set the new version and reinstall:echo 3.4.13 > .ruby-version bundle installIf the Gemfile pins the version with a line such as ruby "3.4.12", change that line too, or Bundler refuses to run. On Heroku, change that line and run bundle update --ruby, because Heroku installs the version recorded in Gemfile.lock.

Good to know: Keep the old version installed until the app runs on the new one. rbenv keeps each version in its own folder, so 3.4.12 stays available. To switch back, write 3.4.12 into the app's .ruby-version file. rbenv global alone does not do it, because a .ruby-version file in the app folder overrides the global setting.

5

In Docker, rebuild the image on a fixed Ruby tag

The official ruby images were rebuilt with the fixed versions. The tags latest, 4, 4.0, slim, and alpine point to 4.0.10, 3 and 3.4 point to 3.4.13, and 3.3 points to 3.3.14. Pin the exact version in your Dockerfile so a later build cannot fall back to an old cached image:FROM ruby:3.4.13-slim-bookwormThen rebuild with a fresh pull and replace the running containers:docker build --pull -t myapp . docker compose up -dUse up -d rather than docker compose restart, because a restart keeps the container on the old image. Confirm the result with docker compose exec web ruby -v, replacing web with your service name. For GitLab, upgrade to 19.6.1, 19.5.8, or 19.4.10. GitLab's patch release says its Omnibus packages and container images already include the patched Ruby. Self-compiled GitLab needs a rebuild on Ruby 3.3.14 or 3.4.13. GitLab.com needs no action.

6

Restart every Ruby process and confirm the new version

A running process keeps the interpreter it started with, so the upgrade only takes effect after a restart. Restart the app server and the background workers, for example sudo systemctl restart puma sidekiq, using your own service names. Then run the process check from step 1 again:for p in $(pgrep -f 'puma|sidekiq|unicorn|ruby'); do echo "$p $(sudo readlink -f /proc/$p/exe)"; doneEvery line now shows the new version's path, such as .rbenv/versions/3.4.13/bin/ruby. On a distribution package the path stays /usr/bin/ruby3.2, so check the process start time instead with ps -o lstart= -p PID. A start time from before the update means that process still runs the old code.

7

If you cannot upgrade today, switch off Rack::MethodOverride

This closes the pre-login path Semgrep found and nothing else, so treat it as a stopgap for a few days. In a Rails app, add this line inside the class Application block in config/application.rb:config.middleware.delete Rack::MethodOverrideRestart the app and run bin/rails middleware | grep MethodOverride. It prints nothing once the middleware is gone. In a classic-style Sinatra app, add disable :method_override. Before you deploy it, check for forms that depend on the middleware. Rails forms and buttons that update or delete records send a hidden _method field, and without the middleware those requests arrive as plain POSTs and miss their routes. The other six bugs in the same advisory stay open until Ruby is upgraded, so remove the line again after you finish steps 3 to 6.

If an app fails to start on the new Ruby, read the first error line. "Your Ruby version is 3.4.13, but your Gemfile specified 3.4.12" means the Gemfile still pins the old version, and a missing gem means bundle install has not run under the new version yet. To switch back, run echo 3.4.12 > .ruby-version in the app folder and restart the app, keep the step 7 stopgap in place, and fix the error before you try again. If your distribution has no fixed package yet, check its security page daily and keep step 7 in place until it ships. For products that bundle their own Ruby, such as GitHub Enterprise Server, follow the vendor's security advisories, because only the vendor can replace that interpreter.

Questions we get asked about this

Answers from experience, not a textbook.

No. The bug is in the encoding code compiled into the Ruby interpreter, not in a gem, so the fix arrives with a new Ruby or a patched distribution package. Bundler only changes gems.

No. The overflow writes one byte past a buffer, which corrupts memory without a visible error in most runs. Uppercasing 21 sharp-s characters in ISO-8859-1 returns the same 42-byte result on the unpatched 3.4.12 as on the patched 3.4.13. Check the version and the package changelog instead.

The CVE record from MITRE scores it 7.4 because it rates the attack as local and difficult. The Ruby team rates it Critical, and Red Hat scores it 9.8 with a network attack that needs no login, which matches the Rails path in step 2. Treat it as critical if you run Rails or Sinatra.

No. Veria Labs reports the bug in every release back to Ruby 2.4.0, and the Ruby team does not fix 3.2 and older because they are past end of life. Ubuntu 24.04 and Debian bookworm backported the fix into their own packages, so those are covered after step 3. A self-compiled 3.2 or older needs an upgrade to 3.3.14 or newer.

Not as of November 21, 2026. CISA's catalog of exploited vulnerabilities does not list it, and no attacks have been reported. The Ruby team knows of proof-of-concept code that runs commands, and Veria Labs plans to publish one for stock Rails on November 25, 2026, or later if major vendors have not shipped fixes by then. Finish patching before November 25.

Like this?

Get the next guide by email.

Subscribe and get new tech guides by email. Read the ones you need and skip the rest.