twimco.Let’s talk ↗︎
Menu
Field notes / Product & engineering

Ruby fixed seven memory bugs tonight, some proven to run code. Upgrade your Rails app, then prove it's live

If your Rails app turns a search term, an import file or a pasted rule into a regex, Ruby's new security releases are for you. Upgrading takes minutes. Making sure every running process actually picked up the new Ruby is where it slips.

Editorial illustration of two developers at a workbench in the evening, one using tweezers to lift a small red gemstone from an open wooden case while the other inspects a fresh one under a desk lamp, beside an open laptop, a checklist on a clipboard, a blank tag and a jeweler's loupe.

Upgrade to Ruby 4.0.10, 3.4.13 or 3.3.14 now, freeze or not. The November 18, 2026 releases fix seven memory bugs in Ruby's regex engine and string case conversion, and Ruby knows of proof-of-concept code that turns some into remote code execution. Apps that build regexes from user input are most exposed. Change the version in .ruby-version, the Gemfile and lockfile, the Dockerfile and CI, restart every Ruby process, then check what's running. Ruby 3.2 and older get no fix.

Seven bugs, three releases, one evening

If your product is built on Rails, it runs on Ruby, and Ruby had a busy Wednesday evening.

At 7 PM Eastern on November 18, the Ruby core team published a security advisory and three releases to go with it: Ruby 4.0.10, 3.4.13 and 3.3.14. They fix seven memory bugs in two places almost every app touches: Ruby's regular expression engine, and changing the case of a string with upcase, downcase and friends. Ruby says it knows of proof-of-concept code showing that some of them can be used to run code on the server. Going by the individual advisories, that's five of the seven, and three are rated critical.

A few more things worth knowing tonight:

  • Ruby hasn't published that code, and no attacks have been reported. SecurityOnline says no exploitation in the wild has been confirmed.
  • There are no CVE numbers yet. Until they're assigned, each bug only has a GitHub advisory ID (GHSA-...), and Ruby Central warns that a scanner tracking CVE numbers may not flag them yet. A clean scan tomorrow doesn't mean you're fine.
  • This is the second round in a month. On October 23, Ruby 4.0.9, 3.4.12 and 3.3.13 fixed regex engine bugs that GitLab found could run code on its servers. If you skipped that one, tonight's release covers both.
  • Four of the seven are credited to Stephan Lipp of Ada Logics and Anthropic. It's the second serious fix tonight after NGINX. Expect more weeks like this one.

Black Friday is November 27. If you're in a code freeze, this belongs on the same short list as tonight's WordPress security release: changes the freeze should still let through. It's a patch release in the series you already run, so the change is small. The part we'd watch is the last step: making sure the Ruby your app is actually running is the new one.

Sequence of work

How the fix reached the tools, November 18

  1. 7:00 PM

    Ruby publishes the advisory and releases 4.0.10, 3.4.13 and 3.3.14.

  2. 7:16 PM

    ruby-build 20261119 and ruby/setup-ruby v1.342.0 add all three versions.

  3. 7:49 PM

    Official Docker images for Ruby 4.0.10 are published.

  4. About 9:00 PM

    Official Docker images for 3.4.13 and 3.3.14 follow, and the 3.4 and 3.3 tags move to them.

  5. By 10:40 PM

    Heroku lists all three versions. Render's docs still show 3.4.12 as the default for new services.

Times are Eastern, from the ruby-lang.org advisory, GitHub release pages and Docker Hub tag timestamps, checked about 10:40 PM ET. Not client data.

Is your app actually exposed? Three questions

Everyone on an affected version should upgrade. But it helps to know whether a stranger could reach these bugs through your app tonight. Ask three questions.

1. Does any code build a regular expression from text someone outside could influence? That's where four of the seven bugs live. Ruby's October advisory spells out the shapes to look for: Regexp.new, Regexp.union or Regexp.compile on input, or input interpolated into a pattern like /#{input}/. In a Rails app, that tends to hide in search filters with "advanced" syntax, admin screens where staff type match rules, validation settings stored in the database, and import tools that map columns by pattern. A rough first pass:

