I keep Ruby services in places I do not babysit daily, which is the category this week’s bug punishes. On 18 November the Ruby core team shipped 4.0.10, 3.4.13 and 3.3.14 with seven advisories covering memory-safety bugs in the regular expression engine and in string case conversion. The one with a name, ruby2ßhell, is a one-byte heap overflow in the code that upcases strings in legacy single-byte encodings.
One byte sounds like a curiosity. What makes it an evening is that it lives in the interpreter, so Gemfile.lock never changes, and the pre-authentication path runs through middleware most Rails apps mount without thinking: it upcases a form field before routing, before CSRF, before your first line of code.
🔤 One Letter, One Byte, Ten Years
German has a letter, ß, whose uppercase form is two characters: SS. Ruby’s case-conversion loop assumes one byte in, one byte out. The output buffer is the input length plus 20 bytes, and before each step the loop checks there is room for one more. When it meets a ß while upcasing, it writes S, falls through to the common write at the bottom of the loop, and writes a second S without checking again.
So twenty-one ß in means a 41-byte buffer. After twenty, 40 bytes are used and one is free, the check passes, and the second S lands past the end. The stray byte is not attacker-chosen: always S (0x53) upcasing, s (0x73) folding. What the attacker picks is where it lands, through the alignment of the ß characters, and how big the neighbouring buffer is, through the input length.
upcase, swapcase, downcase(:fold) and casecmp? reach it, plus their bang and Symbol forms. capitalize does not, and neither do plain downcase, casecmp or case-insensitive regex matching. Fourteen encodings are affected: ISO-8859-1, -2, -3, -4, -9, -10, -13, -14, -15 and -16, plus Windows-1250, -1252, -1254 and -1257. UTF-8 takes a different path, which is why almost no test suite exercises this.
The fix is commit d582f8f, 15 files, checking for two bytes of room instead of one. It carries Reported-by: Stephan Lipp of Ada Logics and a Co-Authored-By trailer for Claude Mythos 5.1; Ruby credits Lipp and Anthropic for four of the seven bugs. The start date fits: Ruby 2.4.0, released on 25 December 2016, is where the bug begins, in the release that replaced ASCII-only case mapping with Unicode.
🚪 The Door Is Rack::MethodOverride
Most apps never upcase a Latin-1 string, since modern Ruby is UTF-8 everywhere. So how is this pre-login in a default Rails app?
Because the framework does it for you. HTML forms only send GET and POST, so Rails forms that need PUT, PATCH or DELETE carry a hidden _method field, and a small piece of middleware normalizes it. The current Rack source is blunt: method = method_override_param(req) || env[HTTP_METHOD_OVERRIDE_HEADER], then method.to_s.upcase. That call is the bug. And each multipart part may declare its own character set, which Rack honors, so the string reaching upcase carries whatever encoding the client asked for.
Order is the rest of it. Rack::MethodOverride sits near the top of the stack, before routing, CSRF and authentication. Semgrep confirmed at runtime that the client’s encoding survives to that call on Rails 8.1 and 7.2, Sinatra 4.2 and 3.2, and Rack 3.2 and 2.2. Veria Labs, which named the flaw, still has not said which Rails path reaches it and plans to publish its proof of concept about a week after disclosure.
The matrix matters more than the description. Full-stack Rails is exposed. A config.api_only = true app is not, through that middleware, though its controllers still are, since multipart text parameters keep the client’s charset either way. Classic Sinatra is exposed, Sinatra::Base only if it enables method_override, plain Rack only if it mounts the middleware. Semgrep found a second path in Rodauth, which compares login against confirm at sign-up with casecmp?.
What cannot carry it is as useful. Headers are binary strings under Puma, Unicorn, WEBrick, Thin and Falcon; JSON bodies, query strings and ordinary URL-encoded forms are UTF-8. So a WAF rule hunting repeated %DF in a URL is looking in the wrong place, because these bytes travel raw inside a multipart body.
Your own code is the other half, mostly through what libraries hand you: HTTP client bodies tagged with the server’s charset=, Nokogiri output inheriting the document’s encoding, email parts re-tagged with the sender’s charset, database rows over a latin1 connection. Upcase one of those and the remote side decides whether it contains 21 ß. Semgrep’s audit of more than 140 gems found no default offender apart from Rodauth.
📦 The Interpreter Is the Dependency
bundle update does nothing here, and a scanner reading Gemfile.lock sees no difference between vulnerable and fixed. At disclosure none of the seven had a CVE, so CVE-keyed scanners saw nothing; one has since picked up CVE-2026-132825, so now they see one of seven.
Then there are the products that carry their own Ruby. In the 19 November snapshots from Veria Labs and Semgrep, GitLab 19.6.0 ships Ruby 3.3.13 and GitHub Enterprise Server 3.22.5 ships 4.0.9, with no fixed vendor release for either. Mastodon fixed it in 4.7.6, OpenProject in 17.9.8, and Discourse’s base image carries 4.0.10, though a forum is only fixed once it is rebuilt. Chatwoot 4.20.0 still bundles 3.4.4.
There is precedent. In October, GitLab patched the Ruby it ships for four of its own CVEs, and its notes said the fix was a patch to Ruby rather than to GitLab. A bundled version number is a starting point, not an answer.
Restarting is its own trap. A Puma phased restart reloads application code in new workers while the master keeps the old binary, so it does not apply an interpreter upgrade. Distributions backport fixes into version numbers that still look vulnerable, so the number is evidence in neither direction; on Ubuntu, every release I checked still needed evaluation in its 19 November update. Ruby 3.2 and older get nothing, and 3.3 has moved to legacy maintenance.
⚠️ What Is Claimed, What Is Proven, and the 25th
What is established: the primitive is proven. Semgrep reproduced an invalid write of size 1 at case_map (iso_8859_1.c:293) under valgrind on ruby:3.4.12, and the same input was clean on ruby:3.4.13. The middleware path is confirmed as far as delivery. The chain from that byte to a shell is the researchers’ claim, backed by Ruby’s wording that it is “aware of PoCs that prove this flaw can be used to trigger RCE in some scenarios,” and it is not public.
Two caveats. No exploitation has been reported, and Rescana found none of the seven in the KEV catalog on 19 November. OX Security framed its write-up around whether this is real risk or hype and recommended upgrading without treating it as an emergency. I do not share the calm: a one-byte write where the attacker picks the buffer size, and where the gap between a crash and execution is heap layout, is not something I want sitting for a week while somebody else publishes a working request.
The score is a mess in an instructive way. Ruby publishes no CVSS number and rates the bugs critical; the CVE record carries 7.4, high, which Semgrep reads as a score computed for a local attack. When a score and the maintainers disagree about whether the attacker needs to be in the room, believe the people who read the loop.
🛠️ What I Would Do This Week
Inventory what runs, not what is on your PATH. readlink -f /proc/<pid>/exe gives the binary behind a Puma, Unicorn or Sidekiq process, and running it with -v gives its version. GitLab keeps its own in /opt/gitlab/embedded/bin/ruby, which no package query will show you.
Then upgrade, restart, and verify by asking the running process what it loaded. Rebuild on fixed bases and update .ruby-version, Dockerfiles and CI images so the next deploy does not bring the old interpreter back. Install vendor releases where they exist.
Ruby published no workaround, so anything short of an upgrade is damage limitation with a known cost. Deleting Rack::MethodOverride (config.middleware.delete Rack::MethodOverride in Rails, disable :method_override in Sinatra) closes the middleware path and breaks every form that sends PUT, PATCH or DELETE through _method. Rejecting non-UTF-8 multipart charsets at the front of the stack works too, though in classic Sinatra middleware added with use runs too late. None of it covers your own code.
The six siblings are not filler. Three need the app to compile an attacker-supplied pattern, which is the Regexp.new(params[:q]) habit without Regexp.escape. For detection, look for worker crashes that line up with multipart POSTs from one source: [BUG] Segmentation fault or glibc aborts such as free(): invalid next size. A clean log proves nothing, because the overflow usually crashes nothing.
🧠 Final Thoughts
The interesting part of ruby2ßhell is not the off-by-one, and not really the ten years it sat there. It is that the way in runs through middleware that upcases a form field you have never typed, so the audit most teams will run, reading their own controllers for upcase, comes back clean and tells them nothing.
Know the order of your middleware stack, because the framework calls functions on request data before your code exists. And treat the interpreter as a dependency you inventory per process, not a language you happen to be running. Both are worth doing before the 25th.
Thanks for reading.