Rails RCE Vulnerability (Ruby2Shell): How to Check If Your API Is Affected

Ruby2Shell (CVE-2026-132825) is a pre-auth heap overflow in Ruby that reaches stock Rails. Check the Ruby your API really runs, find every pinned version, upgrade to 3.3.14, 3.4.13 or 4.0.10, and verify the patched build.

Ashley Innocent

Ashley Innocent

20 November 2026

Rails RCE Vulnerability (Ruby2Shell): How to Check If Your API Is Affected

Apidog for Enterprise

On-Premises Deploy

SSO & RBAC

SOC 2 Compliant

Explore Apidog Enterprise

The Rails RCE vulnerability making the rounds this week is Ruby2Shell (written “Ruby2ßhell” by its finders), tracked as CVE-2026-132825 and GHSA-34m4-m9fh-gqp5. It’s a one-byte heap overflow in Ruby’s string case conversion that its researchers say is reachable without authentication on a stock Rails app. Your API is affected if it runs Ruby 2.4.0 to 3.3.13, 3.4.0 to 3.4.12, or 4.0.0 to 4.0.9. The fix is a Ruby upgrade to 3.3.14, 3.4.13 or 4.0.10, not a gem update.

Quick answer: am I affected?

  1. Run ruby -v inside the environment that actually serves your API (container, VM or dyno), not on your laptop.
  2. If the version falls in one of the three ranges above, you’re exposed.
  3. Upgrade Ruby, rebuild every image, restart every app server, then re-run your API tests.

What is the Ruby2Shell Rails RCE vulnerability?

Ruby2Shell is a one-byte heap buffer overflow in the code Ruby uses to change the case of strings in legacy single-byte encodings such as ISO-8859-x and Windows-125x. Veria Labs rates it Critical, reachable over the network with no authentication, and says Rails and classic-style Sinatra reach it in their default configuration.

The root cause is small. Most single-byte encodings have no capital form of the German sharp s, “ß”, so upcasing it writes two bytes, “SS”. The loop that does this only checks for room for one byte. Ruby allocates the output buffer as the input length plus 20 bytes, so per Veria’s write-up, an input with 21 “ß” characters overflows that buffer by one byte.

Diagram of the Ruby2Shell bug: an input string of sharp s characters expands to two S characters each, and the last S lands one byte past the end of the output buffer

The overflow is reached through upcase, swapcase, downcase(:fold) and casecmp?. UTF-8 strings take a different code path and aren’t affected. The bug has been in Ruby since 2.4.0.

Ruby published its security advisory on November 18, 2026, together with six other flaws in the regular expression engine and string case conversion. Ruby says it’s aware of proofs of concept that use this flaw for remote code execution “in some scenarios”. Veria Labs says it was first to demonstrate RCE on stock Rails and plans to publish its exploit on November 25, 2026, or later if major vendors haven’t shipped fixes by then.

That date is your real deadline: once an exploit is public, scanning for unpatched Rails APIs gets cheap.

Which Ruby and Rails versions are affected?

This table combines Ruby’s advisory with Veria Labs’ affected-software table, as of November 20, 2026.

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 Every release back to 2.4.0 No fix (end of life)

The Rails version doesn’t matter here. The bug lives in the interpreter, so bundle update rails changes nothing. A Rails 8 app on Ruby 3.4.12 is vulnerable; a Rails 6.1 app on Ruby 3.3.14 isn’t.

Veria Labs lists Rails and classic-style Sinatra as affected in their default configuration. Other frameworks and plain Rack apps aren’t exposed by default, but any code that upcases untrusted strings in a legacy encoding can still hit the bug.

Ruby 3.2 and older get no patch. If a service is still on 3.1 or 3.2, Ruby2Shell turns “we’ll upgrade next quarter” into this week’s job.

How to check if your Rails API is affected

The trap is checking the wrong place: the Ruby on your laptop, or in .ruby-version, can differ from what production runs.

Flowchart for checking a Rails API for Ruby2Shell: run ruby -v in production, compare against the affected ranges, then upgrade or run regression tests

Step 1: Read the version from the running environment

Ask the process that serves traffic. Pick whichever line matches your hosting:

# Docker / Kubernetes
docker exec <container> ruby -v
kubectl exec deploy/<api-deployment> -- ruby -v

