CVE-2022-21831: Code Injection
The Active Storage module of Rails starting with version 5.2.0 is possibly vulnerable to code injection. This issue was patched in versions 5.2.6.3, 6.0.4.7, 6.1.4.7, and 7.0.2.3. To work around this issue, applications should implement a strict allow-list on accepted transformation methods or arguments. Additionally, a strict ImageMagick security policy will help mitigate this issue.
Other sources
A code injection vulnerability exists in the Active Storage >= v5.2.0 that could allow an attacker to execute code via imageprocessing arguments.
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
rubygems/activestorageto a version that resolves this vulnerability.Fixed in 7.0.2.3 - Upgrade
Upgrade
rubygems/activestorageto a version that resolves this vulnerability.Fixed in 6.1.4.7 - Upgrade
Upgrade
rubygems/activestorageto a version that resolves this vulnerability.Fixed in 6.0.4.7 - Upgrade
Upgrade
rubygems/activestorageto a version that resolves this vulnerability.Fixed in 5.2.6.3 - Upgrade
Upgrade
debian/railsto a version that resolves this vulnerability.Fixed in 2:6.1.4.7+dfsg-1 - Upgrade
Upgrade
debian/railsto a version that resolves this vulnerability.Fixed in 2:6.1.7.10+dfsg-1~deb12u2Fixed in 2:6.1.7.10+dfsg-1~deb12u3Fixed in 2:7.2.2.2+dfsg-2~deb13u1Fixed in 2:7.2.2.2+dfsg-2~deb13u2Fixed in 2:7.2.4+dfsg-2 - Upgrade
Upgrade
Rails Active Storageto a version that resolves this vulnerability.Fixed in 5.2.6.3 - Upgrade
Upgrade
Rails Active Storageto a version that resolves this vulnerability.Fixed in 6.0.4.7 - Upgrade
Upgrade
Rails Active Storageto a version that resolves this vulnerability.Fixed in 6.1.4.7 - Upgrade
Upgrade
Rails Active Storageto a version that resolves this vulnerability.Fixed in 7.0.2.3 - Configuration
Implement a strict allow-list for accepted transformation methods or arguments.
Application image transformation handling accepted transformation methods or arguments = strict allow-list - Compensating control
Implement a strict ImageMagick security policy to mitigate the code injection issue.
Event History
Frequently Asked Questions
What is the severity of CVE-2022-21831?
The severity of CVE-2022-21831 is critical with a CVSS score of 9.8.
Which versions of Rails are affected by CVE-2022-21831?
Versions 5.2.0 to 5.2.6.2, 6.0.0 to 6.0.4.6, 6.1.0 to 6.1.4.6, and 7.0.0 to 7.0.2.2 of Rails are affected by CVE-2022-21831.
How can I mitigate the code injection vulnerability in Active Storage?
To mitigate the code injection vulnerability in Active Storage, update to versions 5.2.6.3, 6.0.4.7, 6.1.4.7, or 7.0.2.3 of Rails.
Is there a workaround for CVE-2022-21831?
Implementing a strict allow-list on accepted transformation methods or arguments can serve as a workaround for CVE-2022-21831.
Where can I find more information about CVE-2022-21831?
More information about CVE-2022-21831 can be found at the following references: [NVD](https://nvd.nist.gov/vuln/detail/CVE-2022-21831), [Github Commit](https://github.com/rails/rails/commit/0a72f7d670e9aa77a0bb8584cb1411ddabb7546e), [Google Groups](https://groups.google.com/g/rubyonrails-security/c/n-p-W1yxatI).