A critical flaw in Ruby on Rails Active Storage can let an unauthenticated user upload a crafted image and make the server write files. If uploads use the Disk service, the same upload can also make the server read files. The Rails team rated the bug Critical, gave it a CVSS score of 9.8, and published the advisory on November 4, 2026.
ImageMagick behavior behind the flaw
The issue starts with ImageMagick choosing a coder, meaning a file format handler, from the file’s contents rather than its name. Some coders can act on other files named inside the image. Active Storage did not limit those coders, and its image analyzer runs as soon as a file is attached. That means an attacker only needs to attach a crafted upload, with no need for a variant, preview, or analyze call.
What an attacker can reach
The files at risk usually include secret_key_base and credentials for outside systems. With those secrets, an attacker may move on to remote code execution or reach other connected services. The Rails team says one attack chain was reported, but it does not assume that was the only one. The researcher ryotak reported the bug through HackerOne.
Affected apps and versions
An app is affected only when three conditions are true. It uses ImageMagick through config.active_storage.variant_processor =:mini_magick, which is the default for apps on load_defaults 6.1 or earlier. It runs ImageMagick under a policy that does not already block the coders involved, and the policies packaged by Debian and Ubuntu do not. It also accepts uploads from untrusted users. The affected versions are activestorage before 8.0.5.2 and 8.1 releases before 8.1.4.1.
How the fix works
The fix ships an ImageMagick security policy. Rails adds its folder to MAGICK_CONFIGURE_PATH through MiniMagick.cli_env, so every ImageMagick process that MiniMagick starts follows that policy. The policy blocks the MSL scripting coder, coders that read or delete other files, coders that fetch remote or local references, every Ghostscript-backed coder, and @filename indirection. It adds to the host’s rules rather than replacing them.
Related image attacks and earlier cases
This is not the first image-related Rails issue this year. Cyber Security News recently covered CVE-2026-66066, a Rails Active Storage flaw that affected apps using libvips and could expose secrets such as secret_key_base and cloud keys. Researchers later saw that bug used in real attacks. Teams that patched in the summer should not assume they are safe now, because this case uses a different processor and a different fix.
ImageMagick has also caused problems outside Rails. A recent WordPress bug let Author-level users reach code execution because ImageMagick passed a disguised PostScript file to Ghostscript. A separate Discourse image pipeline exploit chained ImageMagick features to read server files.
Upgrade and containment steps
The first step is to upgrade activestorage to 8.0.5.2 or 8.1.4.1. Apps using mini_magick also need mini_magick 5.1 or newer, and older versions fail with an error at boot. Apps that render PostScript or PDF through ImageMagick must allow the gs delegate again in the host’s policy.xml.
Some setups do not inherit the shipped policy. Apps that replace MiniMagick.cli_env after boot, clear the environment with MiniMagick.cli_prefix, or use their own MiniMagick::Shell do not get it and must copy the rules into ImageMagick’s system policy. GraphicsMagick does not read ImageMagick policies at all. Teams that cannot upgrade right away can copy the shipped rules into the system policy, for example /etc/ImageMagick-7/policy.xml, and at minimum block the MSL coder, the Ghostscript coders, and the gs delegate.
Secrets and follow-up fixes
Secrets need attention too. If attachments live on the Disk service, change secret_key_base and every secret the app process can read. That includes the master key, everything in config/credentials.yml.enc, storage and database credentials, and third-party tokens. The Rails team warns against keeping an exposed secret as a fallback.
This fix is one of 21 security issues in the 8.0.5.2 and 8.1.4.1 releases. The other issues include a Strong Parameters bypass, IP spoofing through the Forwarded header in 8.1, several cross-site scripting bugs in Action View, denial-of-service bugs, and session cookie problems. A second High-rated bug covers file read and code execution through Active Storage video previews and analysis. Security support for the 8.0 series ends on November 7, 2026, so teams on older lines should plan a move to 8.0 or later.