Ruby on Rails Active Storage (versions 7.0.0–8.1.3 and Rails 6.x with Vips enabled)
Ruby on Rails is a popular open-source web development framework used to build web applications. Active Storage is its built-in system for handling file uploads.
Root Cause
libvips supports certain file-loading operations that its own maintainers flag as unsafe for hostile input. Active Storage did not restrict access to these operations. It passed untrusted uploaded files directly into them. No special upload endpoint was needed — even standard variant generation triggered the vulnerable path.
Attack Vector
An attacker uploads a specially crafted file (reportedly a MATLAB/HDF5 format file) through any public upload form. libvips processes it and reads internal server files. The attacker recovers SECRET_KEY_BASE (a master signing key Rails uses to verify session data). With that key, an attacker can forge authenticated session tokens, enabling RCE (remote code execution — running arbitrary commands on the server) or lateral movement (moving from one compromised system into others connected to it).
Detection Notes
- Unexpected or malformed file types appearing in upload logs (MATLAB, HDF5, or similar scientific formats submitted to image upload endpoints)
- Anomalous outbound network requests from your Rails worker processes, particularly curl-style callbacks to external addresses
- Unrecognised session tokens appearing in application logs after no corresponding login event
Recommended Actions
- Upgrade Rails to 7.2.3.2, 8.0.5.1, or 8.1.3.1 immediately. Rails 7.1 and earlier are end-of-life and will not receive a backport.
- If you cannot patch immediately and run libvips 8.13 or later, set the environment variable
VIPS_BLOCK_UNTRUSTED=1or callVips.block_untrusted(true)via ruby-vips 2.2.1 or later. - Rotate all secrets readable by the application process:
secret_key_base, master key, database credentials, cloud storage keys, and third-party API tokens.

