Rails 8.1.4.1 and 8.0.5.2 Fix 21 Security Issues, Led by a Critical Active Storage ImageMagick File-Write Flaw, GHSA-f3w6-w445-fwh9
Rails says 8.1.4.1 and 8.0.5.2 fix 21 issues; the advisory for the Critical one says a crafted upload may let an unauthenticated attacker write files via ImageMagick.
Overview
The Rails project released versions 8.1.4.1 and 8.0.5.2, which according to the oss-security announcement address 21 security issues. The one the announcement lists as Critical is GHSA-f3w6-w445-fwh9, a flaw in Active Storage image analysis that, per the advisory, may allow an unauthenticated attacker to write arbitrary files on the server of an application that processes attachments with ImageMagick. The Hacker News reports that the flaw “does not yet have a CVE identifier.”
What the Critical Advisory Says
According to the advisory, 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. The advisory states that Active Storage constrained none of ImageMagick’s coders, and that the ImageMagick analyzer runs when a file is attached: “Attaching the upload is sufficient; no variant, preview, or analyze call is required.”
When attachments are stored with the Disk service, the advisory adds, an attacker may also be able to read arbitrary files readable by the application process. Those files typically include secret_key_base and credentials for external systems, which the advisory says may in turn allow escalation to remote code execution or lateral movement to those systems. The advisory says “One specific attack chain has been reported to us, but we do not assume it is the only one that exists.”
The Hacker News reports, citing the commit that fixed the flaw, that an uploaded SVG file reached ImageMagick’s MSL coder through that analyzer, and describes MSL as a scripting coder that reads and writes files named by its script. The advisory credits the report to HackerOne researcher ryotak; The Hacker News describes the researcher as working at GMO Flatt Security.
Affected Versions and Conditions
The advisory lists activestorage before 8.0.5.2 and versions from 8.1 up to but not including 8.1.4.1 as affected. An application is affected only if it meets all three of these requirements, according to the advisory:
- It uses ImageMagick for Active Storage image processing, which is
config.active_storage.variant_processor = :mini_magickand the default for applications onload_defaults 6.1or earlier. - It runs ImageMagick under a security policy that does not already deny the coders involved; the advisory says the policies that Debian and Ubuntu package do not.
- It allows file uploads from untrusted users.
The GitHub advisory lists a CVSS score of 9.8 and a severity of critical, and The Hacker News says Rails rates the flaw 9.8 out of 10. According to the oss-security announcement, older Rails versions are unsupported, and security support for the 8.0 series ends on November 7, 2026.
The Fix and Mitigations
The advisory says 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, every coder backed by Ghostscript together with the gs delegate, and @filename indirection, among other restrictions listed in the advisory.
Other steps the advisory describes:
- An application whose variant processor is
:mini_magickmust use mini_magick>= 5.1; with an older mini_magick, the advisory says the 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, the advisory says to change
secret_key_baseand every secret readable by the application process. - Applications that cannot upgrade can copy the rules of the shipped policy into ImageMagick’s system policy; the advisory links patches for 8.1 and 8.0.
The Other Advisories in the Release
The Hacker News names a second Active Storage advisory fixed in the same releases. GHSA-v924-7rp8-4mxh, titled “Possible arbitrary file read and remote code execution in Active Storage video previews, analysis and image processing,” is listed as High in the announcement and shows a CVSS score of 8.8. According to that advisory, ffprobe, ffmpeg and ImageMagick select a decoder from the file extension when the content does not identify its own format, so an attacker who chooses the filename and declares the content type of an upload chooses which decoder processes it. The advisory says the AviSynth attack path additionally requires an FFmpeg built with --enable-avisynth and the AviSynthPlus runtime on the host, and that the credited reporter is HackerOne researcher pirikara.
Counting the severity labels in the oss-security list, the Herald’s own tally is one Critical, four High, thirteen Medium and three Low entries, which sums to the announced 21. The four High entries are the Active Storage advisory above, a Strong Parameters bypass in Parameters#each_key in Action Pack (GHSA-wm3x-v3qw-4jh3), IP spoofing in Action Dispatch RemoteIp marked 8.1 only (GHSA-2gff-2mmg-m73p), and a denial-of-service issue in Active Support safe_constantize (GHSA-8474-xrp6-wh69), all as labelled in the announcement.
Relation to the Earlier Active Storage Flaw
The Herald previously reported on a different critical Active Storage flaw, CVE-2026-66066. The Hacker News says that flaw affected apps that use libvips instead of ImageMagick, and that apps using ImageMagick were not exposed to that flaw’s attack path but can be exposed to this one.
What We Don’t Know
The Hacker News notes that the advisory does not say whether the flaw has been exploited, and that the advisory does not explain how to check whether an app has already been targeted. The sources reviewed do not give a count of affected applications. The Hacker News is the only outlet cited here that is independent of the Rails project.