---
title: "Ruby2Shell (CVE-2026-132825): affected Ruby versions, the patch, mitigations"
description: "Ruby2Shell is a one-byte heap buffer overflow in Ruby's string case conversion, CVE-2026-132825, reachable before login in default Rails apps. Ruby rates it critical; the CVE record scores it 7.4. Fixed in Ruby 4.0.10, 3.4.13 and 3.3.14; Ruby 3.2 and older get no fix. No exploitation in the wild is reported as of 23 November 2026. Affected versions, the patch itself, how to check, and what to do until you can upgrade."
cve: [CVE-2026-132825]
published: 2026-11-25
updated: 2026-11-25
canonical: https://yeet.cx/cve/CVE-2026-132825
---

# Ruby2Shell (CVE-2026-132825)

Ruby2Shell is CVE-2026-132825, a one-byte heap buffer overflow in the ruby interpreter that its maintainers rate critical: changing the case of a string that holds the german sharp s (ß) in a legacy single-byte encoding writes one byte past a heap buffer, and the maintainers say proofs of concept turn that into remote code execution in some scenarios.

**what to do:** upgrade ruby to **4.0.10, 3.4.13 or 3.3.14** and restart every app server and worker. ruby 3.2 and older are end of life and get no fix: move to a supported branch or install your distribution's backport. software that bundles its own ruby (gitlab, github enterprise server, mastodon, discourse, openproject, chatwoot) is fixed only by the vendor's release.

- **severity:** 7.4 high (CVSS 3.1)
- **access needed:** network, no login (on a default rails app, before authentication. the CVE record scores the vector as local)
- **exploited:** none reported, not on CISA's KEV list as of 25 nov 2026; private proofs of concept exist, ruby said on 18 nov 2026; veria labs plans a public proof of concept for 25 nov 2026 or later, and had not published one as of 25 nov
- **install:** ruby 4.0.10, 3.4.13 or 3.3.14, released 18 nov 2026

## what is Ruby2Shell?

several of ruby's single-byte encodings have no capital sharp s, so changing the case of ß (byte `0xDF`) turns one byte into two: `SS` on upcase, `ss` on case-fold. the `case_map()` loop in each affected encoding file checked that one byte of output room remained and then wrote two, so the second byte lands one past the end of a heap buffer ([the fix commit](https://github.com/ruby/ruby/commit/d582f8f13d700d8e39714d3a8f11eb4bd2bc69f0)). ruby sizes that buffer at the input length plus 20 bytes, which makes 21 ß the shortest string that overflows. the byte written is always `S` or `s`: an attacker chooses the size of the buffer through the length of the input, not the value. 14 encodings are affected, the exact set of files the fix changes: ISO-8859-1, -2, -3, -4, -9, -10, -13, -14, -15 and -16, and Windows-1250, -1252, -1254 and -1257. [ruby's advisory](https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5) names only ISO-8859-1 and Windows-1252, as examples. UTF-8 strings take a different code path and are not affected. the bug is in the interpreter (CRuby), not in a gem, and it has been in every release since ruby 2.4.0 in 2016.