```
git grep -nE 'Regexp\.(new|union|compile)|%r\{.#\{|/[^/ ]#\{' -- '*.rb'
```

It's noisy. Read each hit and ask where the string came from. And don't count on guards: Ruby said in October that Regexp.timeout didn't protect against those bugs, and limiting pattern length didn't reliably help either.

2. Do you change the case of text from outside, in an older encoding? Two of the bugs are in case conversion, and they don't need a crafted regex at all. One applies to strings in single-byte encodings like ISO-8859-1 and Windows-1252. The other needs a converted result bigger than 4 GiB, which is unusual in a web request. Most Rails strings are UTF-8, so look for the places where they aren't: force_encoding, encode("ISO-8859-1") or "Windows-1252", CSV imports with an encoding: option, and anything that parses email. Ruby Central calls out legacy-encoded email and imported files as the cases where an ordinary downcase could be the trigger.

3. Do you match outside text against a case-insensitive pattern with a backreference? The seventh bug can be reached through a pattern your own developers wrote, something like /(\w+) \1/i, matched against a crafted string. The advisory says it can leak memory contents or crash the process, not run code.

If all three answers are no, your risk tonight is lower, not zero. Your gems do their own regex and string work, and you didn't grep them. As Ruby Central notes, there's no workaround. Upgrading is the fix.

A phased restart swaps the workers. It doesn't swap the Ruby they're forked from.

Change the version everywhere it's written down

Ruby's version is written down in four or five places, and each tool reads a different one. Miss one and you get a build that installs the old Ruby while the files you changed say the new one.

  • .ruby-version. rbenv reads it, and so does GitHub's ruby/setup-ruby action unless your workflow names a version. Set it to 4.0.10, 3.4.13 or 3.3.14, whichever series you're on.
  • The ruby line in your Gemfile. Either the exact version, or ruby file: ".ruby-version" so the two can't drift apart.
  • The RUBY VERSION block in Gemfile.lock. Run bundle update --ruby to refresh it. This one matters more than it looks. Heroku installs whatever Ruby the lockfile names, and Render checks the lockfile before .ruby-version.
  • Your Dockerfile's FROM line. Pin the full version, like ruby:3.4.13-slim. If you use a floating tag like ruby:3.4, it now points at the fixed build, but only a rebuild with docker build --pull is guaranteed to fetch it instead of reusing a cached base image.
  • CI. If your workflow names a Ruby version directly instead of reading .ruby-version, change it there too, or your tests keep passing on the old Ruby.

The tools caught up fast (see the timeline above). By about 10:40 PM Eastern, ruby-build, Homebrew, ruby/setup-ruby, the official Docker images and Heroku all had the new versions, and Heroku's default for new apps is now 3.4.13. Render's docs still list 3.4.12, an affected version, as the default for new services. If you're on Render and haven't set a version, set one, then check the build log for the version it actually installed.

If your Ruby comes from your Linux distribution's packages, you're waiting on them. Ruby Central's advice is to watch for the updated package, then rebuild and redeploy.

It's about as safe as upgrades get, but still run the suite and go through a staging copy you trust first.

Restart everything that runs Ruby

A deploy that only replaces the web server isn't done. Every long-running process loaded Ruby when it started, and it keeps that Ruby until it stops.

Make a list: the web server (usually Puma), background workers (Sidekiq, Good Job, Solid Queue), schedulers, and anything long-running someone started by hand. Containers need the new image and fresh containers. On a server you manage yourself, each of those processes needs a real stop and start.

One trap to know about. A Puma phased restart, the gentle one that replaces workers one by one, doesn't help here. Puma's own docs say the master process isn't restarted, and every worker is forked from that master. So every new worker starts on the same old Ruby. For a new Ruby, do a full restart or roll out new containers, and expect a short blip.

How the work moves

