cve.bz

CVE-2022-21831 Code Injection

9.8 criticalEPSS 3.1%Fix available

Critical (9.8). EPSS 3.1% estimated probability of exploitation activity in the next 30 days. Fixed in activestorage 5.2.6.3, 6.0.4.7, 6.1.4.7.

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

Severity

CVSS 3.1

9.8 critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS
3.1% (unchanged from 3.1% a week ago; 3.1% 30 days ago) estimated probability of exploitation activity in the next 30 days; 88th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CWE
CWE-94 Improper Control of Generation of Code (Code Injection)
OWASP Top 10
A05:2025 Injection
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2022-21831 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2022-21831?via=ask-ai-copy and https://cve.bz/cve/CVE-2022-21831?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2022-21831 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
rubyonrails:active_storagefrom 5.2.0 before 5.2.6.3
rubyonrails:active_storagefrom 6.0.0 before 6.0.4.7
rubyonrails:active_storagefrom 6.1.0 before 6.1.4.7
rubyonrails:active_storagefrom 7.0.0 before 7.0.2.3
debian:debian_linux10.0

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-w749-p3v6-hccqRubyGemsactivestorage>=5.2.0 <5.2.6.35.2.6.3
GHSA-w749-p3v6-hccqRubyGemsactivestorage>=6.0.0 <6.0.4.76.0.4.7
GHSA-w749-p3v6-hccqRubyGemsactivestorage>=6.1.0 <6.1.4.76.1.4.7
GHSA-w749-p3v6-hccqRubyGemsactivestorage>=7.0.0 <7.0.2.37.0.2.3

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian10rails2:5.2.2.1+dfsg-1+deb10u4DLA-3093-1
Debian11rails2:6.0.3.7+dfsg-2+deb11u1DSA-5372-1
Debian12, 13, 14rails2:6.1.4.7+dfsg-1DEBIAN-CVE-2022-21831
Ubuntu24.04:LTS, 25.10, 26.04:LTS and 5 morerailsno fix listedUBUNTU-CVE-2022-21831
openSUSETumbleweedruby3.2-rubygem-activestorage-7.07.0.4.3-1.1openSUSE-SU-2024:12880-1
openSUSETumbleweedrubygem-activestorage-7.07.0.2.3-1.1openSUSE-SU-2024:11903-1
openSUSETumbleweedrubygem-activestorage-7.07.0.8.4-1.1openSUSE-SU-2024:14070-1
openSUSETumbleweedrubygem-activestorage-7.07.0.8.6-1.3openSUSE-SU-2025:15113-1

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; SUSE security data, CC BY 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · openSUSE.

Red Hat

Red Hat rates this Important.

Red Hat's mitigation

To work around this issue, applications should implement a strict allow-list on accepted transformation methods or arguments. Additionally, a strict image magick security policy will help mitigate this issue:

https://imagemagick.org/script/security-policy.php

ProductPackageStateAdvisory
Red Hat Satellite 6tfm-ror52-rubygem-railsNot affected

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2022-21831.

Attack patterns (CAPEC)

  • CAPEC-35 Leverage Executable Code in Non-Executable Files Likelihood: High · Severity: Very High
  • CAPEC-77 Manipulating User-Controlled Variables Likelihood: High · Severity: Very High
  • CAPEC-242 Code Injection Likelihood: High · Severity: High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON