{"id":"CVE-2026-122006","kind":"vulnerability","aliases":["CVE-2026-122006"],"related":[],"title":"Rails ActiveStorage: ImageMagick attachments let an attacker read and write server files","description":"The activestorage gem before 8.1.4.1 for Ruby on Rails, when ImageMagick attachment processing occurs, can allow server read and write operations (e.g., reading secret_key_base) because the ImageMagick analyzer runs when a file is attached, and there is not an ImageMagick security policy to block unintended functionality.","summary":"The activestorage gem before 8.1.4.1 runs the ImageMagick analyzer when a file is attached, and no ImageMagick security policy blocks unintended ImageMagick functions. An attacker who can upload an image can make the server read and write files, such as the secret_key_base.","severity":"critical","cvss":9.8,"epss":null,"exploited":false,"exploited_at":null,"products":[{"name":"activestorage","fixed":["8.0.5.2","8.1.4.1"],"affected":"< 8.0.5.2, >= 8.1, < 8.1.4.1","ecosystem":"rubygems"}],"ecosystems":[],"tags":["activestorage","imagemagick","mini_magick","package","rails","ruby","self-hosted","unauthenticated"],"not_affected_if":["activestorage-8.0.5.2-or-later","activestorage-8.1.4.1-or-later","libvips-processor","no-imagemagick-processing","no-untrusted-uploads"],"how_to_check":"- Check Gemfile.lock or run 'bundle exec gem list activestorage': affected is < 8.0.5.2 or >= 8.1, < 8.1.4.1.\n- Affected only if ALL hold: config.active_storage.variant_processor = :mini_magick (default for apps on load_defaults 6.1 or earlier); ImageMagick runs under a policy that does not deny the MSL/Ghostscript/file coders (Debian and Ubuntu packaged policies do not); the app accepts uploads from untrusted users.\n- Attaching the file is enough; no variant, preview or analyze call is needed.\n- Also check if you use ImageMagick via MiniMagick outside Active Storage: the fixed policy applies to every MiniMagick process, and apps that replace MiniMagick.cli_env, set cli_prefix or use a custom MiniMagick::Shell, or GraphicsMagick, do not get the shipped policy.\n- If Disk service was used, assume secret_key_base may have been read.","fix":"Upgrade activestorage (Rails) to 8.1.4.1 (8.1 line) or 8.0.5.2 (8.0 line). Apps with variant_processor :mini_magick need mini_magick >= 5.1 or boot raises. If you render PS/PDF via ImageMagick, re-allow the gs delegate in policy.xml. If attachments use the Disk service, rotate secret_key_base and every secret the app process can read (master key, credentials.yml.enc contents, DB/storage creds, third-party tokens). Workaround if you cannot upgrade: copy the rules from activestorage/lib/active_storage/image_magick/policy.xml into the system ImageMagick policy.xml (at minimum deny coder MSL, the Ghostscript coders PS/EPS/PDF/XPS/PCL etc., and delegate gs).","status":"open","published_at":"2026-11-04T15:17:42+00:00","first_seen_at":"2026-11-04T15:27:31+00:00","triaged_at":"2026-11-04T15:28:19+00:00","updated_at":"2026-11-04T15:29:54+00:00","category":"package","confidence":0.85,"triage":{"at":"2026-11-04T15:28:19Z","model":"claude-haiku-5-5","output":{"fix":"- activestorage gem: `8.1.4.1` or later","reach":"internet","title":"Rails ActiveStorage: ImageMagick attachments let an attacker read and write server files","impact":"high","summary":"The activestorage gem before 8.1.4.1 runs the ImageMagick analyzer when a file is attached, and no ImageMagick security policy blocks unintended ImageMagick functions. An attacker who can upload an image can make the server read and write files, such as the secret_key_base.","audience":"developers","category":"package","nicknames":[],"who_cares":["ruby","rails","activestorage","imagemagick","self-hosted"],"confidence":0.7,"fix_status":"available","needs_auth":"unknown","worst_case":"Server files readable and writable, including secret_key_base","analyst_note":"Confirm the exact attacker preconditions (whether upload needs an account) and the vendor advisory's details at the linked GitHub advisory.","how_to_check":"- Run `bundle exec gem list activestorage` or check `Gemfile.lock` for the activestorage version.\n- Check whether the app uses ImageMagick for variants or analysis (`config.active_storage.variant_processor = :mini_magick` or the `image_processing` gem).\n- Check whether an ImageMagick security policy file (policy.xml) is in place.","plain_action":"","needs_analyst":true,"not_affected_if":["activestorage-8.1.4.1-or-later","no-imagemagick-processing"],"who_is_affected":"Ruby on Rails applications that use ActiveStorage with ImageMagick to process attached files are exposed, because the analyzer runs as soon as a file is attached. Apps on activestorage 8.1.4.1 or later, or apps that do not process attachments with ImageMagick, are not affected by this flaw. Anyone who can upload a file to the app is the likely attack path.","user_interaction":"no","needs_special_setup":"yes","severity_if_unknown":"critical"},"cost_usd":0.000759,"input_tokens":4188,"output_tokens":681,"severity_before":"critical"},"analyst_status":"done","analyst_note":"Confirm the exact attacker preconditions (whether upload needs an account) and the vendor advisory's details at the linked GitHub advisory.","search":"'-122006':15A,18A '-2026':14A,17A '8.1.4.1':35B,79C 'activestorag':2A,20B,32B,76C 'activestorage':19A 'allow':90C 'analyz':39B,104C 'attach':4A,44B,86C,110C 'attack':7A,55B 'base':74B,100C 'block':50B,120C 'cve':13A,16A 'e.g':96C 'file':12A,42B,68B,108C 'function':53B,122C 'gem':33B,77C 'host':29B 'imag':60B 'imagemagick':3A,21B,38B,47B,52B,85C,103C,116C 'key':73B,99C 'let':5A 'magick':23B 'make':62B 'mini':22B 'occur':88C 'oper':95C 'packag':24B 'polici':49B,118C 'process':87C 'rail':1A,25B,83C 'read':8A,65B,92C,97C 'rubi':26B,81C 'run':36B,105C 'secret':72B,98C 'secur':48B,117C 'self':28B 'self-host':27B 'server':11A,64B,91C 'unauthent':30B 'unintend':51B,121C 'upload':58B 'write':10A,67B,94C","nicknames":[],"mitigations":[],"who_affected":"Rails apps that process Active Storage attachments with ImageMagick (variant_processor :mini_magick, the default for load_defaults 6.1 or earlier) on activestorage < 8.0.5.2 or >= 8.1 and < 8.1.4.1, under an ImageMagick policy that does not already deny the risky coders (Debian/Ubuntu defaults do not), and that accept uploads from untrusted users. Per the vendor, an unauthenticated attacker can write arbitrary files and, with the Disk service, read files such as secret_key_base, which can lead to remote code execution. Apps using libvips, no ImageMagick, or no untrusted uploads can skip it.","tier":"B","verified":{"fix":{"at":"2026-11-04T15:29:54Z","by":"analyst","doc":"https://github.com/rails/rails/releases/tag/v8.0.5.2","run_id":1674},"products":{"at":"2026-11-04T15:29:54Z","by":"analyst","doc":"https://github.com/rails/rails/releases/tag/v8.0.5.2","run_id":1674},"how_to_check":{"at":"2026-11-04T15:29:54Z","by":"analyst","doc":"https://github.com/rails/rails/releases/tag/v8.0.5.2","run_id":1674},"who_affected":{"at":"2026-11-04T15:29:54Z","by":"analyst","doc":"https://github.com/rails/rails/releases/tag/v8.0.5.2","run_id":1674}},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":["activestorage"],"ptokens":["activestorage"],"labels":["activestorage","critical","imagemagick","minimagick","package","rails","ruby","selfhosted","unauthenticated"],"campaign_type":null,"first_public_at":"2026-11-04T03:09:06+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","cvss_by":"cve@mitre.org","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-122006","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-122006","severity":null,"published_at":"2026-11-04T15:17:42+00:00","modified_at":"2026-11-04T15:17:42+00:00","first_seen_at":"2026-11-04T15:27:31+00:00","fetched_at":"2026-11-04T15:27:31+00:00","note":null},{"source":"analyst","external_id":"CVE-2026-122006:1674","url":null,"severity":null,"published_at":"2026-11-04T15:29:54+00:00","modified_at":"2026-11-04T15:29:54+00:00","first_seen_at":"2026-11-04T15:29:54+00:00","fetched_at":"2026-11-04T15:29:54+00:00","note":"Read GHSA-f3w6-w445-fwh9 and 8.0.5.2 release notes. Unauthenticated per vendor (upload must reach attach); fixed 8.0.5.2/8.1.4.1; reporter ryotak. NVD text says only 'before 8.1.4.1', vendor also lists 8.0 line. No exploitation or PoC checked/seen; older Rails lines unstated by vendor."}],"documents":[{"id":67840,"url":"https://github.com/rails/rails/releases/tag/v8.0.5.2","title":"Release notes: github.com","kind":"release","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release notes: github.com"},{"id":67841,"url":"https://github.com/rails/rails/releases/tag/v8.1.4.1","title":"Release notes: github.com","kind":"release","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release notes: github.com"},{"id":67842,"url":"https://github.com/rails/rails/security/advisories/GHSA-f3w6-w445-fwh9","title":"Vendor advisory: github.com","kind":"vendor","source":"nvd","publisher":"vendor","text":null,"published_at":"2026-11-04T03:09:06+00:00","relation":"advisory","confidence":null,"note":"Vendor advisory: github.com"}],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}