Cloudanix VulnDB

CVE-2022-21831

Critical · 9.8

CVSS

9.8

EPSS

3.1%

Published

May 26, 2022

CISA due date

—

Cloudanix analysis

Act now SSVC: Track

A flaw in how web applications handle uploaded images can let attackers run their own programs on the server without any login, potentially stealing data or taking over the system.

Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
Low
Impact
Remote Code Execution
Component
Web Framework
Class
RCE
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Remote attacker can inject and execute arbitrary code by supplying malicious arguments to the image_processing library through Active Storage uploads.

Why it matters to the business

Successful exploitation grants full control over the affected application server, enabling theft of sensitive data, deployment of persistent malware, or disruption of operations; the vulnerability has remained unpatched in listed distributions for over four years, increasing long-term exposure risk for dependent applications.

How an attack unfolds

An attacker crafts a malicious image upload request that includes specially formatted image_processing parameters; when the server processes the upload, the injected arguments are passed directly to the underlying image library, resulting in code execution within the application context.

How to fix it

Upgrade Active Storage to a version that sanitizes image_processing arguments; apply vendor-supplied patches or migrate away from the vulnerable component if no fixed package version is available; restrict or disable image processing features until patched.

How to confirm the fix worked

Review application dependencies for Active Storage versions >= 5.2.0, test upload endpoints with known-safe processing arguments, and confirm that malicious parameter injection no longer results in code execution.

Typical attack path

  1. Identify an endpoint accepting file uploads that uses Active Storage image processing
  2. Craft a request containing an image file accompanied by malicious image_processing arguments
  3. Submit the request to trigger server-side processing
  4. Achieve arbitrary code execution on the host

How to detect it

Inspect web server and application logs for image upload requests containing unusual or command-like values in processing parameters; correlate with process execution logs showing unexpected commands spawned during image handling.

  • image_processing arguments containing shell metacharacters or system commands
  • unexpected child processes spawned by the Rails application during upload handling

What your security team should do

  • Prioritize patching or replacing Active Storage in all internet-facing applications
  • Implement input validation and sandboxing around image processing calls
  • Monitor dependency graphs for downstream usage of the affected gem
  • Conduct targeted scans for unpatched Debian packages containing the vulnerable code

The record

A code injection vulnerability exists in the Active Storage >= v5.2.0 that could allow an attacker to execute code via image_processing arguments.

Affected packages

Ecosystem Package Introduced Fixed
RubyGems activestorage 5.2.0 5.2.6.3
RubyGems activestorage 6.0.0 6.0.4.7
RubyGems activestorage 6.1.0 6.1.4.7
RubyGems activestorage 7.0.0 7.0.2.3
Debian:10 rails 0 2:5.2.2.1+dfsg-1+deb10u4
Debian:11 rails 0 2:6.0.3.7+dfsg-2+deb11u1
Debian:12 rails 0 2:6.1.4.7+dfsg-1
Debian:13 rails 0 2:6.1.4.7+dfsg-1
Ubuntu:20.04:LTS rails 0 No fix
Ubuntu:22.04:LTS rails 0 No fix
Ubuntu:24.04:LTS rails 0 No fix
Ubuntu:24.10 rails 0 No fix
Ubuntu:25.04 rails 0 No fix
Ubuntu:25.10 rails 0 No fix
Ubuntu:Pro:16.04:LTS rails 0 No fix
Ubuntu:Pro:18.04:LTS rails 0 No fix
Ubuntu:Pro:20.04:LTS rails 0 No fix
Ubuntu:Pro:22.04:LTS rails 0 No fix
gem activestorage 5.2.0 5.2.6.3
gem activestorage 6.0.0 6.0.4.7
gem activestorage 6.1.0 6.1.4.7
gem activestorage 7.0.0 7.0.2.3
openSUSE:Tumbleweed ruby3.2-rubygem-activestorage-7.0 0 7.0.4.3-1.1
openSUSE:Tumbleweed rubygem-activestorage-7.0 0 7.0.2.3-1.1
openSUSE:Tumbleweed rubygem-activestorage-7.0 0 7.0.8.4-1.1
openSUSE:Tumbleweed rubygem-activestorage-7.0 0 7.0.8.6-1.3

Related vulnerabilities