Talk to us

Blog · 19 November 2026 · Rob Sherwood

Ruby2Shell: If Your App Runs on Rails, Update Ruby Now

If you've got a Ruby on Rails app, or a Sinatra one, there's a Ruby update you want on this week's list. On 18 November the Ruby team released Ruby 4.0.10, 3.4.13 and 3.3.14 to fix seven security bugs in Ruby's string and regular expression code. One of them has already picked up a name, Ruby2Shell, from the researchers at Veria Labs who wrote it up.

This is the third "something2Shell" in a few weeks, after PHP2Shell and Java4Shell. Different language, same lesson: the runtime under your app needs looking after just as much as the app itself.

What the bug actually is

Ruby's advisory describes it as a one-byte heap overflow in the case conversion of strings. In plain English: when Ruby turns text into upper or lower case, a carefully crafted string can make it write one byte past the end of the memory it was given. One byte doesn't sound like much. In the wrong place, it's enough. The advisory's own words are that it "may allow remote code execution".

Veria's write-up gives more detail. The fault sits in the handling of older single-byte encodings, several of the ISO-8859 and Windows-125x families, and it's reached through everyday methods like upcase, swapcase, downcase(:fold) and casecmp?. Veria says UTF-8 strings take a different code path and aren't affected. It also says the faulty loop has been in Ruby since 2.4.0, which came out years ago.

The part that matters for most people is this. Veria says the bug is reachable without logging in, in Rails and in classic-style Sinatra, in their default configuration. Plain Rack and other frameworks are "not exposed by default". So it isn't about whether your own code happens to call upcase on something odd. If it's a standard Rails app, assume it's exposed until it's updated.

No CVE number has been assigned yet. The Ruby advisory lists it as GHSA-34m4-m9fh-gqp5, and among the credits is Anthropic, which fits the pattern I wrote about in AI can now turn a security patch into an attack. More bugs are being found faster, and the gap between a fix and an exploit keeps shrinking.

How urgent is it?

Neither Ruby nor Veria says it's being used in attacks yet. But Ruby says it is "aware of PoCs" (proof of concept exploits) showing some of these bugs can lead to remote code execution. And Veria says it will publish its own proof of concept in a week, once people have had time to upgrade. That gives you a deadline. After that, anyone can have a go.

Which versions are affected

  • Ruby 4.0: 4.0.0 to 4.0.9. Fixed in 4.0.10.
  • Ruby 3.4: 3.4.0 to 3.4.12. Fixed in 3.4.13.
  • Ruby 3.3: 3.3.13 and earlier. Fixed in 3.3.14.
  • Ruby 3.2 and older: affected back to 2.4.0, according to Veria, and out of support. There's no upstream fix coming.

That last line is the awkward one. If your app is on Ruby 3.2 or older, the answer isn't a patch, it's an upgrade. On an older Rails app that's rarely a one-line change, because moving Ruby up tends to drag gem updates and sometimes a Rails upgrade along with it.

How to find out which Ruby your app really runs

Typing ruby -v on the server tells you about the Ruby on the path. That often isn't the one serving your app. A few places to look:

  • In the app itself: a .ruby-version file in the project, or a ruby line in the Gemfile, says what it was built for. From the app's folder, bundle exec ruby -v shows what it actually gets.
  • Version managers: rbenv, rvm, asdf and chruby all install their own Rubies under the user's home folder. Each one needs updating separately.
  • Running processes: ps aux | grep -E 'puma|unicorn|passenger|sidekiq' shows the real binaries in use. Don't forget background workers. They run the same Ruby and need the same restart.
  • Docker: check the FROM ruby: line in your Dockerfile. Pin it to a fixed version, rebuild and redeploy. An image built last month still has last month's Ruby in it.
  • Distribution packages: if your Ruby came from Ubuntu or Debian packages, the version number may look old even after it's patched, because distributions backport fixes. Check your distribution's security notices rather than the number.

And if you run self-hosted tools built on Ruby, the sort of thing that ships with its own bundled Ruby, Veria's advice is simple: install the vendor's fixed release when it arrives. Updating the system Ruby won't touch a bundled one.

What to do about it

Update Ruby to 4.0.10, 3.4.13 or 3.3.14, then restart everything that runs it: the web server, the job workers, any scheduled tasks. A Ruby process keeps running the old interpreter until it's restarted. Then run your tests, or at the very least click round the parts of the app that matter, before calling it done.

If you're on 3.2 or older, put a Ruby upgrade on the plan now rather than after the proof of concept goes public. Even a rough idea of what it'll take (which gems pin you, which Rails version you're on) is better than finding out in a hurry.

The real question: who would have noticed?

Rails apps tend to be the reliable ones. They get built, they work, and they run quietly for years while the developer who set them up moves on. That's exactly the sort of app where nobody is reading the Ruby security announcements, and where the Ruby version was last touched when the server was built.

If you'd like a second pair of eyes, our code audit (£250 + VAT) looks at one app along with its server and dependencies, including what it's running on and how far behind it is. If you'd rather someone just kept on top of it, Look after it (from £355 a month + VAT) covers keeping your app's runtime, frameworks and hosting up to date. And if it's the server underneath that worries you, I also do server health checks and monthly server retainers.

In the meantime, find out which Ruby your app is really on. It takes five minutes. If the answer is older than you'd like and you want a hand, get in touch.

Cheers, Rob

Tell us what you've got

It goes straight to Rob and Jase. You'll hear back from one of us, usually the same day, and we'll tell you honestly whether we're the right people.

Just want it checked? Code audit, £250 + VAT