CVSS 9.8. One crafted image upload can write files on a Rails server, and no preview or variant call is needed. Rails advisory GHSA-f3w6-w445-fwh9 (CVE-2026-126082, published 2026-11-04) says Active Storage apps that analyze untrusted uploads with ImageMagick are affected. The ImageMagick analyzer runs on attach, so the file reaches ImageMagick the moment it is attached.
How an upload reaches ImageMagick
The path is browser, controller, attach, blob written to storage, analyzer, MiniMagick. ImageMagick picks a format reader, called a coder, from the file bytes. Most coders only decode pixels. A few act on other files: MSL scripts read and write files, SVG can reference files, and @file reads files by name. The Rails patch states that an uploaded SVG reached the MSL coder through the analyzer at attach time.
Which versions are affected
Three conditions must all hold: config.active_storage.variant_processor = :mini_magick, an ImageMagick policy that does not deny the coders involved (the advisory says the Debian and Ubuntu defaults do not), and uploads from untrusted users. Activestorage 8.1.0 to 8.1.4 is fixed in 8.1.4.1; versions before 8.0.5.2, including 7.x and older, are fixed in 8.0.5.2.
Our lab: 9 files, 12 policy rules
Our Node model checked 9 upload files and 12 policy assertions. The unsafe model trusted the file name and the client sent Content-Type. All 9 files were accepted, including an 83 byte SVG named avatar.png and a 69 byte PNG whose header claims 50000 by 50000 pixels. All 12 policy assertions came back open.
The fixed model reads bytes, not names. It rejected the disguised files and the 50000 by 50000 header, and re-encoded the two real PNGs so their extra bytes came out as 0 B. Totals: 21 of 21 attack cases flagged on the unsafe model, 21 of 21 passed the fixed model, and 7 of 7 normal cases unchanged.
The three fixes
Fix 1 is the upgrade: pin gem "rails", "~> 8.1.4", ">= 8.1.4.1" and gem "mini_magick", ">= 5.1". The fixed releases ship their own ImageMagick policy.
Fix 2 is checking the bytes before attach. A PNG has an eight byte signature and a JPEG starts with FF D8 FF. Read the signature, read dimensions from the header, reject anything over 40 million pixels, re-encode, and store under a server chosen name. A client sent name or Content-Type says nothing about the bytes ImageMagick will read.
Fix 3 is locking down policy.xml: deny every coder, then allow only PNG, JPEG, GIF and WEBP, with the allow line last, because the last matching rule decides. Add resource limits too: area 40MP, memory 256MiB, disk 1GiB, time 30.
Our take
The name on a file is a claim by the sender, not a fact about the bytes. Upgrade first, then check bytes before attach, then deny all coders except the four you serve. Check your own app with bundle info activestorage and magick -list policy.
Read the full article with the complete lab table, the fixed policy file, and the test code on System Design Simple: https://systemdesignsimple.com/rails-imagemagick-upload-flaw-check-and-fix/