Rails 8.1.4.1 and 8.0.5.2 Patch Critical ImageMagick File Write Flaw

4 min read
Source: The Hacker News
Rails 8.1.4.1 and 8.0.5.2 Patch Critical ImageMagick File Write Flaw
Photo: The Hacker News
TL;DR

Ruby on Rails has released versions 8.1.4.1 and 8.0.5.2 to fix a critical vulnerability in Active Storage that allows unauthenticated attackers to write arbitrary files on servers. The flaw, rated 9.8 on the CVSS scale, is triggered when apps use ImageMagick for image processing and accept uploads from untrusted users. It is tracked as GHSA-f3w6-w445-fwh9 and lacks a CVE identifier. The issue stems from Active Storage’s analyzer running on file attachment, which can invoke ImageMagick’s MSL coder to read or write files. Apps using the Disk service are also at risk of having their secret_key_base and other credentials read, potentially leading to remote code execution. The fix includes a new ImageMagick security policy that blocks dangerous coders. Rails strongly recommends immediate upgrades, noting that the releases also address a second high-severity flaw involving FFmpeg and temporary file names.

Key points

  • The vulnerability allows unauthenticated attackers to write arbitrary files on the server by uploading crafted files that trigger ImageMagick’s MSL coder.
  • The flaw is rated 9.8 out of 10 on the CVSS scale and is tracked as GHSA-f3w6-w445-fwh9, with no assigned CVE identifier.
  • Apps using Active Storage’s Disk service are at risk of having their secret_key_base and other credentials read, which could enable remote code execution or lateral movement.
  • The fix is included in Rails versions 8.1.4.1 and 8.0.5.2, which also address a second high-severity flaw (GHSA-v924-7rp8-4mxh) involving FFmpeg and temporary file names.
  • Apps must upgrade to mini_magick 5.1 or later to avoid boot errors, and must verify that the new ImageMagick security policy is loaded correctly.
  • Apps using GraphicsMagick are not protected by the shipped policy, and apps on release series older than 8.0 are no longer supported for security fixes.

Background

This vulnerability follows a pattern of critical flaws in file handling and image processing libraries seen in recent months. In September 2026, WordPress patched a critical path traversal flaw (CVE-2026-87902) that allowed unauthenticated attackers to load arbitrary PHP files, with exploitation attempts surging within hours of disclosure. In October 2026, GitLab patched a critical regex flaw (CVE-2026-110264) in Ruby’s Onigmo engine that allowed unauthenticated remote code execution, affecting all versions since 2014. The current Rails flaw is distinct but shares the characteristic of being unauthenticated and potentially leading to remote code execution or credential theft, highlighting the ongoing risk in file upload and image processing pipelines.

Why it matters

The vulnerability poses a severe risk to any Rails application using ImageMagick for image processing and accepting uploads from untrusted users, as it allows attackers to write arbitrary files and potentially read sensitive credentials. The lack of a CVE identifier and the fact that the advisory does not confirm exploitation make it difficult to assess the immediate threat, but the high CVSS score and the potential for remote code execution or lateral movement necessitate urgent action. The fix requires not only upgrading Rails but also ensuring that the new ImageMagick security policy is correctly loaded, which may be complex for apps that customize MiniMagick or use GraphicsMagick. The vulnerability also underscores the importance of regular security updates and the risks associated with using default configurations that may not adequately restrict dangerous coders in image processing libraries.

What to watch

Rails strongly recommends upgrading to versions 8.1.4.1 or 8.0.5.2 as soon as possible. Apps using the Disk service should change their secret_key_base and all other secrets that the app process can read, including the master key, credentials in config/credentials.yml.enc, storage and database credentials, and third-party tokens. Apps that cannot upgrade immediately should copy the rules from the shipped policy into ImageMagick’s system policy, at a minimum blocking the MSL coder, Ghostscript coders, and the gs delegate. Rails 8.0 will receive security fixes only until November 7, 2026, under its maintenance policy. Apps on release series older than 8.0 are no longer supported and must upgrade to 8.0 or later or use the workaround. The advisory does not provide a method to check whether an app has already been targeted, so proactive measures are essential.

Share this article

Want the full story? Read the original reporting

Read on The Hacker News