# Heroku-style platforms
heroku run ruby -v -a <app-name>

# A VM or bare-metal host, as the app user
sudo -u deploy bash -lc 'cd /srv/api/current && bundle exec ruby -v'

Step 2: Compare it against the fixed releases

For many services, paste this one-liner into each environment. It uses only Gem::Version, which ships with Ruby:

ruby -e '
fixed = { "3.3" => "3.3.14", "3.4" => "3.4.13", "4.0" => "4.0.10" }
v = Gem::Version.new(RUBY_VERSION)
series = RUBY_VERSION.split(".").first(2).join(".")
if v < Gem::Version.new("2.4.0")
  puts "#{RUBY_VERSION}: outside the Ruby2Shell range, but end of life"
elsif fixed[series] && v >= Gem::Version.new(fixed[series])
  puts "#{RUBY_VERSION}: patched"
else
  puts "#{RUBY_VERSION}: VULNERABLE, upgrade Ruby"
end'

It prints one line, for example 3.4.12: VULNERABLE, upgrade Ruby. Anything on 3.2 or older reports as vulnerable too, which is correct: there’s no fixed release in those series.

Step 3: Find every place Ruby is pinned

Production tells you today’s state. Your repo tells you what the next deploy ships. Search for all of these:

grep -rnE "ruby[-_]version|^ruby |FROM ruby:|RUBY VERSION" \
  --include="*.yml" --include="*.yaml" --include="Dockerfile*" \
  --include="Gemfile*" --include=".ruby-version" --include=".tool-versions" .

Step 4: Don’t forget the Ruby you didn’t install

Self-hosted tools bundle their own Ruby, so upgrading your system Ruby won’t help them. Veria Labs’ table, updated November 20, 2026 at 01:59 UTC, reads:

Software Status Fixed in
GitLab 19.6.0 and earlier vulnerable No fixed release yet
GitHub Enterprise Server 3.22.5 and earlier vulnerable No fixed release yet
Chatwoot 4.20.0 and earlier vulnerable No fixed release yet
Mastodon 4.7.5 and earlier 4.7.6, 4.6.12, 4.5.22, 4.4.29
OpenProject 17.9.7 and earlier 17.9.8, 17.8.3
Discourse base image before 2.0.20261119-0203 2.0.20261119-0203

For the products with no fix, Aikido’s guidance is to take the server off the public internet, behind a VPN or an IP allowlist, until the vendor ships one.

How to patch Ruby2Shell without breaking your API

Ruby lists no workaround, so the patch is the fix. Here’s the order that avoids surprises:

  1. Bump the pin. Set .ruby-version, the Gemfile ruby line and any CI ruby-version to 3.3.14, 3.4.13 or 4.0.10, staying in your current series.
  2. Refresh the lockfile. Run bundle install so the RUBY VERSION section in Gemfile.lock matches.
  3. Rebuild images from a patched base. Point FROM ruby: at a tag that ships the fixed patch release (check the tag list on Docker Hub before you pin), and rebuild with --pull so a cached old layer doesn’t sneak back in.
  4. Restart every process. Puma, Sidekiq, cron runners and one-off consoles all keep the old interpreter in memory until they restart.
  5. Re-run Step 1 in production. Trust ruby -v from the live container, not the merged pull request.

The same release fixes six other regexp and string bugs, which touch code an API leans on: parameter parsing, validations and case-insensitive lookups. Run your API tests against staging before you promote the build.

Let your coding agent verify the patched API with Apidog CLI

You already have a coding agent open to bump the Ruby pin. Let the same agent prove the patched build returns what your clients expect, instead of clicking through endpoints yourself. Apidog CLI gives Claude Code, Codex, Cursor or OpenCode a scriptable way to import your API spec, write test cases and run them against any environment.

Setup is three commands:

npm install -g apidog-cli@latest
apidog login --with-token <YOUR_TOKEN>
npx -y skills add https://apidog.com   # pick your agent when prompted

If your Rails app exports an OpenAPI file (rswag, for example), give your agent one prompt:

Import openapi.yaml into Apidog project <id>. Create test cases for our five
most-used endpoints, including GET /api/v1/users/:id and POST /api/v1/orders,
that assert status codes, response schemas and that names containing non-ASCII
characters (like "Straße") round-trip unchanged. Run them against staging after
the Ruby 3.4.13 deploy and summarize any failures.

