RC RANDOM CHAOS

Rails Active Storage Flaw Enables Arbitrary File Access

· via The Hacker News

Original source

Critical Rails Flaw Lets Attackers Write Server Files via Crafted ImageMagick Uploads

The Hacker News →

Ruby on Rails’ Active Storage contains a critical vulnerability (CVSS 9.8, GHSA-f3w6-w445-fwh9) that allows unauthenticated attackers to write arbitrary files on affected servers. Researchers at GMO Flatt Security discovered the flaw, which affects Rails versions before 8.1.4.1 and 8.0.5.2, and reported it through HackerOne.

The vulnerability stems from how Active Storage processes uploads through ImageMagick’s coder system. Coders are format handlers that ImageMagick selects based on file content—some can manipulate files beyond the upload itself. Active Storage previously imposed no restrictions on which coders could process uploads. Attackers exploit this by uploading a file that triggers the MSL coder, a scripting handler capable of reading and writing arbitrary files. Simply attaching the upload triggers the vulnerable analyzer; variant creation or preview generation is unnecessary. For deployments storing files locally via the Disk service, this exposure leaks secret keys and credentials, potentially enabling remote code execution or unauthorized access to connected systems.

Rails released fixes in versions 8.1.4.1 and 8.0.5.2, which introduce a hardened ImageMagick security policy blocking dangerous coders. These releases address 21 security issues collectively, including a companion flaw (GHSA-v924-7rp8-4mxh, CVSS 8.8) where temporary filenames retained uploaded file extensions, allowing decoder selection attacks. Immediate upgrade is critical for deployments using ImageMagick as the default variant processor and accepting untrusted file uploads. Organizations unable to upgrade should manually apply the policy rules to their ImageMagick configuration and rotate all secrets accessible to the application.

Read the full article

Continue reading at The Hacker News →

This is an AI-generated summary. Read the original for the full story.