
Read-only Bash script that scans Rails projects for CVE-2026-122006, flagging vulnerable activestorage versions, mini_magick variant processing, and permissive ImageMagick coder policies.
Detection script for CVE-2026-122006 — Rails Active Storage hands uploads to ImageMagick with unrestricted coders, so a crafted SVG/MSL upload can read/write arbitrary files on the server (CVSS 9.8). Fixed in activestorage 8.0.5.2 and 8.1.4.1. The script only reports — it changes nothing.
Source: Rails Active Storage CVE-2026-122006: Patching, Detection and Hunting

Run it straight from GitHub in the current directory:
curl -fsSL https://raw.githubusercontent.com/charlie-goldenowl/cve-2026-122006-check/master/check_cve_2026_122006.sh | bash
Scan a specific folder (pass the root after --):
curl -fsSL https://raw.githubusercontent.com/charlie-goldenowl/cve-2026-122006-check/master/check_cve_2026_122006.sh | bash -s -- ~/projects
chmod +x check_cve_2026_122006.sh
./check_cve_2026_122006.sh [ROOT] # ROOT defaults to the current directory
ROOT and checks every Rails app it finds (any dir with
config/application.rb + a Gemfile.lock pinning activestorage), printing a
per-project verdict and a summary. Point it at a parent folder to scan many
projects at once: ./check_cve_2026_122006.sh ~/projects.0 = none vulnerable, 2 = at least one vulnerable (CI-friendly).NO_COLOR=1 ./check_cve_2026_122006.sh disables colored output.bash + ruby; magick/convert optional
(used only to check the host ImageMagick policy).activestorage older than 8.0.5.2 (8.1 line: older than 8.1.4.1).variant_processor is :mini_magick (Rails 8 default :vips is not
affected). Read from your config, falling back to the load_defaults default.bundle update rails mini_magick # -> activestorage 8.0.5.2 / 8.1.4.1, mini_magick >= 5.1
Can't upgrade yet? Install the deny policy shipped inside the fixed gem onto every host/image/container:
gem contents activestorage | grep policy.xml # copy into your system policy.xml
If the Disk service accepted untrusted uploads, assume secrets may have been
read: rotate secret_key_base, credentials, DB/storage keys and third-party tokens.
The script reads versions from Gemfile.lock and config files (no app boot), so
it is fast and safe to run across many repos. It does not detect apps that patch
MiniMagick internals or use GraphicsMagick; review those manually.