Ruby fixes a case-conversion heap overflow, CVE-2026-132825: which services still run an old Ruby

In an advisory dated 18 November, Ruby released 4.0.10, 3.4.13 and 3.3.14 to fix seven memory-safety flaws. One of them, a heap buffer overflow in string case conversion, has since been assigned CVE-2026-132825, and Veria Labs calls it Ruby2Shell. The Ruby project rates it critical and says it knows of proofs of concept that reach remote code execution in some scenarios. Veria Labs says Rails in its default configuration and classic-style Sinatra can be reached without logging in, and plans to publish its proof of concept on 25 November, later if major vendors have not shipped fixes by then.

The project offers no workaround, so upgrade Ruby to a fixed release and restart every Ruby process. Ruby 3.2 and older are past upstream end of life and will not receive these fixes. For products that ship their own Ruby, such as GitLab, updating the host’s Ruby changes nothing and you need the vendor’s patched release. This follows recent reminders about Apache, PostgreSQL, OpenJDK and NGINX and KVM.

Who is in scope

SeriesAffectedFixed in
Ruby 4.04.0.0 to 4.0.94.0.10
Ruby 3.43.4.0 to 3.4.123.4.13
Ruby 3.33.3.13 and earlier3.3.14
Ruby 3.2 and olderVeria Labs says the faulty code dates from 2.4.03.2 reached upstream end of life on 1 April 2026, no fix

The fix is in the interpreter, so updating Rails or any other gem by itself does not deliver it.

Semgrep’s write-up of 19 November is the more detailed account of which applications are exposed by default. It names the Rack::MethodOverride middleware as the way in, because it changes the case of a form field before the CSRF check and before authentication. By its account, a Rails app with config.api_only = true and a modular Sinatra app that subclasses Sinatra::Base do not mount it by default, and a plain Rack app is exposed only if it mounts the middleware itself.

Use that only to decide what to upgrade first. Applications that change the case of incoming legacy-encoded strings can also be affected, and every group needs the upgrade because the release fixes six other flaws.

What went wrong

The German letter ß becomes SS in upper case. Unicode makes that the default mapping, and a stability policy forbids switching it to the capital ẞ that was added later. In legacy single-byte encodings such as the ISO-8859 family and Windows-125x, that turns one byte into two. Ruby miscounted the room left in the output buffer during the conversion and wrote one byte past its end. According to Veria Labs, the methods that reach this code are upcase, swapcase, downcase(:fold) and casecmp?, while UTF-8 strings take a different path and are not affected by this CVE.

That last point holds for this CVE alone, since GHSA-87fm-7w84-j2px, fixed in the same release, is an integer overflow that also sits in case conversion, and the remaining five are in the regular-expression engine. Ruby says five of the seven have known proofs of concept that reach remote code execution in some scenarios.

The severity ratings disagree. MITRE’s CVSS 3.1 score is 7.4 with a local attack vector (AV:L), the Ruby project rates the flaw critical, and Red Hat’s preliminary score is 9.8 with a network vector (AV:N). MITRE gives no reason for the local vector. Red Hat’s statement is that a successful attack depends on complex memory layout manipulation and on the application converting strings in specific non-UTF-8 encodings, and that most deployments handle UTF-8 by default, which limits exposure. I would follow the Ruby project’s advice and upgrade first.

Taking inventory on OrbStack

I did not reproduce the vulnerability. Everything below is inventory, and no request was sent to any service. The environment is Docker 29.8.2 (arm64) on OrbStack, tested at 16:00 Taipei time on 20 November. I reran the version checks at 21:20 and got the same results.

The official Docker images first:

for t in ruby:4.0 ruby:3.4 ruby:3.3 ruby:3.2 ruby:latest ruby:3.3-slim ruby:3.4-alpine; do
  docker pull --quiet "$t" >/dev/null 2>&1
  printf '%-18s %s | created %s\n' "$t" "$(docker run --rm "$t" ruby -e 'print RUBY_VERSION, " p", RUBY_PATCHLEVEL, " ", RUBY_RELEASE_DATE' 2>&1)" "$(docker image inspect --format '{{.Created}}' "$t" | cut -c1-10)"
done
ruby:4.0           4.0.10 p0 2026-11-19 | created 2026-11-19
ruby:3.4           3.4.13 p195 2026-11-19 | created 2026-11-19
ruby:3.3           3.3.14 p208 2026-11-19 | created 2026-11-19
ruby:3.2           3.2.11 p268 2026-03-27 | created 2026-04-07
ruby:latest        4.0.10 p0 2026-11-19 | created 2026-11-19
ruby:3.3-slim      3.3.14 p208 2026-11-19 | created 2026-11-19
ruby:3.4-alpine    3.4.13 p195 2026-11-19 | created 2026-11-19