The agent reads the payload schema, validates it and runs the suite. These are the commands it uses:

apidog import --project <id> --format openapi --file ./openapi.yaml
apidog cli-schema get test-case-create
apidog cli-schema validate test-case-create --file case.json
apidog test-case create --project <id> --file case.json
apidog run --test-case <caseId> --project <id> -e <stagingEnvId> -r cli,json

The non-ASCII check isn’t an exploit test, and it shouldn’t be: don’t fire crafted overflow payloads at production. It’s a regression check on the code path the patch touched. Once it passes on staging, put the same apidog run ... -r junit step into CI so the next Ruby bump gets the same check automatically. The Apidog CLI CI/CD guide shows the pipeline setup, and Apidog CLI in Claude Code covers the agent side. Apidog Free covers up to 4 users, which is enough for a small backend team to run this today.

How Ruby2Shell compares to recent runtime RCEs

Ruby2Shell follows two other runtime-level RCEs covered here since October. In all three, the bug lives in the runtime, so framework and package updates do nothing.

Bug Layer What you upgrade
Ruby2Shell (CVE-2026-132825) Ruby string case conversion Ruby to 3.3.14, 3.4.13 or 4.0.10
PHP2Shell (CVE-2026-109618, CVE-2026-109619) PHP interpreter PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35
Node.js Brotli RCE (CVE-2026-111497) Node.js Brotli decoder Node.js itself

If your team runs a polyglot stack, build one inventory of runtime versions per service. Each of these bugs starts with the same question: which version is production actually on? For a broader approach, see automated API vulnerability detection.

FAQ

Does updating the Rails gem fix Ruby2Shell? No. The bug is in the Ruby interpreter, so bundle update rails doesn’t touch it. You need Ruby 3.3.14, 3.4.13 or 4.0.10, plus rebuilt images and restarted processes.

Is my app safe if it only uses UTF-8? Veria Labs says UTF-8 strings take a different code path and aren’t affected. It also says Rails and classic Sinatra reach the vulnerable code in their default configuration, so a “we only use UTF-8” assumption isn’t a reason to skip the upgrade.

Is there a public exploit for Ruby2Shell? Not yet, as of November 20, 2026. Ruby says it knows of proofs of concept for RCE in some scenarios, and Veria Labs plans to publish its stock-Rails exploit on November 25, 2026, or later if vendors haven’t shipped fixes.

What if I’m on Ruby 3.2 or older? Ruby 3.2 and earlier are end of life and won’t receive the fix. Move to 3.3.14 or later, ideally 3.4.13 or 4.0.10, and treat the upgrade as urgent.

How do I check Ruby2Shell exposure in GitLab or Mastodon? Those products bundle their own Ruby. Check the vendor’s release notes for a fixed version. Where none exists yet, restrict access with a VPN or IP allowlist until it ships.

Does the Ruby upgrade fix anything else? Yes. Ruby 3.3.14, 3.4.13 and 4.0.10 also fix six other regexp and string case conversion flaws listed in the same Ruby advisory, so one upgrade covers all seven.

Explore more

GPT-Live-1.1 Pricing: Active vs Standby Minutes Explained

GPT-Live-1.1 Pricing: Active vs Standby Minutes Explained

GPT-Live-1.1 pricing explained: $0.05 per active minute, $0.02 per standby minute, billed per second, with worked cost examples for a support line, a tutor and an always-on assistant.

20 November 2026

How to Use GPT-Live-1.1 API ?

How to Use GPT-Live-1.1 API ?

GPT-Live-1.1 is now in the OpenAI API on v1/live/sessions. Open a WebSocket or WebRTC session, configure Responses delegation to gpt-6-luna, add a function tool, and test the backend it calls with Apidog CLI.

20 November 2026

PostgreSQL 19 New Features Every API Developer Should Know

PostgreSQL 19 New Features Every API Developer Should Know

PostgreSQL 19 adds ON CONFLICT DO SELECT for get-or-create endpoints, WAIT FOR LSN for read-your-writes on replicas, REPACK (CONCURRENTLY), JSON output from COPY and a list of default changes to check before you upgrade.

20 November 2026

Practice API Design-first in Apidog

Discover an easier way to build and use APIs

Rails RCE Vulnerability (Ruby2Shell): How to Check If Your API Is Affected