Jul 30, 2026·6 min read·425 visits
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.
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.
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.
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)
endThe 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.
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.
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.
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.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
Ruby on Rails (Active Storage) Ruby on Rails | < 7.2.3.2 | 7.2.3.2 |
Ruby on Rails (Active Storage) Ruby on Rails | >= 8.0.0.beta1, < 8.0.5.1 | 8.0.5.1 |
Ruby on Rails (Active Storage) Ruby on Rails | >= 8.1.0.beta1, < 8.1.3.1 | 8.1.3.1 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-1188 / CWE-502 |
| Attack Vector | Network (Unauthenticated) |
| CVSS v3.1 Score | 9.8 |
| CVSS v4.0 Score | 9.5 |
| Exploit Status | Proof of Concept (PoC) Available |
| KEV Status | Not Listed |
The software initializes a resource using an insecure default configuration, allowing unauthorized access or exploitation of connected libraries.
In etcd versions prior to 3.5.32 and 3.6.13, configuring the server with --listen-client-http-urls decouples HTTP and gRPC traffic onto distinct network listeners. Due to an implementation flaw in how TLS configurations are passed to the gRPC server instance, the Certificate Revocation List (CRL) defined by --client-crl-file is enforced exclusively on the HTTP listener and omitted entirely on the dedicated gRPC listener. This allows an adversary possessing a revoked, CA-signed client certificate to bypass mutual TLS (mTLS) revocation checks and authenticate directly to the gRPC interface.
GitHub CLI (gh) versions 2.10.0 through 2.95.0 contain an input validation vulnerability in the `gh codespace jupyter` command path. When connecting to a remote Codespace to launch a JupyterLab session, the CLI retrieves a server URL via a remote procedure call (RPC) and passes it directly to the host operating system's default URL dispatcher without validating the scheme or target host. A compromised or malicious Codespace can return a custom protocol URI, such as `vscode://` or `vscode-insiders://`, allowing an attacker to invoke local desktop application handlers and achieve arbitrary command execution on the developer's workstation.
A path traversal vulnerability exists in the cakephp/twig-view plugin for the CakePHP framework prior to versions 1.3.3 and 2.1.2. The Cake\TwigView\Twig\FileLoader::findTemplate() method verifies template existence using PHP's native file_exists() function without ensuring the target path resides within configured application or plugin template directories. When user-controlled input is passed to template inclusion mechanisms, an unauthenticated remote attacker can read arbitrary local files accessible to the PHP runtime.
CVE-2026-64855 (GHSA-859w-52fx-hcm6) is a cryptographic signature verification and authentication bypass vulnerability in the soapbar Python library prior to version 0.13.0. In vulnerable versions, the verify_envelope_bsp() function derives its trust anchor directly from the incoming SOAP message by extracting an untrusted X.509 certificate embedded inside the wsse:BinarySecurityToken header. Because the function checks only the temporal validity of the extracted certificate without performing Certificate Authority (CA) chain validation or certificate pinning, an unauthenticated network attacker can generate a self-signed certificate, sign an arbitrary SOAP payload, and pass verification.
A denial-of-service vulnerability exists in the Go library github.com/insomniacslk/dhcp within the dhcpv4/nclient4 subpackage. In affected versions, the raw packet parsing function BroadcastRawUDPConn.ReadFrom subtracts the fixed 8-byte UDP header length from the IPv4 payload length declared in the packet header without first verifying that the declared payload length is at least 8 bytes. An unauthenticated attacker on an adjacent local network segment can broadcast or unicast a malformed IPv4 packet with a declared payload length between 0 and 7 bytes, causing a signed integer underflow that passes a negative slice bound into buf.Consume and triggers an unhandled Go runtime panic.
CVE-2026-63305 (GHSA-g9x9-q7qj-6mv5) is an operating system command injection vulnerability affecting WWBN AVideo (formerly YouPHPTube) versions up to and including 29.0. The defect resides in the standalone FFmpeg execution handler at plugin/API/standAlone/ffmpeg.json.php. When assembling asynchronous post-processing commands, the script concatenates the notifyCode and callback properties from a decrypted payload directly into a shell command string without sanitization. An attacker capable of providing or forging a valid encrypted execution payload can inject shell metacharacters to achieve remote code execution under the privileges of the web server user.