← Blog
Article

Ruby and Rails Vulnerabilities in 2026: KindaRails2Shell, CVEs and What to Patch

Ruby and Rails vulnerabilities in 2026: KindaRails2Shell (CVE-2026-66066), the Ruby regex CVEs, Rack and gem fixes, RubyGems incidents and versions to run.
13 min readSecurityRubyRuby on RailsSupply Chain

By Assim ElHammouti, Founder and Lead Engineer, NordbeamPublished Updated

Short answer

Which Ruby and Rails vulnerabilities matter right now?

The most serious Rails vulnerability of 2026 is CVE-2026-66066, known as KindaRails2Shell: an unauthenticated file read in Active Storage that can expose secret_key_base. Run Rails 8.1.3.1, 8.0.5.1 or 7.2.3.2 or later, and Ruby 4.0.9, 3.4.12 or 3.3.13, which fix four regex-engine CVEs. Compiled by Nordbeam, a development studio in Gothenburg and Malmö.

Rails, patch to
8.1.3.1 · 8.0.5.1 · 7.2.3.2
Ruby, patch to
4.0.9 · 3.4.12 · 3.3.13
Support ends soon
Rails 8.0 on 7 Nov 2026

Ruby's 2026 looks different from Node's or PHP's. There was no flood of core CVEs. Instead there was one critical Rails bug that shipped in the default configuration, a quiet but serious batch of memory-safety fixes in Ruby's regex engine, a long list of Rack fixes, and three separate incidents on RubyGems.org.

This article walks through all of it, in the order a Rails team should care about it. Every version comes from the official Ruby, Rails, Rack or GitHub advisory, linked inline. If you also run Node.js, Bun or PHP, we have written the same roundup for Node.js, Bun and PHP.

What is the most serious Rails vulnerability of 2026?

CVE-2026-66066, nicknamed KindaRails2Shell: an arbitrary file read in Active Storage variant processing. It lets an unauthenticated attacker read files on the server, including the process environment, which usually holds secret_key_base and service credentials. It is rated Critical, CVSS v4.0 9.5, and was published on 29 July 2026 (GHSA-xr9x-r78c-5hrm).

The cause is an insecure default. Active Storage did not disable libvips' "unfuzzed" operations, which libvips itself considers unsafe for untrusted input. A crafted image upload that triggers variant generation could invoke them.

Your application is affected if both of these are true:

  • It uses libvips for variants: Active Storage's variant_processor is set to :vips. That has been the default since load_defaults 7.0.
  • It accepts image uploads from users you do not trust.

GMO Flatt Security, one of the two teams that reported the bug, adds two details in its write-up:

  • Environments built on Debian or Ubuntu, and the Dockerfile that rails new generates, are affected by default.
  • Applications configured to process images with ImageMagick are not affected.

The name comes from the researchers at Ethiack, the other reporting team. Their write-up calls it a "rails2shell… kinda", because the chain to a shell needs several preconditions.

Rails lineAffectedFixed in
8.18.1.0 up to 8.1.38.1.3.1
8.08.0.0 up to 8.0.58.0.5.1
7.2 and olderBefore 7.2.3.27.2.3.2
How CVE-2026-66066 works
1 · Upload

Crafted image from an untrusted user

Through a normal Active Storage upload

2 · Variant

libvips processes it

variant_processor = :vips, the 7.0 default

3 · Read

Unfuzzed loader reads a server file

Not blocked by Active Storage

4 · Escalate

Environment leaked

secret_key_base, storage and API credentials

After patching

Rotate secret_key_base, the master key and every credential the app process could read

  • ✓ Rails 8.1.3.1, 8.0.5.1 or 7.2.3.2
  • ✓ libvips 8.13 or later (Active Storage refuses to boot on older versions)
  • ✓ VIPS_BLOCK_UNTRUSTED set as defence in depth
Upgrading closes the hole, but anything already read stays read, so the secrets have to be rotated too.

What to do about CVE-2026-66066

  1. Upgrade Rails to 8.1.3.1, 8.0.5.1 or 7.2.3.2 or later, and make sure libvips is 8.13 or later. Active Storage now raises an error at boot on older libvips.
  2. Rotate secrets if the app accepted untrusted uploads before you patched: secret_key_base, the master key and credentials file, storage service keys, database credentials and third-party tokens. The advisory is explicit that a secret read before the patch stays exposed after it.
  3. Add defence in depth: set the VIPS_BLOCK_UNTRUSTED environment variable, or call Vips.block_untrusted(true) in an initializer (ruby-vips 2.2.1 or later).
  4. On Rails 6.x, Flatt reports that some non-standard Active Storage configurations are affected and that no 6.x fix exists. Upgrading is the only clean answer.

