Skip to main content

Ruby 4.0.9

Release Date: October 23, 2026

Careful with the celebration

Ruby 4.0.9 shipped on October 23, 2026, and the headline is not a new feature. It is a regular expression fix. Three series moved at once, Ruby 4.0.9, 3.4.12, and 3.3.13, and all of them close memory corruption bugs in Onigmo, the regexp engine underneath Ruby. The bugs were found by GitLab and published as four CVEs after GitLab patched the Ruby it ships on its own servers.

Read the details before you assume this is routine. Some of these bugs allow remote code execution when an application compiles a regexp from a string an attacker controls. That is a narrower condition than it first sounds, but it is not an exotic one either.

What actually got fixed

  • CVE-2026-89078: a double free when parsing a pattern fails after an alternation. Ruby 4.0.0 already contained the fix, so the 4.0 series was never exposed.
  • CVE-2026-93577 and CVE-2026-97229: integer overflow in the size of a compiled pattern. Fixed in 4.0.8, and in the same 3.4.12 and 3.3.13 releases.
  • CVE-2026-110264: overflow of internal IDs in a pattern with many repeats. This is the one that lands in 4.0.9, and it is the reason 4.0.8 is not enough.

Ruby 4.0.9, 3.4.12, and 3.3.13 contain all of the fixes, which is why all three shipped together instead of the project patching only the newest line.

The caveats that matter

If your application only ever compiles regexps that your own developers wrote, you were never exposed to these bugs. That covers most Rails apps: routes, validations, and parsers are defined in code, not assembled from request parameters. The exposure window opens when a string from outside reaches Regexp.new, Regexp.union, or Regexp.compile, or when it gets interpolated into a regexp literal such as /#{input}/. Multi-tenant rules engines, log search features, user-defined filters, and CI-style tooling are the usual suspects.

Two pieces of advice do not work, and the release notes are blunt about it. Regexp.timeout is not a mitigation, because these bugs corrupt memory during compilation rather than causing a pathological backtracking run. Limiting pattern length is also unreliable, since some of the overflows can be triggered with short patterns. Anyone who planned to lean on either control should drop that plan and upgrade instead.

Upgrade notes

Patch releases in the 4.0 line have been frequent this year, which makes the upgrade low risk but also easy to postpone. Do not postpone this one. Move to 4.0.9 or later, and if you are still on 3.4 or 3.3, take 3.4.12 or 3.3.13 at the same time. Older series such as 3.2 received nothing, and those branches are out of support anyway.

Bundled distributions lag behind, so check whether your base image or platform package has picked up the patch before you assume a gem update solved the problem. Ruby is compiled into the interpreter, and no amount of application-level pinning substitutes for a rebuilt runtime. Verify with RUBY_VERSION inside the container rather than trusting the tag on the image.

Verdict

This is not a release to read for interesting new methods. It is a release that closes a memory safety hole in code that almost every Ruby process links against. Upgrade, confirm the interpreter version you actually run in production, and if you genuinely cannot move yet, stop compiling regexps from untrusted input until you can.

Other Versions

We use cookies for ads and analytics.