From version bump to proof

  1. Check exposure

    Regexes built from input, case changes on legacy-encoded text, case-insensitive backreferences.

  2. Bump every file

    .ruby-version, Gemfile, Gemfile.lock (bundle update --ruby), Dockerfile FROM, CI.

  3. Build and test

    Rebuild with --pull, run the suite, deploy to staging first if it really matches production.

  4. Full restart

    Web, workers and schedulers. Not a phased restart.

  5. Prove and log

    A 'patched' boot line from every process type, written into the freeze log.

Illustrative workflow for one Rails app; not a client screenshot or measured result.

Then prove the running process is patched

The files say 3.4.13, CI is green, the deploy finished, and it's tempting to stop there. What you actually want to know is which Ruby your live processes are running.

The quick check is what's installed where the app runs: docker exec <container> ruby -v, kubectl exec <pod> -- ruby -v, or heroku run ruby -v. That tells you what a new process would start with. It doesn't tell you what the processes already running loaded.

The check that counts is asking the app itself. Add a small initializer so every process writes its own Ruby version to the log as it boots:

```ruby

config/initializers/ruby_version_check.rb

fixed = { "4.0" => "4.0.10", "3.4" => "3.4.13", "3.3" => "3.3.14" }
need = fixed[RUBY_VERSION[/\A\d+\.\d+/]]
ok = need && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new(need)
Rails.logger.info("[ruby] #{RUBY_DESCRIPTION} pid=#{Process.pid} #{ok ? 'patched' : 'NOT PATCHED'}")
```

After the deploy, search your logs for [ruby]. You want a "patched" line from every process type on your list: web, each worker, the scheduler. A process that never wrote the line was never restarted. On Ruby 3.2 or older it will say NOT PATCHED, which is the truth.

On a server you run yourself, ls -l /proc/<pid>/exe for the Puma master shows the Ruby binary it's running. With rbenv the path includes the version, so versions/3.4.12/bin/ruby tells you everything.

Then write it down. One line per app in the freeze log: old version, new version, when, who checked, which processes were confirmed.

It's the same "updated isn't the same as running" lesson as tonight's NGINX note and yesterday's Java4Shell note. Language runtimes are having a rough season. PHP2Shell was last month.

If you're stuck on Ruby 3.2 or older

Ruby 3.2 reached end of life on April 1, 2026, according to Ruby's maintenance branches page, and everything older went before it. None of them get these fixes, and Ruby Central lists them among the affected versions.

The shortest way back to a supported Ruby is 3.3.14, but 3.3's support is scheduled to end in March 2027, so 3.4 is the better stop if you have room to test it. Either way it's a bigger jump than a patch release, and doing it during a Black Friday freeze is a real risk of its own.

If the upgrade has to wait until after the holidays, shrink your exposure in the meantime. None of this is a fix:

  • Stop compiling regexes from untrusted input. That's what Ruby itself told people who couldn't upgrade in October. If a search feature needs user input inside a pattern, pass it through Regexp.escape so it's matched as plain text, as SecurityOnline also suggests.
  • Find your single-byte-encoding case conversions from question 2 and decide whether those paths need to run on untrusted input this month.
  • Put a date on the upgrade, right after the freeze, and treat it as decided.

The case-conversion bugs have no workaround, so on 3.2 you're accepting some risk until you move. Say that out loud to whoever owns the decision, and write it down.

If you'd rather someone else did this tonight

None of this is hard. It just lands in the busiest week of the year, it touches build files nobody has opened since the last upgrade, and the step that matters most is easy to skip once the deploy says done.

We build and maintain Caribbean Boat Concierge, a boat rental marketplace that runs on Ruby on Rails, so keeping the Ruby under an app current is ordinary work for us. If your product runs on Rails, or you're not sure which Ruby it's on, that's the kind of production work our web application team does: keeping the systems around your software current and checked, not only the code. Tell us what you're running and we'll help you check your exposure, upgrade, and prove it before Black Friday.

Related work: Paddle8.

twimco.

We build alongside the people doing the work.
Bring us the problem you’re thinking about.

Related work

Paddle8 ↗︎