GHSA-cxf7-qrc5-9446

Suggest an improvement
Source
https://github.com/advisories/GHSA-cxf7-qrc5-9446
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/03/GHSA-cxf7-qrc5-9446/GHSA-cxf7-qrc5-9446.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-cxf7-qrc5-9446
Aliases
Published
2022-03-01T22:22:26Z
Modified
2023-11-01T05:28:46.663684Z
Severity
  • 9.8 (Critical) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
Remote shell execution vulnerability in image_processing
Details

Impact

When using the #apply method from image_processing to apply a series of operations that are coming from unsanitized user input, this allows the attacker to execute shell commands:

ImageProcessing::Vips.apply({ system: "echo EXECUTED" })
#>> EXECUTED

This method is called internally by Active Storage variants, so Active Storage is vulnerable as well.

Patches

The vulnerability has been fixed in version 1.12.2 of image_processing.

Workarounds

If you're processing based on user input, it's highly recommended that you always sanitize the user input, by allowing only a constrained set of operations. For example:

operations = params[:operations]
  .map { |operation| [operation[:name], *operation[:value]] }
  .select { |name, *| name.to_s.include? %w[resize_to_limit strip ...] } # sanitization

ImageProcessing::Vips.apply(operations)
Database specific
{
    "nvd_published_at": "2022-03-01T23:15:00Z",
    "cwe_ids": [
        "CWE-20",
        "CWE-78"
    ],
    "severity": "CRITICAL",
    "github_reviewed": true,
    "github_reviewed_at": "2022-03-01T22:22:26Z"
}
References

Affected packages

RubyGems / image_processing

Package

Name
image_processing
Purl
pkg:gem/image_processing

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.12.2

Affected versions

0.*

0.2.1
0.2.2
0.2.3
0.2.4
0.2.5
0.3.0
0.4.0
0.4.1
0.4.2
0.4.3
0.4.4
0.4.5
0.9.0
0.10.0
0.10.1
0.10.2
0.10.3
0.11.0
0.11.1
0.11.2

1.*

1.0.0
1.1.0
1.2.0
1.3.0
1.4.0
1.5.0
1.6.0
1.7.0
1.7.1
1.8.0
1.9.0
1.9.1
1.9.2
1.9.3
1.10.0
1.10.1
1.10.2
1.10.3
1.11.0
1.12.0
1.12.1