The short tags for 4.0, 3.4 and 3.3 carry the fixed releases, and ruby:3.2 is 3.2.11. The loop discards errors from docker pull, so a failed pull would test whatever is cached locally; read the version that is printed. Images you built earlier still contain the old interpreter and need a fresh pull and rebuild, and a Dockerfile pinned to a patch version or a digest has to be edited:

ruby:3.3.13  3.3.13 | created 2026-11-05
ruby:3.4.12  3.4.12 | created 2026-11-05
ruby:4.0.9   4.0.9 | created 2026-11-05

For a running service, look at the executable the process is using, which may differ from the ruby on PATH. I tried this in a container pinned to 3.3.13:

for p in $(pgrep -x ruby); do
  echo "pid $p -> $(readlink /proc/$p/exe) -> $($(readlink /proc/$p/exe) -e "print RUBY_VERSION")"
done
pid 1 -> /usr/local/bin/ruby -> 3.3.13

This finds the executable and then starts a second Ruby to ask its version. After an in-place package update it may report the new file on disk, or fail outright if the old file has been removed, and neither tells you about the original process. pgrep -x ruby also matches only processes named exactly ruby. Use it to locate the service’s Ruby, then restart after upgrading and confirm that the old processes have exited.

You can also check a product’s bundled Ruby without starting the service, as this GitLab Omnibus image shows:

for t in gitlab/gitlab-ce:19.6.0-ce.0 gitlab/gitlab-ce:19.6.1-ce.0; do
  docker pull --quiet "$t" >/dev/null || { echo "$t pull failed"; continue; }
  printf '%-30s %s\n' "$t" "$(docker run --rm --entrypoint /opt/gitlab/embedded/bin/ruby "$t" -e 'print RUBY_VERSION, " ", RUBY_RELEASE_DATE')"
done
gitlab/gitlab-ce:19.6.0-ce.0   3.3.13 2026-10-23
gitlab/gitlab-ce:19.6.1-ce.0   3.3.14 2026-11-19

Candidate package versions in distribution images:

ImageCandidate packageReading
debian:12ruby3.1 3.1.2-7+deb12u1Debian’s tracker says vulnerable, not yet fixed
debian:13ruby3.3 3.3.13-0+deb13u1Debian’s tracker says vulnerable, not yet fixed
ubuntu:24.04ruby3.2 3.2.3-1ubuntu0.24.04.9Ubuntu’s CVE page says Needs evaluation
ubuntu:26.04ruby3.3 3.3.8-2ubuntu3.2Ubuntu’s CVE page says Needs evaluation
alpine:3.22, alpine:edgeruby 3.4.13-r0Upstream fixed release

Needs evaluation means it has not been assessed, which is different from confirmed as affected. Distributions usually backport a fix without changing the upstream version, so later on check the package revision and the security notice instead of the bare 3.3.13 or 3.2.3.

Next I checked whether the middleware Semgrep names is mounted in a default Rails app. On the fixed ruby:3.3 image (3.3.14) I installed Rails 8.1.4.1, generated one ordinary project and one with --api, and counted matching lines in the output of bin/rails middleware:

for a in full api; do printf "%-5s " "$a"; (cd $a && bin/rails middleware 2>/dev/null | grep -c "Rack::MethodOverride"); done
full  1
api   0

The ordinary project mounts it and the API-only one does not, which agrees with Semgrep. To check your own project, run bin/rails middleware in the project directory under the environment the service really uses, and make sure the list prints properly before looking for that line. My loop throws error output away, so a Rails app that fails to load would also count 0.

Last, a look at the length change on the fixed 3.3.14, with a single ß:

docker run --rm ruby:3.3 ruby -e '
s = "\xDF".dup.force_encoding("ISO-8859-1")
u = s.upcase
puts "ISO-8859-1: #{s.bytesize} byte -> upcase #{u.bytes.inspect} (#{u.bytesize} bytes)"
t = "ß"
puts "UTF-8:      #{t.bytesize} bytes -> upcase #{t.upcase.inspect} (#{t.upcase.bytesize} bytes)"'
ISO-8859-1: 1 byte -> upcase [83, 83] (2 bytes)
UTF-8:      2 bytes -> upcase "SS" (2 bytes)

In ISO-8859-1 the ß is one byte and its upper case is two. In UTF-8 it already takes two bytes, so in this example the length stays the same.

Where each vendor stands

