KindaRails2Shell – Critical RCE in Rails via Active Storage
A critical vulnerability in Ruby on Rails Active Storage with the vips image processor allows arbitrary file read and remote code execution. An attacker who can upload images to an affected application could read files and execute code as the worker or process user.
ethiack.com
Published on ethiack.com
Ruby on Rails runs a significant share of the modern web, and Active Storage, Rails’ built-in file attachment and image-processing framework, is enabled by default in a large number of production applications.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely unsafe operations in libvips when processing untrusted images, which Active Storage did not block by default.
Impact
An attacker could read arbitrary files and achieve remote code execution, though a WAF might help in some deployments and the exploit requires specific conditions such as untrusted image uploads and a vulnerable libvips build.
What the attacker needed
Rails app with Active Storage and vips; Accepts image uploads from untrusted users; libvips linked against certain libraries
The fix
Upgrade Rails to [redacted], [redacted], or [redacted] (or later) and ensure libvips is version 8.13 or later; alternatively set VIPS_BLOCK_UNTRUSTED or call Vips.block_untrusted(true).
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Ruby on Rails is a popular framework for building web applications. Active Storage is a built-in feature that handles file uploads, such as profile pictures. A flaw in how it processes images with a library called libvips lets an attacker who can upload an image read files on the server and even run their own commands, which is called remote code execution.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.