Critical Ruby on Rails Vulnerability Under Active Attack | CVE-2026-66066

Ruby on rails vulnerability
Ruby on rails vulnerability

Cyber threat actors have begun actively exploiting a critical-severity in Ruby on Rails vulnerability, months after security researchers disclosed the flaw and emergency patches were released.

Dubbed KindaRails2Shell by security researchers and tracked as CVE-2026-66066 (CVSS v4 score: 9.5), the unauthenticated arbitrary file read flaw allows attackers to steal application secrets, forge administrative sessions, and achieve Remote Code Execution (RCE) on affected web servers.

Cybersecurity intelligence firm VulnCheck confirmed that honeypots across multiple jurisdictions—including the United Kingdom, Israel, and Singapore—began detecting active exploitation attempts following the public release of reverse-engineered proof-of-concept (PoC) exploits.

We originally intended to publish these details no later than 2026-08-28, but several researchers quickly reverse-engineered the attack and have already published proofs-of-concept. As a result, we are disclosing details about the attack now, along with some tools to help assess whether an application was vulnerable and to help examine the forensic evidence for signs of secret exfiltration, security researcher noted.

Inside the Technical Exploit Chain

The root cause of KindaRails2Shell stems from a fundamental parser confusion bug between Rails’ Active Storage image-processing handler and underlying low-level system libraries.

Root cause of kindarails2
Root cause of kindarails2

1. Parser Discrepancy: While Rails relies on client-supplied content headers to validate uploaded files, the underlying `libvips` image processor determines file types using raw magic bytes.
2. Library Hop (MATLAB to HDF5): By crafting a specialized upload, an attacker forces `libvips` to select its unfuzzed MATLAB Level 5 loader. This hands execution over to `libmatio`, which subsequently invokes the HDF5 data library.
3. Arbitrary File Disclosure: The HDF5 External File List feature allows dataset bytes to be sourced from any designated system file path. When the Rails application attempts to render an image variant (such as a profile avatar or thumbnail), the server reads the target file and returns its raw contents disguised within image pixel data.
4. Secret Exfiltration to RCE: Attackers target environment variables, database credentials, cloud access tokens, and critically, `secret_key_base`. Armed with the application’s master cryptographic key, an attacker can craft signed cookies, manipulate Ruby `Marshal` deserialization routines, and execute arbitrary code remotely.

The Post-Patch Trap: Why Upgrading May Not Be Enough

Security analysts warn that simply updating the Rails framework leaves an active security exposure if an application was already probed prior to patching.

VulnCheck highlighted a critical secondary risk: while the official framework patch effectively blocks `libvips` from reading arbitrary files, it does not invalidate previously stolen variation keys or session signatures. If an attacker extracted `secret_key_base` before the patch was applied, they can continue to trigger `Marshal` deserialization gadgets to execute commands remotely on fully updated servers.

Threat Summary & Technical Details

Element Security Breakdown
Vulnerability Identifier CVE-2026-66066 / GHSA-xr9x-r78c-5hrm
Common Name KindaRails2Shell
CVSS v4 Score 9.5 (Critical)
Affected Configurations Rails 7.0+ using default config.active_storage.variant_processor = :vips with user image uploads
Exploitation Status Active In-The-Wild Exploitation (Confirmed by VulnCheck)

Mandatory Remediation & Incident Response Actions

Systems administrators and Rails developers managing application environments must execute a two-phase containment plan immediately:

Phase 1: Codebase & Dependency Updates

  • Upgrade ActiveStorage: Update `activestorage` to the latest patched release.
  • Enforce System Library Limits: Ensure the underlying system installation of `libvips` is upgraded to version 8.13 or higher. If upgrading `libvips` immediately is not feasible, set the environment variable `VIPS_BLOCK_UNTRUSTED=true` to block unsafe image loaders at startup.

Phase 2: Mandatory Credential & Secret Rotation

  • Rotate `secret_key_base`: Treat all environment secrets as potentially exfiltrated. Immediately rotate `secret_key_base`, master encryption keys (`config/master.key`), and all parameters inside `credentials.yml.enc`.
  • Invalidate Active Sessions & Tokens: Force global session logouts to revoke active user and admin session cookies.
  • Revoke Cloud & Database Credentials: Rotate all third-party API keys, database connection strings, and cloud storage tokens (AWS S3, Google Cloud Storage, Azure Blob) accessible to the Rails process.

Join Our Club

Enter your Email address to receive notifications | Join over Million Followers

Previous Article
Penetration Testing Report Writing

Penetration Testing Report Writing: How to Document Vulnerabilities

Related Posts