CVE-2026-122006: Active Storage: Possible arbitrary file write and read in image analysis
Rails Active Storage lets an unauthenticated uploader write arbitrary files on the server, and read arbitrary files when the Disk service is used, if the app processes images with ImageMagick. Upgrade activestorage to 8.0.5.2 or 8.1.4.1. Files an attacker can read include `secret_key_base` and credentials.
Published Nov 12, 2026 · Analysis Nov 13, 2026
What an attacker can do
ImageMagick picks a coder from the content of the file it receives. Some coders act on other files named inside the image. Active Storage constrained none of them, and its ImageMagick analyzer runs at attach time. Attaching a crafted upload is enough. No variant, preview or analyze call is needed.
The attacker needs only an upload form that the app exposes to untrusted users. They can write files on the server. With Disk storage they can also read any file the app process can read. That usually includes secret_key_base, the master key and config/credentials.yml.enc contents, and third-party tokens. Those secrets can lead to remote code execution or movement into other systems. The reporter described one attack chain, and the Rails team says there may be others.
The fix ships an ImageMagick security policy. It denies the MSL scripting coder, coders that read or delete other files or fetch references, every Ghostscript-backed coder with the gs delegate, and @filename indirection. The Debian and Ubuntu default policies do not block these coders.
The EPSS score is 0.0074, and no source reports exploitation.
Who is affected
An app is affected only if it meets all three conditions:
- It uses ImageMagick for Active Storage, meaning
config.active_storage.variant_processor = :mini_magick. This is the default for apps onload_defaults 6.1or earlier. - ImageMagick runs under a policy that does not deny the coders involved.
- It accepts uploads from untrusted users.
Vulnerable gem versions: activestorage before 8.0.5.2, and 8.1.0.beta1 up to before 8.1.4.1. Check:
bundle list | grep -E "activestorage|mini_magick"activestorage
- Ecosystem
- RubyGems
- Affected
- >= 8.1.0.beta1, < 8.1.4.1
- Fixed in
- 8.1.4.1
- Check
bundle info activestorage
activestorage
- Ecosystem
- RubyGems
- Affected
- < 8.0.5.2
- Fixed in
- 8.0.5.2
- Check
bundle info activestorage
How to fix it
Upgrade activestorage to 8.0.5.2 or 8.1.4.1:
bundle update activestorageIf the processor is :mini_magick, you need mini_magick 5.1 or later. With an older one the app raises an exception at boot. Apps that render PostScript or PDF through ImageMagick must re-allow the gs delegate and needed coders in the host policy. Apps that replace MiniMagick.cli_env, clear the environment with MiniMagick.cli_prefix, or install their own MiniMagick::Shell do not get the shipped policy.
Workaround: copy the rules from activestorage/lib/active_storage/image_magick/policy.xml into the system policy, for example /etc/ImageMagick-7/policy.xml. At minimum deny the MSL coder, the gs delegate and the Ghostscript coders.
With Disk storage, rotate secret_key_base and every secret the app process can read. Do not keep an old secret as a fallback.
How to tell if you were hit
Review recent uploads for files that are not valid images or that contain ImageMagick scripting content, such as MSL or @filename references. Check the application and ImageMagick logs for errors from identify or convert around attach time. Look for unexpected new files on the app host, especially in web-served or code paths. If you stored attachments on Disk and ran an affected version with untrusted uploads, assume secrets were readable and rotate them.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Impact
A Rails application that processes attachments with ImageMagick may allow an unauthenticated attacker to write arbitrary files on the server and, when attachments are stored with the Disk service, to read arbitrary files readable by the application process. Those files typically include secret_key_base and credentials for external systems, which may in turn allow escalation to remote code execution or lateral movement to those systems.
Details
ImageMagick selects a coder from the content of the file it is given, and some coders act on files named inside the image rather than on the image itself. Active Storage constrained none of ImageMagick's coders, and the ImageMagick analyzer runs when a file is attached, so an attacker who can upload a crafted file may be able to invoke one. Attaching the upload is sufficient; no variant, preview, or analyze call is required. One specific attack chain has been reported to us, but we do not assume it is the only one that exists.
The fixed versions ship an ImageMagick security policy and prepend its directory to MAGICK_CONFIGURE_PATH through MiniMagick.cli_env, so every ImageMagick process that MiniMagick spawns applies it. The policy denies the MSL scripting coder, the coders that read or delete files other than the image, fetch remote or local references, or display to a screen, every coder backed by Ghostscript together with the gs delegate, and @filename indirection. ImageMagick applies every policy.xml on its search path, so the shipped policy adds to the host's policy rather than replacing it. The policy applies to every ImageMagick command that MiniMagick runs, not only those of Active Storage. See the activestorage CHANGELOG and "ImageMagick Security Policy" in the Active Storage guide.
Affected applications
An application is affected if it meets all of these requirements:
- Uses ImageMagick for Active Storage image processing. This is
config.active_storage.variant_processor = :mini_magick, which is the default for applications onload_defaults 6.1or earlier. - Runs ImageMagick under a security policy that does not already deny the coders involved. The policies that Debian and Ubuntu package do not.
- Allows file uploads from untrusted users.
Mitigation
- Upgrade to a fixed version of
activestorage. - An application whose variant processor is
:mini_magickmust use mini_magick>= 5.1, which applying the policy requires. With an older mini_magick, such an application raises an exception during boot. - An application that renders PostScript or PDF through ImageMagick must re-allow the
gsdelegate and the coders it uses in the host'spolicy.xml. - An application that replaces
MiniMagick.cli_envafter boot, clears the environment withMiniMagick.cli_prefix, or installs its ownMiniMagick::Shelldoes not receive the shipped policy and must carry its rules in ImageMagick's system policy. GraphicsMagick does not read ImageMagick policies. - If attachments are stored with the Disk service, change
secret_key_baseand every secret readable by the application process, including the master key and everythingconfig/credentials.yml.encholds, storage and database credentials, and third-party tokens. Do not retain an exposed secret as a fallback.
Workarounds
Copy the rules of the policy that the fixed versions ship, activestorage/lib/active_storage/image_magick/policy.xml, into ImageMagick's system policy, for example /etc/ImageMagick-7/policy.xml. At a minimum, deny the MSL coder, the Ghostscript coders, and the gs delegate:
<policy domain="coder" rights="none" pattern="MSL"/>
<policy domain="delegate" rights="none" pattern="gs"/>
<policy domain="coder" rights="none" pattern="{PS,PS2,PS3,EPS,EPS2,EPS3,EPI,EPSF,EPSI,EPT,EPT2,EPT3,PDF,AI,EPDF,PDFA,POCKETMOD,XPS,PCL}"/>Releases
The fixed releases are available at the normal locations.
Patches for those who cannot upgrade at once:
- 8.1: https://github.com/rails/rails/commit/468aa9a93fc98f5476b6821770f4ccfcb7f7d328
- 8.0: https://github.com/rails/rails/commit/ea8c40121ce53a3d0255cd4eb6d13bfe3bc01776
Versions affected
- activestorage < 8.0.5.2
- activestorage >= 8.1, < 8.1.4.1
Credit
This issue was responsibly reported by HackerOne researcher ryotak.
References
- ImageMagick security policy
Credited to Ry0taK.
Questions
- Does an attacker need to be logged in?
No. The advisory describes an unauthenticated attacker. It is enough that the app lets untrusted users upload a file that gets attached.
- Am I safe if I use the vips processor?
The advisory applies only to apps using ImageMagick through
:mini_magick. It lists that setting as the first requirement for being affected.- Which versions fix CVE-2026-122006?
activestorage 8.0.5.2 and 8.1.4.1. Versions before 8.0.5.2, and 8.1.0.beta1 up to before 8.1.4.1, are vulnerable.
- Do I need to rotate secrets after upgrading?
Yes, if you used the Disk service and untrusted uploads before patching. Rotate secret_key_base, the master key, credentials and third-party tokens.
References
Read for this analysis:
- https://github.com/rails/rails/security/advisories/GHSA-f3w6-w445-fwh9
- https://github.com/rails/rails/releases/tag/v8.1.4.1
- https://nvd.nist.gov/vuln/detail/CVE-2026-122006
- https://nvd.nist.gov/vuln/detail/CVE-2026-126082
- https://github.com/digitalocean/droplet-1-clicks/pull/488
- https://github.com/rubysec/ruby-advisory-db/pull/1300
- https://github.com/rails/rails/commit/468aa9a93fc98f5476b6821770f4ccfcb7f7d328
- https://github.com/rails/rails/commit/ea8c40121ce53a3d0255cd4eb6d13bfe3bc01776
- https://github.com/alan-turing-institute/cyber-threat-observatory/blob/main/reports/2026-11-04/TIER_2_CVE-2026-122006.md
- https://github.com/rails/rails/releases/tag/v8.0.5.2
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/activestorage/GHSA-f3w6-w445-fwh9.yml
- https://github.com/advisories/GHSA-f3w6-w445-fwh9
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
Coverage on the Beam blog
- CVE-2026-125396 Upload2Shell: Ghostscript -dSAFER Bypass via File Uploads
- GitHub MDASH Pilot: 99 AI-Verified Fixes for FastMCP, Express, and ImageMagick
- REDCap CVE-2026-90817: CISA KEV Unauthenticated RCE via Public Surveys
- CVE-2026-115731: Puppet Enterprise KEV Deserialization RCE on Puppet Server
- CVE-2026-122006: Rails Active Storage ImageMagick Arbitrary File Read and Write
More RubyGems vulnerabilities
All RubyGems entriesCVE-2026-126084
Active Storage: Unsigned Content-Type in GCS direct uploads with cache_control
medium4.7Nov 12, 2026CVE-2026-126188
Active Storage: Possible local file disclosure in video previews and analysis
low3.7Nov 12, 2026CVE-2026-126071
Active Storage: Possible DoS vulnerability in Active Storage proxy mode via storage errors during streaming
medium5.3Nov 10, 2026CVE-2026-126074
Active Storage: Possible DoS vulnerability in Active Storage filename handling
medium4.3Nov 10, 2026CVE-2026-126085
Active Storage: Possible circumvention of file size limits in Active Storage direct uploads to Google Cloud Storage
medium5.3Nov 10, 2026CVE-2026-126186
Active Storage: Possible arbitrary file read and remote code execution in video previews, analysis and image processing
high8.8Nov 10, 2026
