Ruby and Rails Vulnerabilities in 2026: KindaRails2Shell, CVEs and What to Patch
By Assim ElHammouti, Founder and Lead Engineer, NordbeamPublished Updated
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_processoris set to:vips. That has been the default sinceload_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 newgenerates, 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 line | Affected | Fixed in |
|---|---|---|
| 8.1 | 8.1.0 up to 8.1.3 | 8.1.3.1 |
| 8.0 | 8.0.0 up to 8.0.5 | 8.0.5.1 |
| 7.2 and older | Before 7.2.3.2 | 7.2.3.2 |
Crafted image from an untrusted user
Through a normal Active Storage upload
libvips processes it
variant_processor = :vips, the 7.0 default
Unfuzzed loader reads a server file
Not blocked by Active Storage
Environment leaked
secret_key_base, storage and API credentials
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
What to do about CVE-2026-66066
- 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.
- 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. - Add defence in depth: set the
VIPS_BLOCK_UNTRUSTEDenvironment variable, or callVips.block_untrusted(true)in an initializer (ruby-vips 2.2.1 or later). - 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:
| Date | CVE | Component | What it is | Fixed in |
|---|---|---|---|---|
| 27 Aug | CVE-2026-80212 | resolv gem | A malicious name server's responses are kept forever, exhausting memory | resolv 0.7.2 (0.3.2 on Ruby 3.3) |
| 27 Aug | CVE-2026-80213 | resolv gem | Overlong names can resolve to a different domain, bypassing allow-lists and SSRF checks | resolv 0.7.2 (0.3.2 on Ruby 3.3) |
| 20 May | CVE-2026-46727 | getaddrinfo timeout | Use-after-free; delayed DNS replies can crash the process. Ruby 4.0 only | Ruby 4.0.5 |
| 21 Apr | CVE-2026-41316 | erb gem | Marshal.load on untrusted data can run code when erb and Active Support are loaded, which is every Rails app | erb 6.0.4 (or 4.0.3.1, 4.0.4.1, 6.0.1.1) |
| 5 Mar | CVE-2026-27820 | zlib gem | Buffer overflow in Zlib::GzipReader | zlib 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.
Active Storage, Action View, Active Support
KindaRails2Shell (9.5), plus a March batch of XSS and ReDoS fixes
rack, rack-session, Puma
Directory traversal, multipart DoS, session forgery (9.1)
nokogiri, json, oj, rubyzip
Use-after-free, out-of-bounds reads, path traversal on extract
Onigmo, resolv, erb, zlib
Regex memory corruption, DNS validation bypass, Marshal code execution
RubyGems.org
Legacy API key leak, SleeperGem, a 500-package spam campaign
| Gem | CVE | What it is | Severity | Fixed in |
|---|---|---|---|---|
| rack-session | CVE-2026-39324 | A cookie that fails decryption is still accepted, allowing session forgery and Marshal deserialization | Critical, 9.1 | 2.1.2 |
| rack | CVE-2026-22860 | Rack::Directory path traversal (prefix check without a boundary) | High, 7.5 | 2.2.22, 3.1.20, 3.2.5 |
| rack | CVE-2026-34785 | Rack::Static prefix matching exposes unintended files | High, 7.5 | 2.2.23, 3.1.21, 3.2.6 |
| rack | CVE-2026-34829 | Multipart upload without Content-Length fills the disk | High, 7.5 | 2.2.23, 3.1.21, 3.2.6 |
| rack | CVE-2026-34835 | Invalid characters accepted in Host, bypassing host allow-lists | Moderate, 4.8 | 3.1.21, 3.2.6 |
| puma | CVE-2026-47736, CVE-2026-47737 | PROXY protocol v1 memory exhaustion and client IP spoofing (non-default config only) | High, 7.5 | 7.2.1, 8.0.2 |
| rubyzip | CVE-2026-85396 | Path traversal in Zip::Entry#extract | High, 8.7 | 3.4.0 |
| devise | CVE-2026-40295 | Open redirect through the referrer in Timeoutable | Moderate, 6.1 | 5.0.4 |
| nokogiri | GHSA-5prr-v3j2-97mh | Out-of-bounds read in NodeSet#[] | Moderate, 6.3 | 1.19.4 |
| rails-html-sanitizer | CVE-2026-73648 | XSS through SVG use or feImage, only if you added them to the allowed tags | Moderate, 5.1 | 1.7.1 |
Scores are from the GitHub Advisory Database. A few notes:
- rack-session affects apps that use
Rack::Session::Cookiedirectly withsecrets:. A standard Rails app uses Rails' own cookie store (CookieStorein 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_delimitedReDoS (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_manager2.8.0 to 2.8.3, impersonating Microsoft's Git Credential Manager;Dendreo1.1.3 and 1.1.4, from a gem dormant since 2020;fastlane-plugin-run_tests_firebase_testlab0.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."
- EOL since spring 2026
Ruby 3.2
- Last release 3.2.11
- No regex or resolv fixes
- Security only
Ruby 3.3
- Patch to 3.3.13
- EOL expected 31 Mar 2027
- Normal maintenance
Ruby 3.4
- Patch to 3.4.12
- Normal maintenance
Ruby 4.0
- Patch to 4.0.9
| Rails line | Status on 24 Oct 2026 | Security fixes until | Version to run |
|---|---|---|---|
| Rails 8.1 | Security fixes only (bug fixes ended 10 Oct 2026) | 10 Oct 2027 | 8.1.3.1 or later (8.1.4 is current) |
| Rails 8.0 | Security fixes only | 7 Nov 2026 | 8.0.5.1, then move to 8.1 |
| Rails 7.2 | Unsupported: 7.2.4 was the last release | Ended | 7.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,zlibandjsonship with Ruby, so their versions depend on your Ruby patch level unless yourGemfilepins newer ones.gem list resolv erb zlib jsonshows what is actually installed. - Rebuild images. A
ruby:3.4base image pulled last month has last month's Ruby. Checkruby -vin 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_apion RubyGems.org.
What should you patch first?
- 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.
- Ruby to 4.0.9, 3.4.12 or 3.3.13, especially if any code builds a
Regexpfrom user input. - Rack to 3.2.6, 3.1.21 or 2.2.23, and rack-session to 2.1.2.
- Native and web gems: puma, nokogiri, rubyzip, devise and rails-html-sanitizer to the versions in the table above.
- Plan the upgrade off Rails 8.0 and 7.2, since 8.0 loses security support on 7 November.
- Add
bundle-audit check --updateto 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?
Is my Rails app affected by CVE-2026-66066?
Do I need to rotate secrets after patching CVE-2026-66066?
Is Rails 7.2 still supported?
Is Ruby 3.2 end of life?
Does Regexp.timeout protect against the Ruby regex CVEs?
How do I use bundler-audit?
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?
- hello@nordbeam.io
- Locations
- Gothenburg & Malmö, Sweden
- Response time
- Within 24 hours