Note

Is it being exploited?

The Rails advisory and both research teams withheld the exploit chain at disclosure, and CVE-2026-66066 is not in CISA's Known Exploited Vulnerabilities catalog as of 24 October 2026. But Flatt Security warned that, with AI tools, a working exploit could be built within hours of the patch going public. Treat an unpatched app as exposed.

What Ruby core vulnerabilities were fixed in 2026?

The most important are four memory-corruption bugs in Onigmo, Ruby's regular-expression engine, fixed on 23 October 2026 in Ruby 4.0.9, 3.4.12 and 3.3.13. They are CVE-2026-89078 (a double free) and CVE-2026-93577, CVE-2026-97229 and CVE-2026-110264 (integer overflows). GitLab assigned the CVE IDs after the bugs turned up in its own product (Ruby advisory).

You are at risk if your application compiles a regular expression from a string an attacker controls: Regexp.new(input), Regexp.union, Regexp.compile, or interpolation such as /#{input}/. Applications that only use regexes their developers wrote are not affected. Search features, filter builders, routing rules and "match this pattern" settings are the usual places to look.

4

Regex-engine CVEs fixed in Ruby on 23 October 2026

3
patched lines: Ruby 4.0.9, 3.4.12 and 3.3.13
10.0
the CVSS v3.1 score GitLab gave CVE-2026-110264 for its own product
No
protection from Regexp.timeout, according to the Ruby advisory

Two warnings from the advisory are worth repeating. Regexp.timeout does not protect against these bugs, because they corrupt memory during compilation rather than run slowly. And limiting the pattern length is unreliable, because some of the bugs trigger with short patterns. Ruby 3.3 is in security-only maintenance, and 3.3.13 is an explicit exception to that policy because of these CVEs.

The rest of Ruby's 2026 advisories:

DateCVEComponentWhat it isFixed in
27 AugCVE-2026-80212resolv gemA malicious name server's responses are kept forever, exhausting memoryresolv 0.7.2 (0.3.2 on Ruby 3.3)
27 AugCVE-2026-80213resolv gemOverlong names can resolve to a different domain, bypassing allow-lists and SSRF checksresolv 0.7.2 (0.3.2 on Ruby 3.3)
20 MayCVE-2026-46727getaddrinfo timeoutUse-after-free; delayed DNS replies can crash the process. Ruby 4.0 onlyRuby 4.0.5
21 AprCVE-2026-41316erb gemMarshal.load on untrusted data can run code when erb and Active Support are loaded, which is every Rails apperb 6.0.4 (or 4.0.3.1, 4.0.4.1, 6.0.1.1)
5 MarCVE-2026-27820zlib gemBuffer overflow in Zlib::GzipReaderzlib 3.2.3 (3.1.2 on Ruby 3.3)

Sources: the Ruby security page and the individual advisories it links to. The resolv bypass is worth singling out. If you validate outbound hostnames before fetching a user-supplied URL, CVE-2026-80213 is aimed at exactly that check. Net::HTTP and TCPSocket use the operating system's resolver and are not affected; code that uses Resolv directly is.

Which Rack and gem vulnerabilities should Rails teams patch?

Rack had the longest list: two batches in February and April, with several High-severity path and denial-of-service bugs. Most Rails apps get Rack transitively, so check your Gemfile.lock rather than your Gemfile.

Where the 2026 vulnerabilities sit
Rails

Active Storage, Action View, Active Support

KindaRails2Shell (9.5), plus a March batch of XSS and ReDoS fixes

Rack and middleware

rack, rack-session, Puma

Directory traversal, multipart DoS, session forgery (9.1)

Native gems

nokogiri, json, oj, rubyzip

Use-after-free, out-of-bounds reads, path traversal on extract

Ruby core

Onigmo, resolv, erb, zlib

Regex memory corruption, DNS validation bypass, Marshal code execution

Registry

RubyGems.org

Legacy API key leak, SleeperGem, a 500-package spam campaign

