CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-66066

CVE-2026-66066: Pre-Authentication Arbitrary File Read and Remote Code Execution in Ruby on Rails Active Storage

Alon Barad
Alon Barad
Software Engineer

Jul 30, 2026·6 min read·5 visits

Executive Summary (TL;DR)

Active Storage using libvips allows unauthenticated remote attackers to read arbitrary server files by uploading a crafted MATLAB/HDF5 file, extract SECRET_KEY_BASE, and execute arbitrary commands via forged Marshal deserialization payloads.

CVE-2026-66066 (popularly known as 'KindaRails2Shell') is a critical security vulnerability in the Active Storage component of Ruby on Rails. The vulnerability arises from an insecure default integration with the libvips image processing library via the ruby-vips gem. Under default configurations, Active Storage fails to restrict untrusted format loaders within libvips, allowing remote, unauthenticated attackers to upload malformed files that leverage external dataset features to read local server files. By extracting cryptographic secrets such as SECRET_KEY_BASE from the leaked file contents, attackers can forge signed Marshal serialization payloads to achieve remote code execution.

Vulnerability Overview

Active Storage is a core component of the Ruby on Rails framework designed to manage file uploads, link files to Active Record models, and handle on-the-fly transformations such as thumbnail generation. When configured to process images using the libvips library via the ruby-vips gem, the framework delegates the decoding, modification, and re-encoding of uploaded media files to the underlying native engine.

The vulnerability, identified as CVE-2026-66066 and colloquially referred to as 'KindaRails2Shell', represents an insecure default initialization issue. Under default settings, Active Storage does not configure the libvips environment to restrict its input parsing capabilities. This omission allows remote, unauthenticated users to supply files in formats that trigger complex and poorly fuzzed internal parsing engines within the native library.

An attacker can abuse this behavior to trigger local file disclosure through external dataset features in complex file formats. By mapping system files directly into the color space of generated image variants, the attacker can extract cryptographic keys. These keys can subsequently be used to sign serialized payloads that exploit vulnerable deserialization mechanisms in Rails, leading to unauthenticated remote code execution.

Root Cause Analysis

The root cause of CVE-2026-66066 stems from how libvips manages its security boundaries for file format loaders. The native C library contains numerous parsing engines for specialized, scientific, or legacy formats. Because many of these loaders are complex or rely on third-party dependencies, libvips internally tags formats such as MATLAB/HDF5, PDF, SVG, and PSD as 'untrusted' or 'unfuzzed'. These formats are considered unsafe for use with untrusted network inputs.

Active Storage failed to invoke the security APIs provided by libvips to block these untrusted loaders. Consequently, when a Rails application receives an image upload, it relies on libvips to process the asset into a resized or reformatted variant. The native library performs magic byte sniffing on the input file, overriding the high-level MIME-type validation defined by the application developer.

This behavior allows an attacker to upload a malicious MATLAB/HDF5 file disguised as a standard image (such as a BMP). The MATLAB loader supports a feature called 'External Datasets', which allows matrices in the file to reference arbitrary physical file paths on the host filesystem. When libvips processes the uploaded file to generate a representation, the matload parser reads the targeted local files and encodes their raw byte contents directly into the RGB color channels of the resulting output image.

Code Analysis

The official remediation introduces process-wide restrictions on the image-processing library upon application startup. The patch is applied in activestorage/lib/active_storage/vips.rb to ensure that untrusted format loaders are blocked globally.

The vulnerable versions did not contain any initialization code to restrict format processing. The patched implementation enforces the following initialization checks:

# frozen_string_literal: true
 
require "active_storage"
require "active_support/core_ext/string/filters"
 
if ActiveStorage::VIPS_AVAILABLE
  begin
    # image_processing 2.0 calls Vips.block_untrusted(true) itself when it loads,
    # so it has to load before the lines below.
    require "image_processing/vips"
  rescue LoadError
  end
 
  unless Vips.respond_to?(:block_untrusted)
    raise <<~ERROR.squish
      libvips's unfuzzed operations are not safe to use with untrusted content, and Active Storage
      cannot disable them. Disabling them requires libvips 8.13 or later and ruby-vips 2.2.1 or
      later. Please upgrade libvips and ruby-vips, or remove the ruby-vips gem from your Gemfile.
    ERROR
  end
 
  # This system-wide call globally disables unsafe format loaders/savers
  Vips.block_untrusted(true)
end

