DEV Community

TECHDEV
TECHDEV

Posted on Originally published at github.com

Your bundle audit cannot see Ruby2Shell. I built a 3-condition check that can.

On 18 November 2026, Veria Labs disclosed Ruby2Shell: a one-byte heap overflow in Ruby's string case conversion. CVE-2026-132825 (GHSA-34m4-m9fh-gqp5) scores CVSS 3.1 7.4 High from MITRE CNA; Ruby rates it Critical and publishes no CVSS of its own. Fixed builds shipped the same day: 4.0.10, 3.4.13 and 3.3.14. Veria Labs will publish a proof of concept demonstrating remote code execution on stock Rails on 25 November 2026, or later if major vendors have not shipped a fix by then. As of 20 November 2026 there are no reports of exploitation in the wild and the CVE is not in the CISA KEV catalog (2026-11-18 catalog version).

The bug is a bounds-checking mistake in the case-conversion loop. Most single-byte encodings have no capital sharp s, so upcasing it writes two bytes, SS, but the loop only bounds-checks one. The output buffer is the input length plus 20 bytes, so an input with 21 sharp-s characters overflows the buffer by one byte. The same loop is in several ISO-8859 and Windows-125x encodings and has been there since Ruby 2.4.0. It is reached by upcase, swapcase, downcase(:fold) and casecmp?. UTF-8 strings take a different code path and are not affected.

Here is the part that should worry every team running Ruby in production: the flaw is in the interpreter, not in any gem. A clean bundle audit on an affected Ruby is a false negative by design, because bundler-audit checks gems against an advisory database and this is a Ruby runtime advisory. And a version-only CVE match calls a plain-Rack app "vulnerable" even though plain Rack is not exposed by default. Exposure needs three conditions together, on the Ruby that actually runs the app:

  1. An affected Ruby version (4.0.0-4.0.9, 3.4.0-3.4.12, 3.3.13 and earlier back to 2.4.0; 3.2 and earlier are end of life with no fix).
  2. An exposed framework in its default configuration (default Rails, or classic-style Sinatra).
  3. Sharp-s input reachability from config evidence: Rack::MethodOverride calls .upcase on the attacker-controlled _method parameter with no authentication, or the app's own code case-converts request params.

I built ruby2shell to answer one question per install: do the conditions line up here? It is a zero-dependency TypeScript CLI (Node 20+). Everything runs locally; no network, no CVE database, no exploit code, and it never sends a payload. The only command it ever runs against a Ruby is ruby -v.

ruby2shell demo

What it does

ruby2shell scan [--dirs <dir>...] [--app <dir>] [--no-system] [--json]
ruby2shell check <ruby-dir-or-version> [--app <dir>] [--json]
ruby2shell check --product <name> --product-version <ver> [--json]
ruby2shell config-scan <app-dir> [--json]
ruby2shell playbook [--json]
ruby2shell explain <topic>
ruby2shell init
Enter fullscreen mode Exit fullscreen mode
  • scan discovers Ruby installs (from PATH, rbenv, rvm, system dirs, or --dirs) and verdicts each one: EXPOSED, AT-RISK, SAFE or UNKNOWN, with the deciding condition printed per install.
  • check verdicts one install, binary, or bare version string in detail: version, per-branch patch range, framework, and reachability.
  • check --product verdicts a self-hosted product version against the vendor table (GitLab, GitHub Enterprise Server, Chatwoot, Mastodon, OpenProject, Discourse).
  • config-scan reads Gemfile.lock, config.ru, Dockerfile and .ruby-version and lists case-conversion calls on request params, so you can see exactly why an app is reachable.
  • playbook prints the first-hour response plan for this disclosure: patch order, the no-patch upgrade path for Ruby 3.2 and earlier, and what not to do.
  • explain prints the CVE facts, the verdict rules and the sources, with the date they were checked (20 November 2026).
  • init writes a ruby2shell.config.json for CI use.

Exit codes: scan exits 0 when nothing is EXPOSED, 1 when at least one install is EXPOSED, 2 when no Ruby is found. check exits 0 SAFE, 1 EXPOSED or AT-RISK, 2 UNKNOWN. Both are built to be CI gates: fail the build while any install in the fleet is EXPOSED.

Install from source only - the ruby2shell package is not published to npm yet (the name was unclaimed; npm returned 404 when checked on 20 November 2026):

git clone https://github.com/techdevfun/ruby2shell.git
cd ruby2shell
npm install
npm run build
node dist/cli.js scan --app ./my-rails-app
Enter fullscreen mode Exit fullscreen mode

Example output (real CLI output from the demo transcript, demo/transcript.txt; the fleet is synthetic, the Rails app is a synthetic fixture, the 3.4.12 version string is recorded from a real Ruby 3.4.12 built from source on 20 November 2026):

$ ruby2shell scan --dirs ruby-3412 ruby-3413 ruby-320 --app app-rails --no-system
install                      ruby      framework          verdict
------------------------------------------------------------------------
ruby-3412                    3.4.12    rails              EXPOSED
  - 3.4.12 is in the affected range for CVE-2026-132825 (fixed build is 3.4.13)
  - Rails 7.1.3 (default config) - pre-auth reachable via Rack::MethodOverride
  - Rack::MethodOverride calls .upcase on the attacker-controlled _method parameter with no authentication
  - app code also case-converts request params (REVIEW): app/controllers/search_controller.rb:3