The two Critical bugs in the Rails stack this year came from insecure defaults, not from exotic code paths.
GemCVEWhat it isSeverityFixed in
rack-sessionCVE-2026-39324A cookie that fails decryption is still accepted, allowing session forgery and Marshal deserializationCritical, 9.12.1.2
rackCVE-2026-22860Rack::Directory path traversal (prefix check without a boundary)High, 7.52.2.22, 3.1.20, 3.2.5
rackCVE-2026-34785Rack::Static prefix matching exposes unintended filesHigh, 7.52.2.23, 3.1.21, 3.2.6
rackCVE-2026-34829Multipart upload without Content-Length fills the diskHigh, 7.52.2.23, 3.1.21, 3.2.6
rackCVE-2026-34835Invalid characters accepted in Host, bypassing host allow-listsModerate, 4.83.1.21, 3.2.6
pumaCVE-2026-47736, CVE-2026-47737PROXY protocol v1 memory exhaustion and client IP spoofing (non-default config only)High, 7.57.2.1, 8.0.2
rubyzipCVE-2026-85396Path traversal in Zip::Entry#extractHigh, 8.73.4.0
deviseCVE-2026-40295Open redirect through the referrer in TimeoutableModerate, 6.15.0.4
nokogiriGHSA-5prr-v3j2-97mhOut-of-bounds read in NodeSet#[]Moderate, 6.31.19.4
rails-html-sanitizerCVE-2026-73648XSS through SVG use or feImage, only if you added them to the allowed tagsModerate, 5.11.7.1

Scores are from the GitHub Advisory Database. A few notes:

  • rack-session affects apps that use Rack::Session::Cookie directly with secrets:. A standard Rails app uses Rails' own cookie store (CookieStore in Action Dispatch) and is typically not affected. If you are affected, rotate session secrets after upgrading.
  • Rails itself shipped a batch of fixes on 23 March 2026 in 7.2.3.1, 8.0.4.1 and 8.1.2.1, mostly Low-severity. They included an Action View XSS (CVE-2026-33168), a number_to_delimited ReDoS (CVE-2026-33169) and several Active Storage disk and proxy issues. The later 66066 releases include them.
  • Rack's April batch has more Moderate and High advisories than this table shows; upgrading to rack 3.2.6, 3.1.21 or 2.2.23 or later covers all of them (Rack advisories).

What happened on RubyGems.org in 2026?

Three separate incidents, none of them a bug in Bundler or the gem client.

  • The May spam-publishing campaign. New accounts published packages designed to run code on shared Ruby infrastructure and to try to collect other users' API keys. RubyGems.org paused new registrations, reopened them on 16 May, and yanked more than 500 malicious packages. Ruby Central says it found no evidence that the key-harvesting attempts succeeded (RubyGems blog).

  • The legacy API key leak (advisory).

    • What leaked: a CDN caching bug could serve one account's legacy API key to another caller for up to an hour.
    • Who was exposed: people who signed in with RubyGems clients older than 3.2.0, which includes the version Apple ships with macOS.
    • Timeline: Truffle Security reported it on 6 July, it was fixed on 9 July, and all legacy keys were revoked on 22 and 23 July.
    • What to do: if you ever used one, audit your gems for versions, owners or trusted publishers you did not add.
  • SleeperGem, July 2026. StepSecurity analysed malicious releases of three gems:

    • git_credential_manager 2.8.0 to 2.8.3, impersonating Microsoft's Git Credential Manager;
    • Dendreo 1.1.3 and 1.1.4, from a gem dormant since 2020;
    • fastlane-plugin-run_tests_firebase_testlab 0.3.2.

    The loader skipped CI environments and installed a persistent backdoor via systemd and cron on developer machines.

RubyGems.org responded with guidance to wait a few days before adopting newly published gem versions, published in June, and security warnings on gem pages, live since 15 October.

Which Ruby and Rails versions are still supported?

Ruby 3.3, 3.4 and 4.0, and Rails 8.0 and 8.1, but Rails 8.0's security support ends on 7 November 2026. Ruby 3.2 reached end-of-life in spring 2026; its last release was 3.2.11 on 27 March. Rails 7.2.4, released on 24 September, was announced as "the last release of the 7.2.x series."

Ruby release lines, October 2026
  1. EOL since spring 2026

    Ruby 3.2

    • Last release 3.2.11
    • No regex or resolv fixes
  2. Security only

    Ruby 3.3

    • Patch to 3.3.13
    • EOL expected 31 Mar 2027
  3. Normal maintenance

    Ruby 3.4

    • Patch to 3.4.12
  4. Normal maintenance

    Ruby 4.0

    • Patch to 4.0.9
Ruby 3.2 is out of support, and 3.3 only gets security fixes until spring 2027.
Rails lineStatus on 24 Oct 2026Security fixes untilVersion to run
Rails 8.1Security fixes only (bug fixes ended 10 Oct 2026)10 Oct 20278.1.3.1 or later (8.1.4 is current)
Rails 8.0Security fixes only7 Nov 20268.0.5.1, then move to 8.1
Rails 7.2Unsupported: 7.2.4 was the last releaseEnded7.2.3.2 at minimum, then move to 8.1