The code block demonstrates a fail-secure approach. The invocation of Vips.block_untrusted(true) configures the underlying C library to decline parsing any format classified as unfuzzed or untrusted. Furthermore, if the host environment uses an older version of libvips or the ruby-vips gem that lacks the block_untrusted method, the application raises a runtime error and refuses to start, preventing silent vulnerability exposure.

Exploitation

To exploit this vulnerability, an attacker first constructs a malformed MATLAB/HDF5 file that defines an external dataset mapping to a targeted local file, such as /proc/1/environ or /etc/passwd. The attacker uploads this file to the target Rails application through any public upload endpoint that handles attachments via Active Storage. The attacker then requests the representation URL for the variant to trigger image generation.

Upon receiving the request, the Rails server executes the variant processing pipeline. libvips reads the file header, identifies it as a MATLAB format, and executes the matload loader. The loader resolves the external dataset, reads the targeted system file, and writes its raw contents into the canvas memory buffer. The application then returns a standard PNG containing the system file's raw bytes embedded within the pixel values.

The attacker retrieves this image and decodes the pixel array to reconstruct the leaked environment variables, extracting the application's SECRET_KEY_BASE. Using this cryptographic secret and the default salt ActiveStorage, the attacker generates a signed variation parameter containing a serialized Ruby Marshal payload. This payload encodes a deserialization gadget chain. When sent to the Rails server, Active Storage verifies the signature, deserializes the parameter using Marshal.load, and triggers unauthenticated remote code execution on the host.

Impact Assessment

The impact of CVE-2026-66066 is critical, as it allows full compromise of the underlying application host and its connected systems. In the initial stage, the arbitrary file read capability allows attackers to extract system configurations, database credentials, environment files, and internal communication tokens.

Once the attacker extracts the SECRET_KEY_BASE, the security controls of the Rails application are completely bypassed. Since the key is used to sign and encrypt cookies, session parameters, and database columns, the attacker can forge administrative sessions, access sensitive customer records, and modify persistent application state.

Finally, the deserialization of the forged Marshal payload provides unauthenticated remote code execution. Because Active Storage frequently runs within background worker processes (such as Sidekiq or Solid Queue) or web server threads with elevated privileges, the execution of arbitrary commands can lead to complete host takeover, lateral movement within the network, and exposure of internal infrastructure.

Remediation

Mitigation of the vulnerability requires upgrading Ruby on Rails to patched releases. The official patches are available in versions 7.2.3.2, 8.0.5.1, and 8.1.3.1. These updates must be accompanied by upgrading host dependencies to libvips >= 8.13 and ruby-vips >= 2.2.1 to ensure the security APIs are available.

If the application cannot be updated immediately, administrators can implement temporary workarounds. The primary workaround is to change the active variant processor from :vips to :mini_magick in the environment configuration file: config.active_storage.variant_processor = :mini_magick.

When switching to MiniMagick, administrators must secure the host's ImageMagick configuration by modifying the policy.xml file. The policy should explicitly block dangerous coders such as MSL, MVG, HTTPS, and PDF to prevent similar file-read and execution vectors within the alternate image processor.

Official Patches

Ruby on RailsGHSA-xr9x-r78c-5hrm security advisory
Ruby on RailsFix commit for Rails v7
Ruby on RailsFix commit for Rails v8.0
Ruby on RailsFix commit for Rails v8.1

Technical Appendix

CVSS Score
9.8/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Affected Systems

Ruby on Rails (Active Storage / Action Pack) using libvips

Affected Versions Detail

Product
Affected Versions
Fixed Version
Ruby on Rails (Active Storage)
Ruby on Rails
< 7.2.3.27.2.3.2
Ruby on Rails (Active Storage)
Ruby on Rails
>= 8.0.0.beta1, < 8.0.5.18.0.5.1
Ruby on Rails (Active Storage)
Ruby on Rails
>= 8.1.0.beta1, < 8.1.3.18.1.3.1
AttributeDetail
CWE IDCWE-1188 / CWE-502
Attack VectorNetwork (Unauthenticated)
CVSS v3.1 Score9.8
CVSS v4.0 Score9.5
Exploit StatusProof of Concept (PoC) Available
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1134Access Token Manipulation
Defense Evasion
CWE-1188
Insecure Default Initialization of Resource

The software initializes a resource using an insecure default configuration, allowing unauthorized access or exploitation of connected libraries.

Vulnerability Timeline

