CVE-2022-21831:
Possible code injection vulnerability in Rails / Active Storage
9.8
CVSS ScoreBasic Information
CVE ID
GHSA ID
EPSS Score
-
CWE
Published
3/8/2022
Updated
3/22/2023
KEV Status
No
Technology
Ruby
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
activestorage | rubygems | >= 5.2.0, <= 5.2.6.2 | 5.2.6.3 |
activestorage | rubygems | >= 6.0.0, <= 6.0.4.6 | 6.0.4.7 |
activestorage | rubygems | >= 6.1.0, <= 6.1.4.6 | 6.1.4.7 |
activestorage | rubygems | >= 7.0.0, <= 7.0.2.2 | 7.0.2.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from unvalidated processing of image transformation parameters. The operations
method iterated over transformations and built ImageMagick commands without checking if the method names/arguments were safe. The patch added validation logic (validate_transformation) to this method, confirming this was the injection point. Pre-patch versions allowed dangerous arguments like '-write /tmp/file.erb' to be passed directly to ImageMagick.