The Hacker News
Il y a 17 heures
Critical Rails Flaw Lets Attackers Write Server Files via Crafted ImageMagick Uploads
Par [email protected] (The Hacker News)

A critical flaw in Ruby on Rails could allow an unauthenticated attacker to write arbitrary files on an app's server by uploading a crafted file if the app processes uploads using ImageMagick. The Rails project disclosed the flaw in an advisory and fixed it in versions 8.1.4.1 and 8.0.5.2. The flaw is in Active Storage, the part of Rails that handles file uploads. Some apps store
Critical Rails Flaw Lets Attackers Write Server Files via Crafted ImageMagick Uploads
Swati KhandelwalNov 04, 2026Vulnerability / Web Security
A critical flaw in Ruby on Rails could allow an unauthenticated attacker to write arbitrary files on an app's server by uploading a crafted file if the app processes uploads using ImageMagick. The Rails project disclosed the flaw in an advisory and fixed it in versions 8.1.4.1 and 8.0.5.2.
The flaw is in Active Storage, the part of Rails that handles file uploads. Some apps store uploaded files using Active Storage's Disk service, which stores them on the server's disk. In those apps, an attacker could also read any file the app can read.
Those files typically include the app's secret_key_base and its credentials for other systems, according to Rails. Reading them may in turn allow remote code execution or lateral movement into those systems.
Rails rates the flaw 9.8 out of 10 on the CVSS scale. It is tracked as GHSA-f3w6-w445-fwh9 and does not yet have a CVE identifier.
ImageMagick selects a format handler, which it calls a coder, based on the file's content. Some coders act on other files named inside the image, not on the image itself. Active Storage imposes no limits on which coders an upload can use, so the server's own ImageMagick policy was the only limit.
The ImageMagick analyzer in Active Storage runs when a file is attached. Attaching the upload is enough to reach the flaw. The app does not have to make a variant (a transformed copy of the image) or a preview, or call analyze.
An uploaded SVG file reached ImageMagick's MSL coder through that analyzer, according to the commit that fixed the flaw. MSL is a scripting coder that reads and writes files named by its script.
Rails said one attack chain was reported to it, but it does "not assume it is the only one that exists." The advisory does not say whether the flaw has been exploited.
The flaw was reported through HackerOne by RyotaK, a researcher at GMO Flatt Security.
An app is affected only if all three of these are true:
It uses ImageMagick for Active Storage image processing. That is the setting config.active_storage.variant_processor = :mini_magick, the default for apps on load_defaults 6.1 or earlier.
Its ImageMagick security policy does not already block the coders involved. Rails says the policies that Debian and Ubuntu ship do not.
It accepts file uploads from untrusted users.
To check the first condition, look at config.active_storage.variant_processor. If it is not set, the default depends on load_defaults: :mini_magick before 7.0, and :vips from 7.0 on. The same setting decides which library analyzes uploads, not only which one makes variants.
Every Active Storage version before 8.0.5.2 is affected, as are 8.1 versions before 8.1.4.1. Release series older than 8.0 are no longer supported, and Rails will not release fixed versions for them.
In July, Rails fixed a different critical Active Storage flaw, CVE-2026-66066, which affected apps that use libvips instead of ImageMagick. Apps using ImageMagick were not exposed to that flaw's attack path, but they can be exposed to this one.
The same releases fix a second Active Storage flaw, GHSA-v924-7rp8-4mxh, which Rails rates high with a CVSS score of 8.8. Active Storage passed uploads to ImageMagick and FFmpeg under temporary file names that kept the uploaded file's extension.
Those tools can pick a decoder from the extension when a file's content does not show its format. So an attacker who chose an upload's filename and declared its content type could choose the decoder that processes it.
Rails strongly recommends upgrading as soon as possible. The two releases fix 21 security issues in total.
The fixed versions ship an ImageMagick security policy. MiniMagick is the Ruby gem Active Storage uses to call ImageMagick. In its default setup, every ImageMagick command it runs applies the policy, not only commands from Active Storage.
The policy blocks the MSL coder; coders that read or delete files other than the image; coders that fetch remote or local references or display them on a screen; every coder backed by Ghostscript, along with the gs delegate; and @filename indirection.
Upgrade to Rails 8.1.4.1 or 8.0.5.2. Apps on :mini_magick also need mini_magick 5.1 or later, or they raise an error at boot. Rails 8.0 gets security fixes only until November 7, 2026, under its maintenance policy.
Confirm that the app loads the new policy, as the Active Storage guide describes, by running bin/rails runner 'puts MiniMagick.identify { |i| i.list "policy" }'.
Check whether the shipped policy reaches the app at all. It does not reach an app that replaces MiniMagick.cli_env after boot, clears the environment with MiniMagick.cli_prefix, or installs its own MiniMagick::Shell. Such an app must put the rules in ImageMagick's system policy.
Apps that use GraphicsMagick get no protection from the shipped policy, because GraphicsMagick does not read ImageMagick policies.
Check the server's own ImageMagick policy. The shipped policy adds to it rather than replacing it. A rule there that allows a coder, including a wildcard such as pattern="*", overrides the shipped policy's block on that coder.
If the app renders PDF or PostScript files through ImageMagick, re-allow the gs delegate and the coders it uses in the server's policy.xml.
If you cannot upgrade yet, copy the rules of the shipped policy, activestorage/lib/active_storage/image_magick/policy.xml, into ImageMagick's system policy, such as /etc/ImageMagick-7/policy.xml. At a minimum, block the MSL coder, the Ghostscript coders, and the gs delegate. Rails also published the fix as patches for 8.1 and 8.0.
Apps on release series older than 8.0 can use that workaround or upgrade to 8.0 or later.
Rails' workarounds for the second flaw only change how FFmpeg is used. None of them covers ImageMagick.
If the app stores attachments with the Disk service, change secret_key_base and every other secret the app process can read. That includes the master key, everything config/credentials.yml.enc holds, storage and database credentials, and third-party tokens. Do not keep an exposed secret as a fallback.
The advisory does not explain how to check whether an app has already been targeted.
Found this article interesting? Follow us on Google News, Twitter and LinkedIn to read more exclusive content we post.
Application Security, Ruby on Rails, Vulnerability, Web Security
PHP2Shell Attack Roots 25 Servers, Breaches U.S. Government-Affiliated Network
Anthropic's Unreleased AI Model Chains Flaws Into Working Chrome, Safari, Windows and Linux Exploits
Microsoft 365 Token-Replay Attacks Compromise 97 Accounts at 79 Organizations
China-Linked Hackers Exploited VMware ESX Zero-Day to Reduce Audit Trail Visibility
Attackers Exploit PHP2Shell Flaws in Internet-Exposed Palo Alto Networks Management Interfaces
Linux Kernel TCP Flaw With 9.8 CVSS Score Affects Ubuntu, Red Hat and Other Distributions
Leaked LiteLLM Master Key Let Attackers Steal GitHub Tokens and Hijack Release Pipeline
Chinese Hackers Use AI-Powered ARTEX to Target Over 200 Organizations Worldwide
American Organizations Under Attack: Skyw4lker Device Code Phishing Campaign Exposed
Brotli Decoder Flaw Behind Node.js RCE Also Affects Bun, Python and Other Widely Used Software
GoAhead TLS Flaws Allow Revoked Client Certificates and Enable Session Decryption
AI-Generated Fake Login Pages Are Making Account Takeovers Easier
TeamViewer Flaw Lets Remote Computers Attack Users Who Connect to Control Them
PHP Issues Second Windows Security Update in Five Days to Fix Brotli Code Execution Flaw
Binance Suffers Security Breach Affecting $6.3 Billion in Assets, Nearly $3 Billion Frozen
Why Urgent Security Fixes Aren't Fixed. Observe, Prove, Act, Confirm Gets Them Moving
ThreatsDay: Critical Firewall Flaws, Banking Trojans Rented, Weaponized PDF, Token Theft + 26 More Stories
Cisco Patches Actively Exploited ASA and FTD VPN Flaw That Can Crash Firewalls
Microsoft Authenticator Flaw Let Permissionless Android Apps Steal Work Account Tokens
The Rise of the Threat Operator: How AI Will Redefine Security Operations and Careers
CyberStrikeAI Uses 44 AI Agents to Automate Hacking Operations Against Japan Targets
Unpatched Tailscale SSH Flaws Could Let a Hacked Device Reach Root on Other Servers
Critical 16-Year-Old UEFI Flaw Can Run Code Before Secure Boot on Network-Booting Servers
Official Claude Code Extension on Cursor Marketplace Trojanized with Persistent SSH Backdoor
See How Bitdefender GravityZone Identifies Shadow AI and Prioritizes Endpoint Risks
Assess Your Organization's AI Code Sprawl Exposure With This Practical Guide
Beyond CVE Scanning: Book a Demo of Continuous AI-Powered Web Pentesting
Detect Lateral Movement and Evasive Attacks With Corelight's Open NDR Platform
Your SOC Has an Identity Blind Spot. Here's How to Fix It
Learn how to close critical identity visibility gaps in your SOC, detect hidden threats, and accelerate incident response across human, machine, and AI identities.
Register for Free Roadmap for AI-Ready Security Operations
Evaluate Attack Surface Visibility With an AI Threat Readiness Framework
Learn how to assess AI threat readiness, strengthen attack surface visibility, and prepare security operations for emerging threats in this practical webinar.
Governance Sets the Ceiling on Your AI Security Program
See the five moves that raise a Stage 2 Govern score to a defensible Stage 3.
11 Real Stories: How Identity Exposure Unlocks Active Attack Paths
Map cross-domain privilege escalation to sever breach routes at key choke points.
BeyondTrust an 8X Gartner® Magic Quadrant™ Leader for PAM
Gain clarity on the PAM market and understand why BeyondTrust is again a Leader.
Uncover Identity Dark Matter: SACR Research Brief
Eliminate the blind spots undermining your security. Download the SACR brief.
Your Attack Surface Is Growing Faster Than Your Team Can Respond
PEDM vs. Standing Elevated Privileges: Control Access Without Flooding the Helpdesk
The MSP Margin Math Nobody's Doing: Your Next Technician Might Already be on Payroll
Why Root and Jailbreak Detection Alone Cannot Guarantee Mobile App Security
Publié le 4 novembre 2026
Source originale : The Hacker News
