---
id: "CVE-2026-122006"
kind: "vulnerability"
aliases: ["CVE-2026-122006"]
title: "Rails ActiveStorage: ImageMagick attachments let an attacker read and write server files"
severity: "critical"
cvss: 9.8
epss: null
exploited: false
status: "open"
category: "package"
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"]
published_at: "2026-11-04T15:17:42+00:00"
first_seen_at: "2026-11-04T15:27:31+00:00"
updated_at: "2026-11-04T15:29:54+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-122006", "first_seen_at": "2026-11-04T15:27:31+00:00"}, {"source": "analyst", "url": null, "first_seen_at": "2026-11-04T15:29:54+00:00"}]
---

# Rails ActiveStorage: ImageMagick attachments let an attacker read and write server files

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.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- rubygems:activestorage affected < 8.0.5.2, >= 8.1, < 8.1.4.1 fixed 8.0.5.2, 8.1.4.1

## 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.
- 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.
- Attaching the file is enough; no variant, preview or analyze call is needed.
- 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.
- 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).

## Timeline

- 2026-11-04T15:27:31+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-122006
- 2026-11-04T15:29:54+00:00 analyst — 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

- [advisory] Vendor advisory: github.com https://github.com/rails/rails/security/advisories/GHSA-f3w6-w445-fwh9
- [fix] Release notes: github.com https://github.com/rails/rails/releases/tag/v8.0.5.2
- [fix] Release notes: github.com https://github.com/rails/rails/releases/tag/v8.1.4.1

## From the sources

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.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
