Ruby2Shell Flaw Hits Rails Apps: Update Ruby Now
Ruby2Shell (CVE-2026-132825) is a Ruby heap overflow reachable pre-login in default Rails apps. Fixed versions, GitLab update, and how to check.
If anything you run is built on Ruby, from a Rails app to a self-hosted GitLab, Mastodon or Discourse box, it needs a Ruby update this weekend. On November 19 the Ruby team put out fixes for seven memory bugs. The worst one now has a name, Ruby2Shell, and a CVE number, CVE-2026-132825. Researchers say it can be reached in a default Rails app before anyone logs in.
What happened
The official Ruby advisory covers five regex-engine bugs and two in string case conversion, and says the maintainers know of proof-of-concept code that turns some of them into remote code execution. Ruby2Shell is GHSA-34m4-m9fh-gqp5, which Ruby rates Critical. It's an off-by-one heap overflow. When Ruby changes the case of a string stored in an old single-byte encoding like ISO-8859-1 or Windows-1252, it can write one byte past the end of its buffer.
Veria Labs, who gave the bug its name, traced it to the German sharp s. In these encodings "ß" has no single capital letter, so uppercasing it produces "SS". That's two bytes, but the loop only checks room for one. Feed Ruby enough of them and the extra byte spills over. The methods involved are upcase, swapcase, downcase(:fold) and casecmp?. UTF-8 strings take a different path and aren't affected.
The scary part is how a request gets there. HTML forms can only send GET and POST, so Rack, the layer under Rails and Sinatra, reads a hidden _method field to fake PUT or DELETE, and it uppercases that value. Cloudflare's write-up explains that a crafted multipart POST can declare a legacy charset for that field. The upcase happens during routing, before any login check. Veria lists Rails and classic-style Sinatra as exposed by default. Other frameworks and plain Rack aren't, unless your own code upcases outside text in a legacy encoding.
| You run | Affected | Update to |
|---|---|---|
| Ruby 4.0 | 4.0.0 to 4.0.9 | 4.0.10 |
| Ruby 3.4 | 3.4.0 to 3.4.12 | 3.4.13 |
| Ruby 3.3 | 3.3.13 and earlier | 3.3.14 |
| Ruby 3.2 and older | Yes (end of life) | Move to a supported series |
| GitLab CE/EE (self-managed) | Before 19.4.10, 19.5.8, 19.6.1 | 19.6.1, 19.5.8 or 19.4.10 |
| Mastodon | 4.7.5 and earlier | 4.7.6 (or 4.6.12, 4.5.22, 4.4.29) |
| Discourse (Docker) | Base image before 2.0.20261119-0203 | Rebuild the container |
| GitHub Enterprise Server | 3.22.5 and earlier | No fix listed yet |
Product rows come from Veria's tracker as of November 21, which also lists fixed Chatwoot (4.20.1) and OpenProject (17.9.8 and 17.8.3) releases. GitLab's critical patch release on November 20 bundles Ruby 3.3.14 and 3.4.13 and says GitLab.com is already patched. Ubuntu shipped USN-9176-1 for 22.04 through 26.10, and Debian has fixed packages for bookworm and trixie. Distro packages keep their old version numbers with the fix backported, so compare the full package version, not just ruby -v. I first saw the GitLab update in a post from @TheHackersNews.
Why it matters
Pre-auth bugs in a default framework setup are about as bad as web bugs get. And Veria plans to publish a working Rails exploit on November 25, or later if major vendors still haven't shipped fixes. Once that's out, scanners will follow fast. On the other hand, the CVE record scores it 7.4, not 9-plus, and watchTowr told SecurityWeek that a reliable real-world exploit is hard: heap layout, allocator choice and ASLR all get in the way. Their bet is that crashed workers and downtime are the likelier result.
What to do
- Find every Ruby. Run
ruby -von the host, thenbundle exec ruby -vinside each app folder, since rbenv, asdf or a.ruby-versionfile can point at a different build. On Debian or Ubuntu,apt list --installed 'ruby*'shows the package version. - Check your images.
docker run --rm your-image ruby -vtells you what a container really ships. BumpFROM ruby:3.xtags to a fixed patch release and rebuild instead of trusting the cached layer. - Restart everything. A Ruby running in memory stays vulnerable until it restarts. That means Puma or Unicorn, Sidekiq workers, cron jobs and long-running consoles.
- Update bundled apps. Self-managed GitLab goes to 19.6.1, 19.5.8 or 19.4.10. Mastodon gets its new point release, and Discourse gets a
./launcher rebuild app. Self-compiled GitLab has to rebuild its own Ruby on 3.3.14 or 3.4.13. - Use a WAF as a stopgap. Cloudflare added block rules to its Free and paid managed rulesets. Cloudflare itself calls this a compensating control, though. It can't see traffic that hits your origin IP directly or strings arriving from email, imports or job queues.
My take
Who should actually lose sleep? Anyone with a public Rails or Sinatra app, and anyone running GitLab, Mastodon, Discourse or a similar Ruby app at home or for a small team. If Ruby is only on your laptop for a static site generator or a CocoaPods install, there's no web request reaching it, so update when it's convenient, not tonight.
The step I see people skip most is the restart. Patching the package and walking away leaves the old interpreter running in every worker until the next reboot, and on a home server that can mean weeks. After you update, I'd also run bundle exec ruby -v from the app itself. A version manager can quietly keep an app on an old build even after the system Ruby is fixed. For Docker setups, rebuild without the cache once.
GitLab owners have it easy this time, because the omnibus package and official images already carry the patched Ruby. If you're stuck on GitHub Enterprise Server, keep it off the open internet until GitHub ships something, and put the Cloudflare rule or your own WAF in front as a temporary shield.
It's also not the first Ruby scare this autumn. Last month I covered Ruby's regex bugs behind GitLab RCE flaws, and this week brought the NGINX2Root bugs. If you self-host, a short list of every runtime you expose pays off on weeks like this. My APT check-and-patch guide walks through a quick Linux patch routine. For desktop worries, my PC malware check guide is the place to start.
Comments ()