a default rails app and a classic-style sinatra app reach the bug before login, with no help from application code. [semgrep](https://semgrep.dev/blog/2026/ruby2shell-cve-2026-132825/) and [durendal.sh](https://durendal.sh/blog/ruby-case-mapping-bugs) trace the same path through rack. HTML forms send only GET and POST, so forms that need PUT, PATCH or DELETE carry a hidden `_method` field, and the `Rack::MethodOverride` middleware [reads that field and calls `upcase` on it](https://github.com/rack/rack/blob/v3.2.7/lib/rack/method_override.rb#L31-L38) before routing, CSRF protection and authentication. in a multipart form each part may declare its own character set, and [rack honours it](https://github.com/rack/rack/blob/v3.2.7/lib/rack/multipart/parser.rb#L556-L584), so the value arrives at `upcase` tagged with the encoding the client chose. rails with `config.api_only = true`, modular sinatra and plain rack do not mount the middleware unless the app adds it. semgrep also reports a second path in rodauth's `create_account`, which compares the login with its confirmation using `casecmp?` before login, and notes that application code calling `upcase` or `casecmp?` on a multipart text parameter is reachable the same way, API mode included.

two things are confirmed: the one-byte write (the upstream regression test, semgrep under valgrind, and an independent sanitizer run), and that the rack path delivers a client-chosen encoding to `upcase` (semgrep at runtime on rails 8.1 and 7.2, sinatra 4.2 and 3.2 and rack 3.2 and 2.2; durendal.sh from the rack source). no working exploit request has been published, and semgrep says it built no exploit. what the write buys an attacker is disputed. ruby's advisory says the maintainers "are aware of PoCs that prove this flaw can be used to trigger RCE in some scenarios", and durendal.sh reports a private pre-authentication RCE against a plain `rails new` app running jemalloc on 5 november 2026, and says it reproduced the exploit with the default glibc allocator the next day. against that, watchTowr told [securityweek](https://www.securityweek.com/ruby-patches-ruby2shell-vulnerability-that-could-lead-to-rce/) that exploitation in production is likely to be hard and most likely ends in denial of service, [miggo](https://www.miggo.io/post/ruby2shell-cve-2026-132825-ruby-regexp-string-vulnerabilities) reports reproducing a denial of service on rails and sinatra, an [independent reproduction](https://github.com/evenomn/CVE-2026-132825) found that a run of nothing but ß is "absorbed by glibc's allocation alignment" and crashes only under a sanitizer, and [ox](https://www.ox.security/blog/ruby2shell-ruby-memory-corruption-flaws-expose-applications-to-remote-code-execution-but-is-it-an-actual-risk/) calls the bug "more marketing than actual risk".

the severity scores split along the same line. ruby's maintainers rate the bug critical and published no CVSS score. MITRE, the CNA on the [CVE record](https://www.cve.org/CVERecord?id=CVE-2026-132825), scores it 7.4 (high) with a local attack vector and high attack complexity. red hat scores it 9.8 (critical) with a network vector and low complexity. the disagreement is whether the pre-authentication path through rails counts as network reach: semgrep sides with the maintainers because of that path, and ox sides with the 7.4. NVD and ubuntu repeat MITRE's score, and NVD had not analysed the CVE itself as of 23 november 2026. the three scorers also file it under different weakness classes: off-by-one (ruby), heap overflow (MITRE) and out-of-bounds write (red hat). the same advisory fixes six other memory-safety bugs in ruby's regular expression engine and string case conversion, tracked only by GHSA ids as of 23 november 2026; the same three releases fix all seven.

### CVE-2026-132825

- advisory: Heap buffer overflow in case conversion of strings ([GHSA-34m4-m9fh-gqp5](https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5))
- what goes wrong: the case-mapping loop for 14 legacy single-byte encodings checked that one byte of output room remained, then wrote two when it met the sharp s (ß, byte `0xDF`), which these encodings upcase to `SS` and case-fold to `ss`. the second byte lands one past the end of a heap buffer. the value is fixed, `S` or `s`: an attacker controls the size of the buffer through the input length, not the byte written.
- how it is reached: changing the case of a string that is tagged with one of the 14 affected encodings and holds at least 21 ß, through `upcase`, `swapcase`, `downcase(:fold)` or `casecmp?` (their `!` and Symbol forms included). UTF-8 strings take a different code path. in a default rails app and a classic-style sinatra app the `Rack::MethodOverride` middleware makes that call itself, on the `_method` form field, before routing, CSRF checks and authentication.
- confirmed on: the one-byte out-of-bounds write: by the upstream regression test, by semgrep under valgrind on the official `ruby:3.4.12` image (clean at 20 ß, an invalid write at 21), and by an independent sanitizer run. the request path: by semgrep at runtime on rails 8.1 and 7.2, sinatra 4.2 and 3.2 and rack 3.2 and 2.2, and by durendal.sh from the rack source. remote code execution: only in private proofs of concept that ruby's maintainers and durendal.sh describe. nothing is public as of 23 november 2026.
- CVSS 3.1: 7.4 high, scored by MITRE (the CNA), `CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`
- CVSS 3.1: 9.8 critical, scored by red hat, `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`

weakness classes: CWE-193 Off-by-one Error, CWE-122 Heap-based Buffer Overflow, CWE-787 Out-of-bounds Write.

## is Ruby2Shell being exploited?

### timeline

- 2026-10-26: Moritz Sanft completes an end-to-end exploit against a toy rails app and posts its SHA-256 hash on X, by his own account. he began looking at ruby three days earlier. ([durendal.sh](https://durendal.sh/blog/ruby-case-mapping-bugs))
- 2026-10-28: Yusuke Endoh authors the fix commit, which names Stephan Lipp as the reporter. it reaches the public branches on 18 november. ([ruby/ruby](https://github.com/ruby/ruby/commit/d582f8f13d700d8e39714d3a8f11eb4bd2bc69f0))
- 2026-11-05: a collaborator of Sanft's at openai demonstrates pre-authentication RCE against a plain `rails new` app, and openai sends reports to the ruby security team that evening, by Sanft's account. ([durendal.sh](https://durendal.sh/blog/ruby-case-mapping-bugs))
- 2026-11-18: ruby commits the fix to master and the 4.0, 3.4 and 3.3 branches and releases ruby 4.0.10, 3.4.13 and 3.3.14 with an advisory covering seven bugs. ruby dates the posts 18 november; the ruby-lang.org post's history line reads 19 november, 00:00 UTC, and the github advisory went up at 00:13 UTC. ([ruby-lang.org](https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/))
- 2026-11-19 06:34 UTC: MITRE publishes CVE-2026-132825 with a CVSS score of 7.4. the same day mastodon, openproject and the discourse base image ship a fixed ruby, and veria labs, semgrep and durendal.sh publish their write-ups. ([CVE record](https://www.cve.org/CVERecord?id=CVE-2026-132825))
- 2026-11-20: gitlab 19.6.1, 19.5.8 and 19.4.10 and chatwoot 4.20.1 ship a fixed ruby. debian publishes DSA-6644-1 and DLA-4926-1. ([gitlab](https://docs.gitlab.com/releases/patches/patch-release-gitlab-19-6-1-released/))
- 2026-11-22: github enterprise server 3.22.6, 3.21.11, 3.20.13 and 3.19.17 ship. red hat finishes publishing fixed hardened images, and debian corrects its ruby 3.1 package version in DLA-4926-2. ([github](https://docs.github.com/en/enterprise-server@3.22/admin/release-notes))
- 2026-11-23: CISA's KEV catalog, version 2026.11.23, does not list the CVE, and no exploitation in the wild is reported. ubuntu and red hat enterprise linux have no fixed package yet. ([CISA](https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2026-132825))
- 2026-11-24: red hat publishes fixes for red hat enterprise linux 10, 9 and 8, including backports to ruby 3.0 on RHEL 9 and ruby 2.5 on RHEL 8. ([red hat](https://access.redhat.com/security/cve/CVE-2026-132825))
- 2026-11-25: the date veria labs has announced for a public proof of concept of remote code execution on stock rails, "or later if major vendors have not shipped a fix by then". ([veria labs](https://verialabs.com/ruby2shell/))

no exploitation in the wild is reported as of 23 november 2026. CVE-2026-132825 is not in CISA's [known exploited vulnerabilities catalog](https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2026-132825) (catalog version 2026.11.25), and CISA's assessment on the [CVE record](https://www.cve.org/CVERecord?id=CVE-2026-132825), dated 19 november 2026, lists exploitation as none. [watchTowr](https://watchtowr.com/intelligence/ruby-cve-2026-132825-faq/) and [miggo](https://www.miggo.io/post/ruby2shell-cve-2026-132825-ruby-regexp-string-vulnerabilities) reported none as of 19 november. EPSS is 0.01976, the 81st percentile, as of 25 november 2026.

private proofs of concept exist. [ruby's advisory](https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5), published 19 november 2026 (UTC), says: "We are aware of PoCs that prove this flaw can be used to trigger RCE in some scenarios." [durendal.sh](https://durendal.sh/blog/ruby-case-mapping-bugs) (Moritz Sanft, 19 november 2026) reports that a collaborator at openai demonstrated pre-authentication remote code execution against a plain `rails new` app on 5 november 2026, and that openai sent reports to the ruby security team that evening. none of that code is public.

a public proof of concept is announced. [veria labs](https://verialabs.com/ruby2shell/), which named the bug, wrote as of 21 november 2026: "We'll be publishing 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." the date had not moved, and no proof of concept had been published, as of 25 november 2026.

other researchers doubt that the bug yields reliable code execution. watchTowr's Yordan Ganchev told [securityweek](https://www.securityweek.com/ruby-patches-ruby2shell-vulnerability-that-could-lead-to-rce/) on 20 november 2026 that exploitation in production is likely to be challenging: "attackers would also need the right non-glibc memory allocator, runtime configuration, and application logic preconditions", and would have to defeat ASLR. the most likely result, he said, is denial of service. durendal.sh's account cuts against the allocator point: it says its exploit also worked on glibc's default allocator. miggo reports reproducing a denial of service on rails and sinatra applications (19 november 2026). an [independent reproduction](https://github.com/evenomn/CVE-2026-132825) dated 19 november 2026 found that a string of nothing but ß is "absorbed by glibc's allocation alignment" and crashes only under a sanitizer, so real heap corruption needs a crafted mixed string; it built no remote delivery path. [ox](https://www.ox.security/blog/ruby2shell-ruby-memory-corruption-flaws-expose-applications-to-remote-code-execution-but-is-it-an-actual-risk/) wrote on 19 november 2026 that the bug is "more marketing than actual risk".

## the yeet programmable firewall

the upgrade is the fix. until it lands, the yeet programmable firewall blocks the request on the host, in the network driver, with no restart.

[book a demo](https://yeet.cx/demo), or [learn more](https://yeet.cx/discover/programmable-firewall) about the yeet programmable firewall.

## which ruby versions are affected, and which fix it?

every supported branch was affected, and ruby fixed all three in 4.0.10, 3.4.13 and 3.3.14, which it dates 18 november 2026 (the ruby-lang.org post's history line reads 19 november, 00:00 UTC, and the github advisory went up at 00:13 UTC). ruby 3.2 and older are end of life and get no fix from ruby. replacing the interpreter on disk is not enough: a worker that started before the upgrade runs the old code until it restarts.

| branch | vulnerable | first fixed | install now |
| --- | --- | --- | --- |
| ruby 4.0 | 4.0.0 through 4.0.9 | 4.0.10 | 4.0.10 |
| ruby 3.4 | 3.4.0 through 3.4.12 | 3.4.13 | 3.4.13 |
| ruby 3.3 | 3.3.0 through 3.3.13 | 3.3.14 | 3.3.14 |
| ruby 3.2 and older (end of life) | all releases back to 2.4.0 | no ruby release | a distribution backport, or 3.3 and later |

- ruby 3.3: with 3.3.14 the branch is in [legacy maintenance](https://www.ruby-lang.org/en/downloads/branches/), which gets security fixes and selected bug fixes. its end of life is expected on 31 march 2027.
- ruby 3.2 and older: ruby 3.2 reached end of life on 1 april 2026. debian 12 ships a backported fix for its ruby 3.1 package; where no backport exists, move to 3.3 or later.

### distribution packages

distributions patch their own ruby packages, and some backport the fix without moving the upstream version number, so `ruby -v` cannot prove the fix there. the table lists the packages that were fixed as of 25 november 2026. on that date [ubuntu](https://ubuntu.com/security/CVE-2026-132825) listed every series as "needs evaluation" with no fixed package, and debian unstable was unfixed. [red hat](https://access.redhat.com/security/cve/CVE-2026-132825) shipped fixes for red hat enterprise linux 8, 9 and 10 on 24 november, and lists red hat enterprise linux 7 as not affected. we could not read SUSE's status.

| distribution | package | first fixed package | version number | advisory |
| --- | --- | --- | --- | --- |
| debian 13 (trixie) | ruby3.3 | 3.3.14-0+deb13u1 | moves to the fixed release | [DSA-6644-1](https://security-tracker.debian.org/tracker/CVE-2026-132825) |
| debian 12 (bookworm) | ruby3.1 | 3.1.7-1~deb12u2 or 3.1.7+really3.1.2-0+deb12u1 | stays the same | [DLA-4926-1, DLA-4926-2](https://security-tracker.debian.org/tracker/CVE-2026-132825) |
| alpine 3.22, 3.23 and 3.24 | ruby | 3.4.13-r0 | moves to the fixed release | [alpine packages](https://pkgs.alpinelinux.org/package/v3.24/main/x86_64/ruby) |
| alpine edge | ruby | 4.0.10-r0 | moves to the fixed release | [alpine packages](https://pkgs.alpinelinux.org/package/edge/main/x86_64/ruby) |
| alpine 3.21 | ruby | 3.3.14-r0 | moves to the fixed release | [alpine packages](https://pkgs.alpinelinux.org/package/v3.21/main/x86_64/ruby) |
| red hat enterprise linux 10 | ruby4.0, ruby | 4.0.10-39.el10_3, 3.3.14-17.el10_3 | moves to the fixed release | [RHSA-2026:102714, RHSA-2026:102715](https://access.redhat.com/errata/RHSA-2026:102714) |
| red hat enterprise linux 9 | ruby | 3.0.7-171.el9_9 | stays the same | [RHSA-2026:102854](https://access.redhat.com/errata/RHSA-2026:102854) |
| red hat enterprise linux 9 | ruby:3.3, ruby:4.0 modules | 3.3.14-11.module+el9.9.0, 4.0.10-37.module+el9.9.0 | moves to the fixed release | [RHSA-2026:102869, RHSA-2026:102883](https://access.redhat.com/errata/RHSA-2026:102869) |
| red hat enterprise linux 8 | ruby:3.3 module | 3.3.14-10.module+el8.10.0 | moves to the fixed release | [RHSA-2026:102909](https://access.redhat.com/errata/RHSA-2026:102909) |
| red hat enterprise linux 8 | ruby:2.5 module | 2.5.9-119.module+el8.10.0 | stays the same | [RHSA-2026:102928](https://access.redhat.com/errata/RHSA-2026:102928) |
| red hat hardened images | ruby4-0, ruby3-4, ruby3-3 | 4.0.10, 3.4.13, 3.3.14 | moves to the fixed release | [red hat (RHSA-2026:100837, RHSA-2026:101662, RHSA-2026:101632)](https://bugzilla.redhat.com/show_bug.cgi?id=2576211) |

## how do I check whether my ruby is patched?

there is no safe probe for Ruby2Shell. on the triggering input a fixed ruby and an unfixed one return byte-for-byte identical results, with no crash and no log line, and the fix leaves no marker in the binary, so no request and no one-liner can tell them apart ([semgrep](https://semgrep.dev/blog/2026/ruby2shell-cve-2026-132825/)). the checks below read versions and find interpreters; none of them tests for the bug. the question to answer is which ruby the serving process runs: one host often carries several interpreters, and a worker that started before the upgrade runs the old code. the longer commands are semgrep's read-only procedure, and we have not run any of these commands ourselves.

### read the version

enough for upstream builds: ruby's own releases, the official docker images, and rbenv, asdf or mise builds. the output starts with `ruby` and the version number. 4.0.10, 3.4.13 or 3.3.14, or later on the same branch, is fixed; 4.0.9, 3.4.12, 3.3.13 or older, and anything on 3.2 or below, is vulnerable. run the interpreter that serves requests, by its full path for a bundled ruby.

ruby:

```sh
ruby -v
```

bundled (gitlab):

```sh
/opt/gitlab/embedded/bin/ruby -v
```

container image:

```sh
docker run --rm <image> ruby -v
```


### find every ruby installed on this host

one host often carries several interpreters: a version manager's, the distribution's, and ones bundled with products such as gitlab. this loop from [semgrep's procedure](https://semgrep.dev/blog/2026/ruby2shell-cve-2026-132825/) prints the description of each interpreter it finds at the usual paths. it is context only. the next check decides, because it reads what running processes have loaded.

```sh
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
```


### find every ruby process and the code it runs

the check that decides. semgrep's one-liner walks `/proc`, finds every process with a ruby interpreter loaded and reads the version string out of the mapped file, so `ver=` is the code the process is running and not what is on disk. `(deleted)` after `lib=` means the file was replaced and the process was not restarted: restart it and run the check again. a non-empty `enc=` means the process has loaded one of the affected encoding modules, which proves it has handled a string in an affected encoding, not that it was attacked. run it as root so it can read every process.

```sh
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
```


### check the distribution package, not the version string

on debian, ubuntu, RHEL and SUSE the fix can arrive as a backport that keeps the old upstream version, so `ruby -v` cannot prove it. list the installed package and compare it with the distribution's advisory. debian 12's `ruby3.1` is fixed in `3.1.7-1~deb12u2` (DLA-4926-1) and in `3.1.7+really3.1.2-0+deb12u1` (DLA-4926-2, which only corrects the version number), debian 13's `ruby3.3` in `3.3.14-0+deb13u1`, and alpine's `ruby` in `3.4.13-r0` or `3.3.14-r0`, or `4.0.10-r0` on edge. red hat enterprise linux 8, 9 and 10 are fixed by the advisories in the table above. ubuntu had no fixed package as of 25 november 2026.

debian, ubuntu:

```sh
dpkg-query -W -f='${Package} ${Version}\n' 2>/dev/null | grep -E '^(ruby|libruby)'
```

RHEL:

```sh
rpm -qa 2>/dev/null | grep -E '^ruby'
```

alpine:

```sh
apk info -v 2>/dev/null | grep -E '^ruby'
```

## the patch

one commit fixes the bug on every branch. Yusuke Endoh wrote it on 28 october 2026, with a `Co-Authored-By: Claude Mythos 5.1` trailer, and it reached master and the 4.0, 3.4 and 3.3 release branches on 18 november 2026. it changes 15 files, one of them a test, adding 35 lines and removing 14. the four diffs are identical apart from line numbers (the 4.0 backport, committed by Takashi Kokubun, carries a "merge revision" message instead); the excerpts below are copied from the one on master.

the fix is one line, repeated in 14 encoding files. each `case_map()` loop used to run while one byte of output room remained (`to < to_end`). it now runs only while two remain (`to_end - to > 1`), so the two-byte expansion of ß can no longer write past the buffer.

the commit also adds a regression test that builds strings of 1 to 64 ß in each of the 14 encodings and checks `upcase`, `downcase(:fold)`, `swapcase`, `capitalize` and `casecmp?`. a separate commit in the same releases, `bdff3c5d66dd` ("Check the lengths in rb_str_casemap"), fixes the sibling integer overflow GHSA-87fm-7w84-j2px.

### enc/iso_8859_1.c (CVE-2026-132825, +1 -1)

the whole change to this file: the loop guard now requires two free output bytes, not one. the same line changed the same way in the other 13 encoding files: `enc/iso_8859_2.c`, `iso_8859_3.c`, `iso_8859_4.c`, `iso_8859_9.c`, `iso_8859_10.c`, `iso_8859_13.c`, `iso_8859_14.c`, `iso_8859_15.c`, `iso_8859_16.c`, `windows_1250.c`, `windows_1252.c`, `windows_1254.c` and `windows_1257.c`.

```diff
@@ -265,7 +265,7 @@ case_map(OnigCaseFoldType* flagP, const OnigUChar** pp,
   OnigUChar *to_start = to;
   OnigCaseFoldType flags = *flagP;
 
-  while (*pp < end && to < to_end) {
+  while (*pp < end && to_end - to > 1) {
     code = *(*pp)++;
     if (code == SHARP_s) {
       if (flags & ONIGENC_CASE_UPCASE) {
```

### test/ruby/enc/test_case_mapping.rb (CVE-2026-132825, +21 -0)

the new regression test names the 14 affected encodings and runs every length from 1 to 64 ß through each case-changing method. this list, not the advisory, is the primary source for which encodings are affected.

```diff
@@ -240,6 +240,27 @@ def test_shift_jis_downcase_ascii
     assert_equal s, s.downcase(:ascii)
   end
 
+  SHARP_S_SINGLE_BYTE_ENCODINGS = %w[
+    ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-9 ISO-8859-10
+    ISO-8859-13 ISO-8859-14 ISO-8859-15 ISO-8859-16
+    Windows-1250 Windows-1252 Windows-1254 Windows-1257
+  ]
+
+  def test_single_byte_sharp_s_expansion
+    SHARP_S_SINGLE_BYTE_ENCODINGS.each do |name|
+      enc = Encoding.find(name)
+      (1..64).each do |n|
+        s = ("\xDF".b * n).force_encoding(enc)
+        assert_equal "SS" * n, s.upcase, "#{name} upcase #{n}"
+        assert_equal "ss" * n, s.downcase(:fold), "#{name} fold #{n}"
+        assert_equal "SS" * n, s.swapcase, "#{name} swapcase #{n}"
+        assert_equal ("Ss" + "\xDF".b * (n - 1)).force_encoding(enc), s.capitalize, "#{name} capitalize #{n}"
+        assert_equal "SS" * n, ("a".b + "\xDF".b * n).force_encoding(enc).upcase[1..], "#{name} upcase a+#{n}"
+        assert_equal true, s.casecmp?(("ss" * n).force_encoding(enc)), "#{name} casecmp? #{n}"
+      end
+    end
+  end
+
   def test_shift_jis_upcase_ascii
     s = ("a".."z").map {|c| "\x89#{c}"}.join("").force_encoding("Shift_JIS")
     assert_equal s, s.upcase(:ascii)
```

## how do I detect Ruby2Shell attempts?

there is no reliable request signature and no safe active probe. the overflow is silent, so the dependable signal is the ruby version each running process has loaded. the request indicators below are leads, and each has a stated blind spot.

- (request) a `multipart/form-data` POST with a part named `_method` whose own `Content-Type` declares a legacy charset such as `ISO-8859-1` or `Windows-1252`. the form field and the declared charset are the things to look for. the bytes travel raw inside the multipart body, and 21 ß is a short run of otherwise legitimate characters, so a signature is easy to evade. application code that changes the case of other fields does not use `_method` at all.
- (request) repeated `%DF` in a URL is a false lead. semgrep says a WAF rule hunting for it "is looking in the wrong place". query strings and JSON bodies are UTF-8 and HTTP headers arrive as binary strings, so none of them carries the bug.
- (log) nothing marks a successful write. on stock allocators the single out-of-bounds byte usually causes no crash and no log line, so a clean log proves nothing.
- (process) a running ruby whose loaded `libruby` reports 4.0.9, 3.4.12, 3.3.13 or older, or any 3.2 and below. a `(deleted)` mapping means the file was upgraded on disk and the process was not restarted.
- (process) an affected encoding module, `enc/iso_8859_*.so` or `enc/windows_125*.so`, loaded in a ruby process. it proves the process has handled a string in an affected encoding, not that it was attacked.

### public detection rules

| rule set | rules | source |
| --- | --- | --- |
| semgrep detection-scripts | CVE-2026-132825: read-only host scanner for Linux, macOS, Windows and Kubernetes. it reads the Ruby version each running process has loaded and cannot read application code | [semgrep](https://github.com/semgrep/detection-scripts/tree/main/CVE-2026-132825) |
| miggo WAF rule | no public rule id; also offered through AWS WAF partner managed rulesets | [miggo](https://www.miggo.io/post/ruby2shell-cve-2026-132825-ruby-regexp-string-vulnerabilities) |

## what can I do if I can't upgrade ruby yet?

ruby's advisory lists no workaround: upgrading is the fix. the stopgaps below come from other sources, and each closes one path and leaves others open.

| stopgap | closes | leaves open | source |
| --- | --- | --- | --- |
| remove the `Rack::MethodOverride` middleware (in rails, `config.middleware.delete Rack::MethodOverride`) | the default `_method` path in rails and classic-style sinatra | application code that calls `upcase` or `casecmp?` on a multipart parameter, the rodauth sign-up path, and the six sibling bugs. semgrep says of its own stopgaps that they "do not cover your own code or the six sibling bugs" | [semgrep](https://semgrep.dev/blog/2026/ruby2shell-cve-2026-132825/) |
| put software that bundles an unfixed ruby behind a VPN or an IP allowlist until the vendor ships a fix | reach to the service from outside the allowlist | anyone already inside it. the bug itself stays | [semgrep](https://semgrep.dev/blog/2026/ruby2shell-cve-2026-132825/) |
| turn on a WAF rule for the known request shape, such as the one miggo ships (also through its AWS WAF partner managed rulesets) | by miggo's account, "the main primitive responsible for RCE" | application-code paths and triggers outside the `_method` field. miggo does not say what its rule misses. [ethiack](https://ethiack.com/info-hub/research/cve-2026-132825-ruby2shell-rce-via-heap-overflow-in-ruby-string-case-conversion) does: "WAF rules may not be enough here. The trigger is a short run of otherwise legitimate characters." | [miggo](https://www.miggo.io/post/ruby2shell-cve-2026-132825-ruby-regexp-string-vulnerabilities) |

## Ruby2Shell questions

### which ruby versions are affected by Ruby2Shell, and which fix it?

ruby 4.0.0 through 4.0.9, 3.4.0 through 3.4.12, and 3.3.13 and every earlier release back to 2.4.0 are affected. ruby 4.0.10, 3.4.13 and 3.3.14 fix it, per [ruby's advisory](https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/). ruby 3.2 and older are end of life and, in the advisory's words, "will not receive these fixes": use a distribution backport such as debian 12's `ruby3.1` `3.1.7+really3.1.2-0+deb12u1`, or move to 3.3 or later.

### how severe is Ruby2Shell?

the scorers disagree: critical by ruby's maintainers, 7.4 (high) on the CVE record, 9.8 (critical) from red hat. [ruby's advisory](https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5) gives the rating with no CVSS score. MITRE's 7.4 on the [CVE record](https://www.cve.org/CVERecord?id=CVE-2026-132825) assumes a local attack vector and high complexity; red hat's 9.8 assumes a network vector and low complexity. the disagreement is whether the pre-authentication path through rails counts as network reach. the fix is the same either way.

### is Ruby2Shell being exploited, and is there a public exploit?

no to both, as of 23 november 2026: no exploitation in the wild is reported, the CVE is not in [CISA's KEV catalog](https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2026-132825), and no exploit is public. private proofs of concept exist, by the account of ruby's maintainers. [veria labs](https://verialabs.com/ruby2shell/) says it will publish one on 25 november 2026, "or later if major vendors have not shipped a fix by then".

### can Ruby2Shell really give an attacker remote code execution?

it is disputed, and nothing public settles it as of 23 november 2026. ruby's maintainers say proofs of concept reach RCE "in some scenarios", [durendal.sh](https://durendal.sh/blog/ruby-case-mapping-bugs) reports a private pre-authentication RCE against a plain `rails new` app, and veria labs says it was the first to demonstrate RCE. watchTowr told [securityweek](https://www.securityweek.com/ruby-patches-ruby2shell-vulnerability-that-could-lead-to-rce/) the likely result in production is denial of service, miggo reports reproducing a denial of service, and [ox](https://www.ox.security/blog/ruby2shell-ruby-memory-corruption-flaws-expose-applications-to-remote-code-execution-but-is-it-an-actual-risk/) calls the bug "more marketing than actual risk".

### is my rails app exposed to Ruby2Shell if my code never calls upcase?

yes, if it is a full-stack rails app or a classic-style sinatra app on an affected ruby. the `Rack::MethodOverride` middleware calls `upcase` on the `_method` form field before routing, CSRF checks and authentication, and a multipart form part can declare its own charset, so the client picks the encoding ([semgrep](https://semgrep.dev/blog/2026/ruby2shell-cve-2026-132825/), [durendal.sh](https://durendal.sh/blog/ruby-case-mapping-bugs)). rails with `config.api_only = true` does not mount that middleware, but any `upcase` or `casecmp?` on a multipart text parameter in your own code is reachable the same way.

### does bundle update or a dependency scanner catch Ruby2Shell?

no. the bug is in the ruby interpreter, not in a gem, so `Gemfile.lock` does not change and `bundle update` fixes nothing. scanners keyed on gems stay quiet, and ones keyed on CVE ids miss the six sibling bugs, which have only GHSA ids ([semgrep](https://semgrep.dev/blog/2026/ruby2shell-cve-2026-132825/)). upgrade the interpreter.

### how do I know if I am patched for Ruby2Shell?

read the version of the ruby inside the running process: 4.0.10, 3.4.13 or 3.3.14, or later on the same branch, is fixed. on debian, ubuntu, RHEL and SUSE compare the package version with the distribution's advisory, because a backport keeps the old version number. restart every app server and worker, since a process that started before the upgrade runs the old code. no probe can confirm it: a fixed and an unfixed ruby return identical results for the triggering input ([semgrep](https://semgrep.dev/blog/2026/ruby2shell-cve-2026-132825/)).

### is gitlab, github enterprise server or mastodon fixed for Ruby2Shell?

yes, each in its own release as far as we can tell, and updating the system ruby does nothing for a bundled one. gitlab is fixed in 19.6.1, 19.5.8 and 19.4.10, mastodon in 4.7.6, 4.6.12, 4.5.22 and 4.4.29, chatwoot in 4.20.1, and discourse once a forum is rebuilt on base image 2.0.20261119-0203. github enterprise server 3.22.6, 3.21.11, 3.20.13 and 3.19.17 carry [github's fix](https://docs.github.com/en/enterprise-server@3.22/admin/release-notes), an updated ruby or, where that "was not immediately possible", application-level mitigations; its release notes do not name CVE-2026-132825. openproject 17.9.8 and 17.8.3 move to ruby 4.0.10, and the 17.9.8 release notes name CVE-2026-132825. [veria labs' table](https://verialabs.com/ruby2shell/), last updated 21 november 2026, lists github enterprise server as unfixed; github's release of 22 november is newer.

### can a WAF or a network rule block Ruby2Shell?

partly. the one public request shape is a multipart form part named `_method` that declares a legacy charset, and a rule at a WAF, at a proxy or on the host could match that in traffic it sees in cleartext. it cannot cover application code that changes the case of other fields, and [ethiack](https://ethiack.com/info-hub/research/cve-2026-132825-ruby2shell-rce-via-heap-overflow-in-ruby-string-case-conversion) warns: "WAF rules may not be enough here. The trigger is a short run of otherwise legitimate characters." a rule that looks for `%DF` in the URL misses, because the bytes travel raw in the body. keep a rule on if you have one, and upgrade anyway.

### what are the other six bugs in the same ruby advisory?

six more memory-safety bugs, tracked by GHSA id only as of 23 november 2026. one is an integer overflow in string case conversion that needs a converted result over 4 GiB (GHSA-87fm-7w84-j2px). three are in regular expression compilation: a double free (GHSA-7x2q-68qv-6p8x), a heap overflow (GHSA-3p8q-wmhx-vm2w) and a heap overflow in `Regexp#to_s` (GHSA-7whj-cfh7-xgm4). two are out-of-bounds reads in case-insensitive matching (GHSA-wpqw-5qxg-m68r, GHSA-pvgc-g7gj-pv6h). the same upgrade to 4.0.10, 3.4.13 or 3.3.14 fixes all seven, per [ruby's advisory](https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/).

## sources

- [ruby: security advisories: multiple vulnerabilities in Regexp and String case conversion](https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/): the seven bugs, affected and fixed versions, credits
- [ruby security advisory: heap buffer overflow in case conversion of strings](https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5): GHSA-34m4-m9fh-gqp5: critical rating, CWE-193
- [ruby/ruby: Fix a heap buffer overflow in case mapping of the sharp s](https://github.com/ruby/ruby/commit/d582f8f13d700d8e39714d3a8f11eb4bd2bc69f0): the fix, master branch
- [ruby maintenance branches](https://www.ruby-lang.org/en/downloads/branches/): support status of each branch
- [CVE record: CVE-2026-132825](https://www.cve.org/CVERecord?id=CVE-2026-132825): MITRE as CNA: CVSS 7.4, local vector, CWE-122
- [CISA known exploited vulnerabilities catalog](https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2026-132825): not listed as of catalog 2026.11.25
- [NVD: CVE-2026-132825](https://nvd.nist.gov/vuln/detail/CVE-2026-132825): repeats MITRE's 7.4; not yet analysed
- [veria labs: Ruby2Shell](https://verialabs.com/ruby2shell/): origin of the name, proof-of-concept date
- [durendal.sh: yet another ẞug](https://durendal.sh/blog/ruby-case-mapping-bugs): root cause, the rack path, exploitation timeline
- [semgrep: Ruby2Shell: twenty is fine, twenty-one is a heap overflow](https://semgrep.dev/blog/2026/ruby2shell-cve-2026-132825/): which methods and encodings reach it, no-probe finding
- [semgrep: detection-scripts](https://github.com/semgrep/detection-scripts/tree/main/CVE-2026-132825): read-only host scanner
- [evenomn: CVE-2026-132825](https://github.com/evenomn/CVE-2026-132825): independent local reproduction, glibc finding
- [securityweek: ruby patches Ruby2Shell vulnerability that could lead to RCE](https://www.securityweek.com/ruby-patches-ruby2shell-vulnerability-that-could-lead-to-rce/): watchTowr's exploitability read, 20 nov 2026
- [watchTowr: ruby CVE-2026-132825 FAQ](https://watchtowr.com/intelligence/ruby-cve-2026-132825-faq/): no exploitation as of 19 nov 2026
- [miggo: Ruby2Shell](https://www.miggo.io/post/ruby2shell-cve-2026-132825-ruby-regexp-string-vulnerabilities): WAF rule, denial-of-service reproduction
- [ethiack: CVE-2026-132825](https://ethiack.com/info-hub/research/cve-2026-132825-ruby2shell-rce-via-heap-overflow-in-ruby-string-case-conversion): limits of WAF rules
- [ox: Ruby2Shell, but is it an actual risk?](https://www.ox.security/blog/ruby2shell-ruby-memory-corruption-flaws-expose-applications-to-remote-code-execution-but-is-it-an-actual-risk/): the dissent on severity
- [gitlab: critical patch release 19.6.1, 19.5.8, 19.4.10](https://docs.gitlab.com/releases/patches/patch-release-gitlab-19-6-1-released/): bundled ruby update
- [github enterprise server 3.22 release notes](https://docs.github.com/en/enterprise-server@3.22/admin/release-notes): 3.22.6, 22 nov 2026
- [mastodon v4.7.6](https://github.com/mastodon/mastodon/releases/tag/v4.7.6): ruby update in the release
- [openproject 17.9.8 release notes](https://www.openproject.org/docs/release-notes/17-9-8/): moves to ruby 4.0.10, names the CVE
- [chatwoot v4.20.1](https://github.com/chatwoot/chatwoot/releases/tag/v4.20.1): moves to ruby 3.4.13
- [debian security tracker](https://security-tracker.debian.org/tracker/CVE-2026-132825): package versions, DSA-6644-1, DLA-4926
- [ubuntu: CVE-2026-132825](https://ubuntu.com/security/CVE-2026-132825): needs evaluation as of 25 nov 2026
- [red hat bugzilla 2576211](https://bugzilla.redhat.com/show_bug.cgi?id=2576211): red hat's entry for the CVE
- [red hat: CVE-2026-132825](https://access.redhat.com/security/cve/CVE-2026-132825): RHEL 8, 9 and 10 errata of 24 nov 2026; RHEL 7 not affected
- [alpine packages: ruby](https://pkgs.alpinelinux.org/package/v3.24/main/x86_64/ruby): 3.4.13-r0; edge has 4.0.10-r0

## changelog and credits

- 2026-11-25: page published. facts checked against ruby's advisories, the fix commit on all four branches, the CVE record, NVD, CISA KEV catalog 2026.11.25, the debian, ubuntu, red hat and alpine trackers, and each vendor's release notes.

ruby's advisory credits the report in these words: "Thanks to Stephan Lipp (Ada Logics) and Anthropic for reporting this issue." the fix was written by `Yusuke Endoh`, with a `Claude Mythos 5.1` co-author trailer, and the backports were committed by `Hiroshi SHIBATA` (3.3), `nagachika` (3.4) and `Takashi Kokubun` (4.0). two other parties claim independent discovery, and the advisory credits neither: veria labs, which named the bug and says it "found this vulnerability independently and was the first to demonstrate remote code execution", and Moritz Sanft, working with openai.

this page is maintained by yeet, which makes the yeet programmable firewall. we are not affiliated with ruby or with the researchers. [tell us](https://yeet.cx/contact) if something here is wrong.