WhoStatus when checkedSource
Ruby4.0.10, 3.4.13 and 3.3.14 released; 3.2 and older get no fixruby-lang.org advisory
Official Docker ruby imagesShort tags for 4.0, 3.4 and 3.3 carry the fixed releasesTest above
GitLab19.6.1, 19.5.8 and 19.4.10 released on 20 November; 19.6.1 bundles Ruby 3.3.14GitLab patch release feed, test above
Chatwoot4.20.1 released on 20 November, moving to Ruby 3.4.13Chatwoot release notes
MastodonOfficial Docker images for 4.7.6 and 4.6.12 have the updated Ruby; source installs must upgrade Ruby themselvesMastodon release notes
DiscourseThe base image of 19 November bundles 4.0.10; self-hosted sites get it only after a rebuildDiscourse announcement
OpenProjectVeria Labs lists 17.9.8 and 17.8.3 as fixed; the official release notes do not mention RubyVeria Labs
GitHub Enterprise ServerVeria Labs lists 3.22.5 and earlier as affected with no fixed release; I have not confirmed this from GitHubVeria Labs
Alpineruby 3.4.13-r0Test above
Debianruby3.1 and ruby3.3 marked vulnerable, not yet fixedDebian tracker
UbuntuRuby packages in every release marked Needs evaluationUbuntu CVE page
Red HatRated Critical, some products marked Affected, no fix advisory yetRed Hat Security Data API

The two Veria Labs rows reflect its page as of 13:00 UTC on 20 November. A product bundling an old Ruby has not necessarily been shown to expose the vulnerability. CISA’s KEV catalogue is at version 2026.11.18 and does not list the CVE, and I have found no report of it being exploited in the wild.

Inventory and upgrade

  1. List everywhere Ruby runs: your own Rails and Sinatra services, CI jobs, schedulers and workers, and products that bundle Ruby. Go through FROM ruby: lines in Dockerfiles, .ruby-version, CI configuration, versions installed with rbenv or asdf, and the interpreter Passenger is told to use.
  2. Confirm which Ruby, and which version, each service really uses. For a product that bundles Ruby, look at its own copy.
  3. Move 4.0, 3.4 and 3.3 to 4.0.10, 3.4.13 and 3.3.14, pulling base images again before rebuilding. If the new version will not install, rbenv needs a newer ruby-build and asdf needs its asdf-ruby plugin updated, since the plugin keeps its own copy of ruby-build. On hosted platforms, follow the provider’s runtime upgrade procedure and verify the deployed Ruby version; a restart alone does not establish that the fix is installed.
  4. After deploying, restart every Ruby process and confirm the old ones have exited.
  5. Plan a move off 3.2 and older to a maintained series. If you use distribution packages, follow that distribution’s security notices.
  6. Install the vendor’s patched release for products that bundle Ruby. This version table does not apply to JRuby or TruffleRuby, so check their own announcements.

If you need to buy time before the upgrade, Semgrep lists several unofficial stopgaps. The one for Rails is adding config.middleware.delete Rack::MethodOverride to the configuration. I tried it on the ordinary Rails project above, and Rack::MethodOverride in bin/rails middleware went from 1 to 0. The cost is that forms relying on the _method field to send PUT, PATCH or DELETE stop working, and it covers neither the application’s own code nor the six other flaws. Semgrep also lists the matching Sinatra setting and rules for rejecting certain requests in front of the application, which I have not tested. None of this replaces the upgrade.

Notes

  • Ruby 4.0.10, 3.4.13 and 3.3.14 fix seven memory-safety flaws. CVE-2026-132825 writes one byte too many when changing case in legacy single-byte encodings, and a separate integer overflow in the same release also affects case conversion.
  • There is no official workaround. Upgrade the interpreter and restart; updating gems alone does nothing, and 3.2 and older get no upstream fix.
  • MITRE scores it 7.4 (AV:L), Red Hat’s preliminary score is 9.8 (AV:N) and Ruby rates it critical. Veria Labs plans to publish a proof of concept on 25 November, later if vendors are not done.
  • A default Rails app mounts Rack::MethodOverride and an API-only one does not. My test agrees with Semgrep, though this distinction only helps prioritise upgrades.
  • In my tests the official Docker short tags, Alpine and GitLab 19.6.1 carry fixed releases. Tags pinned to a patch version and images built earlier are still old.
  • When checked, Debian was marked not yet fixed, Ubuntu had not assessed it, Red Hat had no fix advisory, Veria Labs listed GitHub Enterprise Server as having no fixed release, and I had found no report of exploitation in the wild.

Further reading

Ideas and technical judgement by Sheng; drafted with Claude · facts researched with Grok, reviewed by Codex; versions inventoried on OrbStack with the official Docker ruby images, GitLab images and distribution images, and the Rails middleware checked on the fixed 3.3.14, vulnerability not reproduced; facts checked up to 21:50 on 20 November 2026 (Taipei time)