Vulnerability identified and reported privately to the Rails Core Team.
2026-07-01
Patches prepared and merged for Rails 7.2.x, 8.0.x, and 8.1.x lines.
2026-07-15
Public release of GHSA-xr9x-r78c-5hrm and patched Rails framework versions.
2026-07-20

References & Sources

  • [1]GitHub Security Advisory (Rails Core)
  • [2]Official Fix Commit - 1c01bb58
  • [3]Official Fix Commit - 349e7a5d
  • [4]Official Fix Commit - d79b7f4a
  • [5]Rubysec Advisory Entry
  • [6]Official Rails Release v7.2.3.2
  • [7]Official Rails Release v8.0.5.1
  • [8]Official Rails Release v8.1.3.1
  • [9]Industry Disclosure

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•12 minutes ago•CVE-2025-4318
9.0

CVE-2025-4318: Remote Code Execution in AWS Amplify codegen-ui

A critical remote code execution (RCE) vulnerability exists in AWS Amplify Studio's code-generation library (@aws-amplify/codegen-ui). An authenticated attacker with permissions to create or modify component schemas can inject malicious JavaScript code into those schemas. When the Amplify CLI or the build environment processes these schemas, the unvalidated expressions are executed within the host Node.js environment, leading to full system compromise.

Alon Barad
Alon Barad
0 views•5 min read
•about 1 hour ago•CVE-2026-67426
9.3

CVE-2026-67426: Unauthenticated Remote Code Execution and Secret Exfiltration in Flyto2 Core

CVE-2026-67426 is a critical vulnerability in Flyto2 Core prior to version 2.26.7. The standalone flyto-verification service binds to all interfaces (0.0.0.0) on port 8344 and exposes an unauthenticated POST /run endpoint. This endpoint accepts an arbitrary client-controlled callback URL and makes an outbound POST request containing the sensitive internal runner secret in the headers. Attackers can exploit this to retrieve the FLYTO_RUNNER_SECRET and perform Server-Side Request Forgery (SSRF) against internal network targets.

Amit Schendel
Amit Schendel
4 views•6 min read
•about 3 hours ago•CVE-2026-54722
8.7

CVE-2026-54722: Server-Side Request Forgery (SSRF) Bypass via Userinfo Stripping in dssrf-js

An SSRF validation bypass exists in dssrf-js (v1.0.3 and prior) due to an improper string normalization sequence inside is_url_safe. Before validating the host using Node's WHATWG parser, the helper strips the '@' symbol. This corrupts the parser's authority resolution, while the application's client requests the original, un-sanitized string containing internal IP targets.

Alon Barad
Alon Barad
4 views•6 min read
•about 4 hours ago•CVE-2026-54522
2.1

CVE-2026-54522: Same-Process Use-After-Free and Cross-Buffer Data Disclosure in msgpack-ruby

A Use-After-Free (UAF) vulnerability exists in msgpack-ruby prior to version 1.8.2. The MessagePack::Buffer#clear method returns the associated 4 KiB rmem page to the shared pool but fails to reset the buffer's tracking pointers (rmem_last, rmem_end, and rmem_owner). Subsequent write operations on the cleared buffer can alias the freed page, allowing concurrent buffers to access, disclose, or corrupt cross-buffer data. This issue is resolved in version 1.8.2.

Alon Barad
Alon Barad
6 views•5 min read
•about 5 hours ago•CVE-2026-67428
8.5

CVE-2026-67428: Server-Side Request Forgery in Flyto2 Core HTTP-Emitting Modules

Flyto2 Core (flyto-core) prior to version 2.26.7 did not utilize its centralized SSRF validation mechanism ('validate_url_with_env_config') across multiple HTTP-emitting modules. This oversight allowed low-privileged users executing automated workflows to perform Server-Side Request Forgery (SSRF) attacks against internal endpoints, loopback interfaces, and cloud provider metadata services.

Alon Barad
Alon Barad
6 views•5 min read
•about 6 hours ago•CVE-2026-67424
8.5

CVE-2026-67424: Server-Side Request Forgery Bypass via Unvalidated Redirects in Flyto2 Core

An SSRF vulnerability exists in Flyto2 Core due to improper validation of intermediate HTTP redirect hops. While the initial request target is validated against an SSRF protection policy, the HTTP client library (aiohttp) transparently follows 30x redirects to local, internal, or cloud metadata endpoints without application-level revalidation.

Alon Barad
Alon Barad
5 views•6 min read