# CVE-2026-122006: Active Storage: Possible arbitrary file write and read in image analysis

- **Severity:** CRITICAL 9.8
- **CVSS:** 9.8 (v3.0, GitHub) `CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.72% (percentile 50, 2026-11-28)
- **CWE:** CWE-1188
- **Aliases:** GHSA-f3w6-w445-fwh9
- **Published:** 2026-11-12T23:46:51.000Z
- **Modified:** 2026-11-12T23:46:52.000Z

## Who should check

- Projects that depend on RubyGems package activestorage (\>= 8.1.0.beta1, \< 8.1.4.1)

## Description

\#\#\# 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 on \`load\_defaults 6.1\` or 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\_magick\` must 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 \`gs\` delegate and the coders it uses in the host's \`policy.xml\`.
- An application that replaces \`MiniMagick.cli\_env\` after boot, clears the environment with \`MiniMagick.cli\_prefix\`, or installs its own \`MiniMagick::Shell\` does 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\_base\` and every secret readable by the application process, including the master key and everything \`config/credentials.yml.enc\` holds, 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:

\`\`\`xml
\<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\](https://hackerone.com/ryotak).

\#\#\# References
- ImageMagick \[security policy\](https://imagemagick.org/security-policy/)

## Affected and fixed versions

- RubyGems `activestorage`: affected \>= 8.1.0.beta1, \< 8.1.4.1; fixed 8.1.4.1, 8.0.5.2 (ghsa)

## Technologies

Ruby on Rails, RubyGems

## Mitigation

- Upgrade activestorage to one of 8.1.4.1, 8.0.5.2 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-122006. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-122006.md
Affected: activestorage >= 8.1.0.beta1, < 8.1.4.1
Fixed in: 8.1.4.1, 8.0.5.2

Steps:
1. Search this machine and project for activestorage (RubyGems): dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-122006 being exploited?

There is no confirmed exploitation: CVE-2026-122006 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.72% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2026-122006?

Critical: CVSS 9.8 (v3.0, scored by GitHub). Remote, no login needed.

### Which versions are affected by CVE-2026-122006?

activestorage \>= 8.1.0.beta1, \< 8.1.4.1.

### Is there a fix for CVE-2026-122006?

Yes. Fixed in 8.1.4.1, 8.0.5.2. Upgrade activestorage to one of 8.1.4.1, 8.0.5.2 (or later in the same release line).

### How do I check if I'm affected by CVE-2026-122006?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/rails/rails/security/advisories/GHSA-f3w6-w445-fwh9>
- patch: <https://github.com/digitalocean/droplet-1-clicks/pull/488>
- patch: <https://github.com/rubysec/ruby-advisory-db/pull/1300>
- patch: <https://github.com/rails/rails/commit/468aa9a93fc98f5476b6821770f4ccfcb7f7d328>
- patch: <https://github.com/rails/rails/commit/ea8c40121ce53a3d0255cd4eb6d13bfe3bc01776>
- other: <https://nvd.nist.gov/vuln/detail/CVE-2026-122006>
- other: <https://nvd.nist.gov/vuln/detail/CVE-2026-126082>
- other: <https://github.com/alan-turing-institute/cyber-threat-observatory/blob/main/reports/2026-11-04/TIER_2_CVE-2026-122006.md>
- other: <https://github.com/rails/rails/releases/tag/v8.0.5.2>
- other: <https://github.com/rails/rails/releases/tag/v8.1.4.1>
- other: <https://github.com/rubysec/ruby-advisory-db/blob/master/gems/activestorage/GHSA-f3w6-w445-fwh9.yml>
- other: <https://github.com/advisories/GHSA-f3w6-w445-fwh9>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- GitHub Advisory Database: CC-BY 4.0 <https://github.com/advisories/GHSA-f3w6-w445-fwh9> (license: <https://creativecommons.org/licenses/by/4.0/>)
- FIRST EPSS: EPSS scores by FIRST <https://www.first.org/epss/>

HTML: <https://flawdb.com/CVE-2026-122006> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-122006>