Rails' maintenance policy gives each minor series security fixes for two years after its first release. Ruby dates are from the Ruby branches page. Ruby publishes them as preliminary, so the 3.3 end date is the expected one.

How do you check a Ruby app for vulnerable gems?

Run bundler-audit against your Gemfile.lock in CI, and treat a new advisory as a failing build. It checks every locked gem version against the community ruby-advisory-db:

gem install bundler-audit
bundle-audit check --update   # refresh the advisory database, then check Gemfile.lock

A few habits catch what bundler-audit cannot:

  • Check default gems separately. resolv, erb, zlib and json ship with Ruby, so their versions depend on your Ruby patch level unless your Gemfile pins newer ones. gem list resolv erb zlib json shows what is actually installed.
  • Rebuild images. A ruby:3.4 base image pulled last month has last month's Ruby. Check ruby -v in the running container.
  • Add a cooldown. Review dependency updates that arrive within days of their release, as RubyGems.org now recommends, and be suspicious of dormant gems that suddenly publish.
  • Harden your own gems. Use scoped API keys or trusted publishing, and set MFA to ui_and_api on RubyGems.org.

What should you patch first?

  1. Rails to 8.1.3.1 or later (or 8.0.5.1), with libvips 8.13 or later, and rotate secrets if you took untrusted image uploads before patching.
  2. Ruby to 4.0.9, 3.4.12 or 3.3.13, especially if any code builds a Regexp from user input.
  3. Rack to 3.2.6, 3.1.21 or 2.2.23, and rack-session to 2.1.2.
  4. Native and web gems: puma, nokogiri, rubyzip, devise and rails-html-sanitizer to the versions in the table above.
  5. Plan the upgrade off Rails 8.0 and 7.2, since 8.0 loses security support on 7 November.
  6. Add bundle-audit check --update to CI, and replace any legacy RubyGems API keys.

Nordbeam builds and maintains web applications. If your Rails or Ruby version is out of support and the upgrade keeps getting pushed back, our software development team can help you plan it.

What is KindaRails2Shell?
KindaRails2Shell is the nickname for CVE-2026-66066, a critical vulnerability in Rails Active Storage published on 29 July 2026. Applications that use libvips for image variants and accept untrusted image uploads can be made to read arbitrary server files, including the environment that holds secret_key_base. It is fixed in Rails 7.2.3.2, 8.0.5.1 and 8.1.3.1.
Is my Rails app affected by CVE-2026-66066?
It is if it uses libvips as the Active Storage variant processor, which has been the default since load_defaults 7.0, and accepts image uploads from untrusted users, on a Rails version before 7.2.3.2, 8.0.5.1 or 8.1.3.1. Apps configured to use ImageMagick are not affected, according to GMO Flatt Security.
Do I need to rotate secrets after patching CVE-2026-66066?
Yes, if your app accepted untrusted image uploads before you patched. The Rails advisory recommends rotating secret_key_base, the master key and credentials file, storage service keys, database credentials and third-party tokens, because a secret that was read stays exposed after the upgrade.
Is Rails 7.2 still supported?
No. Rails 7.2.4, released on 24 September 2026, was the last release of the 7.2 series. Security fixes are now only provided for Rails 8.0 and 8.1, and Rails 8.0 support ends on 7 November 2026, so plan to move to 8.1.
Is Ruby 3.2 end of life?
Yes. Ruby 3.2 reached end-of-life in spring 2026, and its last release was 3.2.11 on 27 March 2026. It did not receive the October 2026 regex fixes. Supported lines are 3.3 (security only), 3.4 and 4.0.
Does Regexp.timeout protect against the Ruby regex CVEs?
No. The Ruby advisory for CVE-2026-89078, CVE-2026-93577, CVE-2026-97229 and CVE-2026-110264 says Regexp.timeout does not protect against them, and that limiting pattern length is unreliable. Upgrade to Ruby 4.0.9, 3.4.12 or 3.3.13, and avoid compiling regexes from untrusted input.
How do I use bundler-audit?
Install it with gem install bundler-audit and run bundle-audit check --update in your project. It updates the ruby-advisory-db and checks every gem version in Gemfile.lock against known advisories. Run it in CI so a new advisory fails the build.

Behind on Rails or Ruby?

Tell us which Rails and Ruby versions you run and what the app does. We will tell you what it takes to get to supported versions, and how to keep up after that.

Start the Conversation →

Get in Touch

Which workflow should AI improve first?

Book a practical review of one high-value workflow. You'll speak directly with Assim, Nordbeam's founder and lead engineer.
Email directly
Email
hello@nordbeam.io
Locations
Gothenburg & Malmö, Sweden
Response time
Within 24 hours