Send a Ruby app twenty ß characters and nothing happens.
Send it twenty-one, and Ruby writes one byte past the end of a heap buffer.
That is the whole bug. One byte. The attacker does not even get to choose it: it is always the letter S. And according to Ruby's own advisory, proof-of-concept exploits turn that single S into remote code execution in some scenarios.
The bug is called Ruby2Shell (CVE-2026-132825). It has been in Ruby since 2.4.0, which shipped on Christmas Day 2016. A stock Rails app reaches it before login, before the CSRF check, before a single line of your own code runs.
Since the advisory landed we have been pulling it apart: reading the fix, running it under valgrind, and tracing how a request actually gets there. This post is what we found, including a few things we could not find written down anywhere else, plus two things you can use today: a detection script for your fleet and a prompt you can hand to a coding agent.
TL;DR
What: a one-byte heap overflow in how Ruby changes the case of a string. Ruby rates it Critical.
Who: Ruby 2.4.0 through 3.3.13, 3.4.0 through 3.4.12, and 4.0.0 through 4.0.9. Rails and classic-style Sinatra expose it by default, before authentication.
Fix: Ruby 4.0.10, 3.4.13 or 3.3.14, then restart your app servers. Ruby 3.2 and older get no fix.
It is the interpreter, not a gem.
bundle updatedoes nothing.Gemfile.lockshows nothing. Your dependency scanner will stay quiet.It did not come alone. The same release fixes six more memory bugs in Regexp and String. They have no CVE IDs yet.
The clock: no attacks reported so far. Veria Labs, who published the Ruby2Shell write-up, say they will release a proof of concept a week after disclosure.
Check now: detection scripts for Linux, macOS, Windows and Kubernetes, and a copy-paste prompt further down.
Am I affected?
Start with the version of Ruby your application is running.
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 | everything back to 2.4.0 | no fix, end of life |
One detail that stings: Ruby shipped a security release on October 23 for a set of regex bugs. If you patched for that one, you landed on 4.0.9, 3.4.12 or 3.3.13. Those are exactly the newest versions this bug affects. Being recently patched does not help you here.
Now the part that trips people up. "Which Ruby am I running" is a harder question than it sounds, and the usual tools answer it wrong in four ways.
Your scanner is looking at gems. This bug lives in CRuby itself. Nothing in
Gemfile.lockchanges when you are vulnerable or when you are fixed. And six of the seven bugs have only GitHub advisory IDs, so anything keyed on CVE numbers cannot see them at all.ruby -vin your shell is not your app server. Version managers, system packages and products that bundle their own Ruby (GitLab keeps one in/opt/gitlab/embedded) mean one host often has three or four interpreters. The one that matters is the one inside the running process.Upgrading on disk is not enough. A Puma worker that started yesterday is still running yesterday's code. Until you restart it, the fix is a file nobody is using.
Distro packages do not change the version number. Debian, Ubuntu, RHEL and SUSE backport fixes into the version they already ship. As of November 19, Debian, Ubuntu and SUSE had not shipped one. Some of them ship Ruby 3.0, 3.1 or 3.2, which upstream will never fix.
Then there are the products that carry their own Ruby. This is the picture on November 19, from the Veria Labs write-up and our own checks of release notes and source trees. Check your vendor's notes before trusting it a week from now.
Product | Status on 2026-11-19 |
GitLab (self-managed) | 19.6.0 bundles Ruby 3.3.13. No fixed release yet. |
GitHub Enterprise Server | 3.22.5 bundles Ruby 4.0.9. No fixed release yet. |
Mastodon | Fixed in 4.7.6, 4.6.12, 4.5.22 and 4.4.29. Docker images are updated. Source installs must upgrade Ruby themselves. |
Discourse | Base image 2.0.20261119-0203 carries Ruby 4.0.10. Each forum is fixed only after it is rebuilt. |
OpenProject | Fixed in 17.9.8 (Ruby 4.0.10). |
Chatwoot | 4.20.0 bundles Ruby 3.4.4. No fixed release yet. |
Official Docker | Fixed tags are out for 4.0.10, 3.4.13 and 3.3.14. Your image is fixed after you rebuild on them. |
If you run one of these and there is no fixed release yet, put it behind a VPN or an allowlist until there is.
What is actually going on
German has a letter, ß, with an odd property: its uppercase form is two letters, SS. One character in, two characters out.
When Ruby changes the case of a string, it gives the conversion routine an output buffer of the input length plus 20 bytes. For UTF-8, the code that fills that buffer handles growth correctly. For 14 older single-byte encodings (think ISO-8859-1 and Windows-1252), the loop checks that there is room for one more byte, and then for ß writes two.
Do the arithmetic. Twenty-one ß in, so the buffer is 41 bytes. After twenty of them, 40 bytes are used and one is free. The check passes. Ruby writes SS. The second S lands outside the buffer.
s = ("\xDF" * 21).force_encoding("ISO-8859-1") # 21 x ß
s.upcaseHere is what we find interesting, and what makes this bug awkward to detect. On an unpatched Ruby that code returns the right answer. No crash, no error, nothing in a log. A patched Ruby and an unpatched one give byte-for-byte identical results. Run the unpatched one under valgrind and the truth shows up:
Invalid write of size 1
at case_map (iso_8859_1.c:293)We ran that on the official ruby:3.4.12 image. Twenty characters: clean. Twenty-one: invalid write. The same on ruby:3.4.13: clean. (For a string made of nothing but ß, it is the odd lengths from 21 up that overflow.)
So you cannot probe for this bug. There is no safe request that tells a vulnerable server from a fixed one, and the fix leaves no marker in the binary. Detection comes down to knowing which Ruby each process is running.
The advisory names the encodings only by example. We read the fix and tested each method and encoding.
Reaches the bug | Does not | |
Methods |
|
|
Encodings | ISO-8859-1, -2, -3, -4, -9, -10, -13, -14, -15, -16 and Windows-1250, -1252, -1254, -1257 | UTF-8, US-ASCII, binary, and every other encoding |
Two notes on that table. capitalize is a case-conversion too, but, it does not reach the bug. And casecmp? is easy to miss, because it looks like a comparison and not a conversion. It folds both strings first.
A word on the score. The CVE record carries CVSS 7.4, which is "High", not "Critical". That number comes from scoring the bug as a local attack. Ruby's maintainers rate it Critical. Given the next section, we side with the maintainers.
How a stranger gets there without your help
Most apps never call upcase on a Latin-1 string. Modern Ruby is UTF-8 everywhere. So how is this a pre-login bug in a default Rails app?
Because the framework does it for you.
HTML forms can only send GET and POST. Rails forms that need PUT, PATCH or DELETE carry a hidden field called _method, and a small piece of middleware, Rack::MethodOverride, reads that field and upcases it. patch becomes PATCH.
And in a multipart form, each part is allowed to declare its own character set. Rack honors it. So the string that gets upcased is tagged with whatever encoding the client asked for.
That middleware sits near the top of the stack. It runs before routing, before CSRF protection, before authentication. No account needed, no valid URL needed.
We confirmed this at runtime on Rails 8.1 and 7.2, Sinatra 4.2 and 3.2, and Rack 3.2 and 2.2: the value arrives at the upcase call with the client's encoding intact. We did not build an exploit and we are not publishing a request.
Setup | Exposed by default? |
Rails, full stack | Yes |
Rails with | Not through the middleware. Your own code still can be (next section). |
Sinatra, classic style (require 'sinatra') | Yes |
Sinatra, modular ( | No, unless it enables |
Plain Rack | Only if the app mounts |
Rodauth with | Yes (see below) |
That last row is a second path we found while reading the popular web and auth gems. Rodauth's sign-up feature compares the login field with the "confirm login" field using casecmp?. Sign-up is, by definition, before login. From reading Rodauth's code, it is closed if the app turns off login confirmation or runs JSON-only; we did not run those two settings.
Just as useful is what does not carry the bug. HTTP headers arrive as binary strings under Puma, Unicorn, WEBrick, Thin and Falcon. JSON bodies and query strings are UTF-8. Ordinary URL-encoded forms are UTF-8. None of them get there. That also means a WAF rule hunting for repeated %DF in a URL is looking in the wrong place: the bytes travel raw, inside a multipart body.
Then there is your own code
Removing the middleware does not finish the job, because in Rails every multipart text parameter keeps the charset the client declared, API mode included. Any params[:something].upcase in a controller is the same bug with a different front door. In Sinatra this holds for nested parameters and upload filenames.
We also wanted to know whether gems make this worse. We went through the case-conversion calls in more than 140 gems across the mail, HTTP client, parser and database stack, and another 86 in the web and auth stack. Apart from Rodauth, none of them case-converts attacker data in an affected encoding by default. That is the good news.
The less good news is what they hand back to you. These all give your app strings tagged with an encoding somebody else picked:
HTTP client response bodies. open-uri, HTTParty, Faraday, RestClient and http.rb tag the body with the server's
charset=.Nokogiri HTML4 and XML output (
to_s, to_html, to_xml, inner_html), which inherits the document's declared encoding.Email parts your app re-tags with the sender's charset.
Database rows over a latin1 or cp1252 connection.
CSV and files opened with
encoding: "ISO-8859-1".
If your code upcases one of those, the remote side decides whether it contains 21 ß.
The six bugs nobody is talking about
Ruby2Shell got the name. The same release fixed six more memory-safety bugs, and each of them needs the application to do something specific.
Advisory | Bug | You are exposed if your app |
GHSA-7x2q-68qv-6p8x | Double free while compiling a regex | builds a Regexp from user input |
GHSA-3p8q-wmhx-vm2w | Heap overflow while compiling a regex | builds a very large Regexp from user input |
GHSA-7whj-cfh7-xgm4 | Heap overflow in | calls |
GHSA-pvgc-g7gj-pv6h | Out-of-bounds read | matches user text against a |
GHSA-wpqw-5qxg-m68r | Out-of-bounds read | matches user text against a |
GHSA-87fm-7w84-j2px | Integer overflow, then heap overflow | changes the case of a multi-gigabyte string (the advisory says a result over 4 GiB) |
Three of the six come down to one habit: Regexp.new(params[:q]) without Regexp.escape. If you have a search box that accepts patterns, look at it today.
One more that surprised us: a Rails server running in development mode compiles request text into a Regexp on its own, at /rails/info/routes and /rails/info/notes. A dev-mode server that other machines can reach has always been a bad idea. This is one more reason.
JRuby and TruffleRuby do not share these memory-corruption bugs. We ran the advisories' inputs against both.
Check your fleet
A version check sounds like a one-liner. Then you remember the containers, the bundled Rubies, the distro backports and the workers nobody restarted. So we wrote it once, properly:
github.com/semgrep/detection-scripts/tree/main/CVE-2026-132825
git clone https://github.com/semgrep/detection-scripts
cd detection-scripts/CVE-2026-132825
sudo ./linux/detect-ruby2shell.shIt is one script that covers all seven advisories and prints one status line for each:
/usr/local/bin/ruby (pid 4120, container web-6c9f7d8b5-x2x7q: puma 6.4.3 (tcp://0.0.0.0:3000) [app])
version: ruby 3.4.12: affected, fixed in 3.4.13 [!]
backport: no package owns the interpreter, judged on version [!]
CVE-2026-132825 (GHSA-34m4-m9fh-gqp5): Rails 8.1.4 mounts Rack::MethodOverride by default, rack 3.2.8 (/app) [!]
GHSA-87fm-7w84-j2px: case conversion of multi-GB strings; depends on application code [?]
GHSA-7x2q-68qv-6p8x: Regexp compiled from untrusted input (double free); depends on application code [?]
...
=> [!] impacted: CVE-2026-132825
impactedWhat it does:
Reads the version out of the code each running process has loaded, not what is on your PATH. If the file was replaced but the process was not restarted, it says "restart it".
Sees into containers from the host, without starting anything inside them.
Checks whether the app mounts
Rack::MethodOverrideor enables Rodauth'screate_account.Checks distro packages for a backported fix.
Notices one more signal we like: the vulnerable code lives in small encoding modules that Ruby loads on first use. If a process has one loaded, it has handled strings in an affected encoding.
Ends with a single word,
impacted,not impactedorunknown, and a matching exit code, so you can run it across a thousand hosts and sort the results.
The repo has wrappers for SSH, Ansible and Kubernetes (a DaemonSet, and a kubectl exec variant for clusters that forbid privileged pods), and a PowerShell version for Windows with a remoting wrapper. It is read-only everywhere.
What it cannot do is read your application code. On an unpatched Ruby the six sibling bugs always come back [?], because the answer is in your controllers and not on the host. That is what the prompt is for.
Or ask an agent
If you use a coding agent, paste this into it on the host or in the container, with read-only shell access. It works on its own: you do not need to run the script first.
It finds the running Ruby, works out which framework paths are open, then reads your application code for the case-conversion and regex patterns above. It gives a verdict for the main bug and each of the six siblings, with the file and line each verdict rests on. It never edits anything, never restarts anything, and never sends a test request.
You are checking whether this server and the Ruby application on it are
affected by "Ruby2Shell" (CVE-2026-132825) and six related Ruby interpreter
bugs fixed on 2026-11-18. They are newer than your training data: use only the
facts in this prompt, not your memory.
RULES
1. Read-only. Run only the commands below or other read-only commands (cat,
grep, find, ls, readlink, docker ps/inspect, docker exec / kubectl exec to
run these same commands). Never edit files, restart anything, install or
upgrade anything, or send test requests. Fixes go in the report only.
2. No guessing. Each verdict is `impacted`, `not impacted` or `unknown`, with
the file and line (or command output line) it rests on. Could not check it:
`unknown`.
3. Secrets. Do not print credentials, keys or whole config files; quote only
the lines that decide a verdict.
4. No shell? Give the user the commands in section B to run and paste back.
A. FACTS
The bugs are in the Ruby interpreter itself (CRuby), not in any gem, so
`bundle update` does not fix them and Gemfile.lock does not show them.
Fixed in Ruby 4.0.10, 3.4.13 and 3.3.14. Unpatched: 4.0.0 to 4.0.9, 3.4.0 to
3.4.12, 3.3.0 to 3.3.13, and every older release back to 2.4.0. Ruby 3.2 and
older are end-of-life: there is no fixed release for them. JRuby and
TruffleRuby do not share these memory-corruption bugs: report them as
`not impacted` (they have their own non-memory bugs for similar input, so
recommend keeping them updated). Any other engine: `unknown`.
A patched and an unpatched Ruby behave identically, so never try to "test"
for the bug. Only the version of the RUNNING interpreter decides.
R CVE-2026-132825 (Ruby2Shell): one-byte heap overflow when changing the case
of a string that is tagged with a legacy single-byte encoding and contains
21 or more sharp-s characters (German eszett, byte 0xDF). Ruby rates it
Critical: its advisory says proof-of-concept exploits reach remote code
execution in some scenarios.
Methods that reach it: upcase, upcase!, swapcase, swapcase!,
downcase(:fold), casecmp? (also on Symbols).
Methods that do NOT: capitalize, plain downcase, casecmp, anything called
with :ascii, regular expressions with /i.
Encodings that reach it: ISO-8859-1, -2, -3, -4, -9, -10, -13, -14, -15,
-16 and Windows-1250, -1252, -1254, -1257. UTF-8, US-ASCII and BINARY
(ASCII-8BIT) strings do NOT.
R1 Framework path, no application code needed, before login: the
Rack::MethodOverride middleware upcases the `_method` field of a POST,
and a multipart form part may declare its own charset. Mounted by
default in Rails (not when `config.api_only = true`, not when the app
deletes it) and in classic-style Sinatra (`require 'sinatra'`; not in
`Sinatra::Base` subclasses unless they `enable :method_override`), and
wherever a config.ru says `use Rack::MethodOverride`.
Second framework path: Rodauth with the create_account feature
(`enable ... :create_account`) compares the login and login-confirm
fields with casecmp? before login, unless the config sets
`require_login_confirmation? false` or `only_json? true`.
R2 Application path: app code calls one of the reaching methods on data a
client controls. In Rails every multipart text parameter keeps the
charset the client declared, API mode included, so
`params[:x].upcase` or `casecmp?` on a param is reachable. In Sinatra
this holds for nested params (`x[y]`) and upload filenames. It also
holds for strings that arrive already tagged with a charset chosen by
a remote party or by configuration, when that party controls the
content:
- HTTP client response bodies: open-uri, HTTParty, Faraday, RestClient,
http.rb and httpclient tag the body with the server's `charset=`
(Net::HTTP only with `response_body_encoding`; excon, typhoeus and
mechanize bodies are BINARY);
- Nokogiri HTML4/XML output (`to_s`, `to_html`, `to_xml`, `inner_html`)
inherits the document's declared encoding (`.text` is UTF-8);
- email parts the app re-tags, e.g.
`part.body.decoded.force_encoding(part.charset)` (the mail gem's own
decoded headers and text are UTF-8 or BINARY);
- database rows when the connection encoding is latin1, latin2, cp1250,
cp1252 and similar (mysql2, trilogy, pg, tiny_tds, Oracle NLS_LANG);
- CSV or files read with `encoding: "ISO-8859-1"` (or another affected
encoding), or with `Encoding.default_external` set to one;
- anything the app tags itself with `force_encoding` or `encode`.
The six related bugs need specific application code:
S1 GHSA-7x2q-68qv-6p8x and S2 GHSA-3p8q-wmhx-vm2w: a Regexp is compiled from
client input (Regexp.new / Regexp.compile / /...#{input}.../ without
Regexp.escape). A Rails server running in development mode does this
itself at /rails/info/routes?query= and /rails/info/notes?tag=: if step 2
shows RAILS_ENV=development (or a `rails server` with no environment) on a
server other machines can reach, S1 and S2 are `impacted`.
S3 GHSA-7whj-cfh7-xgm4: Regexp#to_s, Regexp.union, or interpolating a Regexp
object into another, where that Regexp was built from client input.
S4 GHSA-pvgc-g7gj-pv6h: client text is matched against a case-insensitive
regexp that contains a backreference (\1, \k<name>).
S5 GHSA-wpqw-5qxg-m68r: either the client controls the pattern (then S1
already applies, mark S5 the same), or client text is matched against a
developer-written case-insensitive regexp whose encoding is UTF-16 or
UTF-32. An ordinary UTF-8 /i regexp written by the developer is fine.
S6 GHSA-87fm-7w84-j2px: case conversion of a multi-gigabyte string (the
advisory says a converted result over 4 GiB). Judge
from the code you read: only apps that load multi-GB files or bodies into
one string and change its case count.
Traps
- `ruby -v` in your shell may be a different Ruby than the one the app
server runs (version managers, bundled Rubies such as
/opt/gitlab/embedded/bin/ruby). Judge the running process.
- If the libruby or ruby file was replaced on disk, the process still runs
the old code until restarted: step 2 shows "(deleted)".
- Distribution packages (Debian, Ubuntu, RHEL, SUSE, Alpine) may backport
the fix without changing the version, and you do not know their fixed
package versions: report the package and say `unknown` until checked
against the vendor advisory. Official Docker `ruby` images and
rbenv/rvm/asdf builds are plain upstream: the version rules apply.
- Inside one container you see only that container. Say so.
- Section B is written for Linux. On a Windows host ask the same questions
with read-only PowerShell: find ruby.exe / rubyw.exe and their paths with
`Get-CimInstance Win32_Process`, get the version with `<that ruby.exe> -v`,
and search the application with `Select-String`. Windows builds are plain
upstream builds.
B. PROCEDURE (POSIX sh)
This prompt is complete on its own: run steps 1 to 7. Nothing else is needed.
Optional shortcut, only if the user happens to paste output from the
detect-ruby2shell.sh script: you may take the patch status of each Ruby from
it and skip steps 2 and 3. Never ask the user for that output or wait for it.
1. Where am I:
id -u; head -n 2 /etc/os-release; ls /.dockerenv /run/.containerenv 2>/dev/null; true
2. Running Ruby processes, the version of the code they run, their app
directory, and any affected encoding module they have loaded:
for d in /proc/[0-9]*; do m=$(cat "$d/maps" 2>/dev/null) || continue; e=$(readlink "$d/exe" 2>/dev/null); l=$(printf '%s\n' "$m" | grep -m 1 -oE '/[^ ]*libruby[^ ]*[.]so[^ ]*( [(]deleted[)])?'); case "${e##*/}" in ruby*) ;; *) [ -n "$l" ] || continue ;; esac; f=${l:-$e}; f=${f% (deleted)}; echo "pid=${d#/proc/} exe=$e lib=$l cwd=$(readlink "$d/cwd" 2>/dev/null) ver=$(tr -c ' -~' '\n' < "$d/root$f" 2>/dev/null | grep -m 1 -oE '^ruby [0-9]+[.][0-9]+[.][0-9]+[a-z0-9]*') enc=$(printf '%s\n' "$m" | grep -oE 'enc/(iso_8859_(1|2|3|4|9|10|13|14|15|16)|windows_125(0|2|4|7))[.]so' | sort -u | tr '\n' ' ') env=$(tr '\0' '\n' < "$d/environ" 2>/dev/null | grep -E '^(RAILS_ENV|RACK_ENV|APP_ENV)=' | tr '\n' ' ') cmd=$(tr '\0' ' ' < "$d/cmdline" | cut -c1-80)"; done
ver= is read from the code the process is running. Ruby 3.1 and older
print a patch level after the version: "ruby 3.0.2p107" is 3.0.2.
A non-empty enc= proves that process has handled strings in an affected
encoding (not that it was attacked). Empty proves nothing.
An empty env= means none of those variables is set. Rails and Rack then
default to development unless the command line says otherwise (for
example `-e production`), so check cmd= before deciding the mode.
3. Installed Rubies and packages (context only; step 2 decides; the same
interpreter may be listed twice under two paths):
for r in $(command -v ruby) /usr/local/bin/ruby /usr/bin/ruby /opt/*/embedded/bin/ruby /opt/puppetlabs/puppet/bin/ruby; do [ -x "$r" ] && echo "$r: $("$r" -e 'print RUBY_DESCRIPTION' 2>/dev/null)"; done; dpkg-query -W -f='${Package} ${Version}\n' 2>/dev/null | grep -E '^(ruby|libruby)'; rpm -qa 2>/dev/null | grep -E '^ruby'; apk info -v 2>/dev/null | grep -E '^ruby'; true
4. The application. <APP> is the cwd of the app server from step 2 (walk up
until you find Gemfile.lock or config.ru):
cd <APP> && cat .ruby-version 2>/dev/null; grep -nE '^ (rails|railties|sinatra|rack|hanami|roda|rodauth|grape|mail) [(]' Gemfile.lock; grep -rnE 'api_only|Rack::MethodOverride|method_override' app lib config config.ru *.rb 2>/dev/null | head -n 20; grep -rnE 'require[ (]+.sinatra|Sinatra::Base' app lib config.ru *.rb 2>/dev/null | head -n 20; grep -rnE 'create_account|require_login_confirmation|only_json' app lib config *.rb 2>/dev/null | head -n 20; true
(Rails keeps `config.api_only` in config/application.rb. `require
'sinatra'` is classic style; `require 'sinatra/base'` with a
`Sinatra::Base` subclass is modular.)
5. Application code that changes case (R2). Read each hit and decide whether
a client can control the receiver and whether it can be legacy-encoded
(`map(&:upcase)` and `send(:upcase)` count like `.upcase`):
cd <APP> && grep -rnE '(^|[^a-zA-Z_])(upcase|swapcase)!?([^_a-zA-Z]|$)|casecmp[?]|downcase[( ]+:fold' app lib *.rb 2>/dev/null | head -n 80; grep -rnE 'force_encoding|[.]encode[(]|ISO-8859|Windows-125|CP125|latin[0-9]|cp125|default_(external|internal)|response_body_encoding|[.]charset' app lib config *.rb 2>/dev/null | head -n 40; grep -nE '^ (httparty|faraday|rest-client|http|httpclient|nokogiri|mail|mysql2|trilogy|pg|tiny_tds|ruby-oci8|csv|simple-rss|vpim|icalendar) [(]' Gemfile.lock 2>/dev/null; true
6. Application code for S1 to S5. First the places a Regexp is built or
re-used, then every case-insensitive regexp literal that has a group:
cd <APP> && grep -rnE 'Regexp[.](new|compile|union)|#[{][^}]*[}][^/]*/[imxounse]*([^a-zA-Z0-9_]|$)|UTF-(16|32)' app lib *.rb 2>/dev/null | head -n 80; grep -rnE '[/}][imxounse]*i[imxounse]*([^a-zA-Z0-9_/]|$)|[(][?][mx-]*i|IGNORECASE' app lib *.rb 2>/dev/null | grep -F '(' | head -n 80; true
For S4, read each line of the second list and look for a backreference:
a backslash followed by a digit 1 to 9, or by k and a name in angle
brackets. (The command does not search for the backslash itself, because
escaping it survives badly through nested shells.)
7. Signs of crashes (add the app and web server log paths):
grep -rhsE '[[]BUG[]] Segmentation fault|rb_str_casemap|method_override[.]rb|malloc[(][)]: |corrupted size|terminated by SIG(SEGV|ABRT)|reaped .*worker' /var/log <APP>/log 2>/dev/null | tail -n 20; true
C. DECIDING (per running Ruby application)
- Patch status from step 2: `patched`, `unpatched`, or `unknown`
(distribution package, an engine other than CRuby, JRuby or TruffleRuby,
or version unreadable). A Ruby under /usr/bin or /usr/lib that matches a
package listed in step 3 is a distribution build.
- Patched: every item is `not impacted`. Skip steps 4 to 7 for it.
- Unknown patch status: decide every item as for unpatched, and write
`impacted unless the package carries the fix` instead of `impacted`.
- Unpatched:
R1 `impacted` if step 4 shows Rails without api_only and without a
`middleware.delete Rack::MethodOverride` (no such lines in the step 4
output means the middleware is mounted), or classic-style Sinatra
without `disable :method_override`, or an explicit
`use Rack::MethodOverride`, or Rodauth with create_account enabled and
login confirmation not turned off. Otherwise `not impacted (no
framework path)`. No app found: `unknown`.
R2 `impacted` if a step 5 hit takes a request parameter, upload filename,
or other client-influenced string that can carry a legacy encoding.
Open and read the file behind each hit; do not judge from the grep
line alone. Only the application's own code counts here. A string
from a remote server counts even when the app only talks to a fixed,
trusted host: say `impacted` and note that it depends on that host.
Receivers that are constants, symbols, config values, HTTP header
values (BINARY), JSON body values or query-string values (UTF-8) do
not count. A non-empty enc= in step 2 means some code path does use an
affected encoding: find it before saying `not impacted`.
S1 to S5: `impacted` only when you can point at the line where client
input reaches the pattern (S1, S2, S3) or the matched text (S4, S5).
Patterns written by the developer and matched against client text are
fine for S1 to S3. S6: `not impacted` unless the app handles multi-GB
strings.
If the application code could not be read, R2 and S1 to S5 are `unknown`.
- An unpatched Ruby is never `not impacted` overall: with every item clear,
report `unpatched, no exposed path found` and still recommend the upgrade.
- Step 7 hits are leads for investigation, not proof of an attack.
D. REPORT (short)
Scope and vantage; per application: process, running Ruby version, package,
patch status; table: item (R1, R2, S1..S6) | verdict | deciding file:line or
output line; log hits; not checked; what to do:
- Fix: upgrade Ruby to 4.0.10 / 3.4.13 / 3.3.14 (or the vendor's fixed
package or product release), rebuild images, then RESTART every app server
and worker and re-run step 2. Ruby 3.2 and older: move to a supported
series.
- Until then, only if R1 is impacted. These are unofficial stopgaps, not a
fix, and they do not cover R2 or S1 to S6:
- Rack::MethodOverride: remove the middleware
(`config.middleware.delete Rack::MethodOverride` in Rails,
`disable :method_override` in Sinatra; HTML forms that send PUT, PATCH
or DELETE through `_method` stop working), or put a small Rack
middleware at the very front that rejects multipart parts declaring a
charset other than UTF-8 (in classic Sinatra it must sit in front of
Sinatra's own middleware, not be added with `use`), or the equivalent
rule at the proxy or WAF.
- Rodauth: `require_login_confirmation? false` removes the comparison (the
sign-up form then has no confirm field). This one is untested.Treat the answer like any agent output: it shows its evidence so that you can check it.
Fix it
Upgrade Ruby to 4.0.10, 3.4.13 or 3.3.14, or to your distro's or vendor's fixed package. Rebuild your container images on a fixed base, and update the pins: Dockerfiles,
.ruby-version, CI images.Restart everything. App servers and background workers. Then run the detector again and make sure nothing is still running the old file.
On Ruby 3.2 or older, move. There is no patch coming for those series.
If you cannot upgrade today
Ruby publishes no workaround. These close the two framework paths and nothing else. They do not cover your own code or the six sibling bugs.
Rails:
config.middleware.delete Rack::MethodOverride. Forms that send PUT, PATCH or DELETE through a hidden_methodfield stop working, so check what you break.Sinatra:
disable :method_override.Rodauth:
require_login_confirmation? false.Or reject multipart parts that declare a charset other than UTF-8, in a middleware at the very front of the stack or at your proxy or WAF. In classic Sinatra a middleware added with
useruns too late:Rack::MethodOverridehas already run.
We tested the Rails and Sinatra settings and the front-of-stack middleware on Rails 8.1 and Sinatra 4.2 and the front-of-stack middleware for both. We did not test the Rodauth setting or a proxy rule.
Should you look for attacks?
Patch first. After that, the signs worth a look are the ones a failed attempt leaves behind: Ruby workers dying with [BUG] Segmentation fault, glibc aborts such as corrupted size or malloc(): errors, and app servers reaping workers in bursts, especially when they line up with multipart POSTs from one source.
None of that proves an attack. Workers crash for dull reasons too. And a clean log proves nothing, because the overflow by itself usually does not crash anything.
What we do not know
We have not seen a working exploit and did not build one. "Remote code execution in some scenarios" is the Ruby maintainers' wording. Veria Labs has promised a proof of concept; it is not public yet.
The six sibling bugs have no CVE IDs or scores yet.
Vendor and distro status is moving daily. Our table is a snapshot.
One byte, almost ten years, and a hidden form field most of us forgot existed. Upgrade the interpreter, restart the workers, and then go find out how many Rubies your hosts were running that nobody told you about.
Sources
Ruby security announcement, 2026-11-18: https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/
Ruby advisory GHSA-34m4-m9fh-gqp5 (credit: Stephan Lipp of Ada Logics, and Anthropic): https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5
Veria Labs write-up: https://verialabs.com/ruby2shell/
Detection scripts: https://github.com/semgrep/detection-scripts/tree/main/CVE-2026-132825