ruby-3413                    3.4.13    rails              SAFE
  - 3.4.13 is at or above the fixed build 3.4.13 (18/11/2026 release)
ruby-320                     3.2.0     rails              AT-RISK
  - 3.2.0 is end of life (3.2 and earlier) - the flaw is present back to 2.4.0 and no fix exists for this line
  - there is no patch for this line - upgrade to a supported Ruby (3.3.14, 3.4.13 or 4.0.10)

summary: EXPOSED 1 / AT-RISK 1 / SAFE 1 / UNKNOWN 0 - 3 install(s) scanned
Exposure conditions only. This tool does not prove exploitability and never sends a crashing payload. A SAFE verdict means these three conditions do not line up - not that the host is safe from every Ruby flaw.
exit: 1
Enter fullscreen mode Exit fullscreen mode

The branch trap is the reason the check is per-branch, never a plain numeric threshold: 3.4.13 is fixed but 3.3.13 is still vulnerable. A version comparison that only asks "is it above 3.4.0" gets that wrong.

The self-hosted products are the slow lane

Ruby ships inside products that bundle their own interpreter, so the fix has to come from the vendor. The vendor table below is from the Veria Labs status table, updated 20 November 2026 at 11:58 UTC and re-checked live at flip time on 20 November 2026:

Product Fixed in Status
GitHub Enterprise Server None yet (3.22.5 and earlier) Vulnerable, no fix
Chatwoot 4.20.1 Patched
GitLab 19.6.1, 19.5.8, 19.4.10 Patched
Mastodon 4.7.6, 4.6.12, 4.5.22, 4.4.29 Patched
OpenProject 17.9.8, 17.8.3 Patched
Discourse base image 2.0.20261119-0203 Patched

GitHub Enterprise Server is the one to watch: every current version is vulnerable and no fixed release exists yet. ruby2shell check --product ghes --product-version 3.22.5 answers EXPOSED and says so plainly. If you run GitHub Enterprise Server, treat those installs as exposed until the vendor ships a fix.

How it compares

Tool What it checks Framework + reachability? Local, no network? Fleet scan + CI gate?
Trivy / Grype Installed package / image versions vs a CVE database No (version only) No (needs DB) Yes, for dependencies
bundler-audit Gemfile.lock gems vs ruby-advisory-db No Yes Yes, for gems
Semgrep detection-scripts Version from a running process's own libruby, all seven advisories, fleet wrappers Yes, MethodOverride / Rodauth reachability Yes Yes, per running process
Mahgal/ruby2shell-check Ruby version, framework reachability, product versions, --json, --demo Yes Yes No (one version string at a time)
ruby2shell Ruby version per branch, framework exposure, sharp-s reachability, self-hosted product versions Yes, from config files Yes Yes, exit codes + --json

No version-only tool can tell you whether the app on that Ruby is actually reachable, and bundler-audit cannot see this flaw at all because it checks gems, not the interpreter. ruby2shell is the installable, zero-dependency CLI that does the version plus framework plus reachability check those tools skip. The other six flaws from the same 18/11/2026 release are listed by explain siblings as a checklist, never as full verdicts.

Where rivals beat us, honestly: Mahgal's checker is a single Python file: clone and run, no build step, 0.062 s median runtime, and it shipped hours before this tool on the same day. Semgrep's detectors read the version from a running process's own libruby without executing anything and cover all seven advisories with fleet wrappers; ruby2shell v0.1.0 verdicts only on CVE-2026-132825 and scans installed Rubies on disk. Trivy and Grype cover the whole dependency tree and every CVE at once; ruby2shell checks exactly one CVE and says so on every output. If you need broad CVE coverage or a per-process check, use a scanner or the Semgrep detectors. If you need to know whether this Ruby on this host, running this app, is actually exposed to Ruby2Shell, use this tool.

Honest limits

  • Only CVE-2026-132825 drives verdicts. A SAFE verdict means these conditions do not line up, not that the host is safe from every Ruby flaw.
  • Distro Ruby builds (for example 3.3.0-1ubuntu) are reported UNKNOWN: the distro may have backported the fix. Confirm in the distro advisory, the version string alone does not prove the fix.
  • JRuby and TruffleRuby are reported UNKNOWN: the flaw is in CRuby's case-conversion code.
  • Framework detection reads config files, not a running process: if the Gemfile.lock or config.ru on disk is not the one serving traffic, the verdict follows the wrong app. The evidence paths are printed in every output.
  • Ruby 3.2 and earlier have no fix. An AT-RISK verdict there means upgrade, not patch.
  • An EXPOSED verdict is runtime exposure, not proof of exploitability. Your app may never receive the crafted sharp-s input. The tool never claims otherwise.
  • The 3.4.13 and 3.2.0 version strings in the demo are representative format (version numbers from the advisory); the 3.4.12 string is recorded from a real Ruby built from source.

The code is on GitHub: techdevfun/ruby2shell. If you run Ruby with Rails or classic Sinatra, run ruby2shell scan --app ./your-app and see whether the conditions line up on your hosts before the proof of concept lands on 25 November.

Top comments (0)