GHSA-v8gq-5grq-9728: mozjpeg DecompressScanlines :read_scanlines Is Unsound Vulnerability

HIGH
Published
Advisory Summary

GHSA-v8gq-5grq-9728 is a HIGH :read_scanlines is unsound vulnerability (General Security Weakness) affecting mozjpeg DecompressScanlines libraries in the crates.io ecosystem. The issue involves :read_scanlines is unsound. Remediation is available by upgrading affected packages to version 0.8.19.

GHSA-v8gq-5grq-9728 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-v8gq-5grq-9728
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product mozjpeg DecompressScanlines
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-v8gq-5grq-9728

To remediate this vulnerability, upgrade all affected mozjpeg DecompressScanlines dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mozjpeg fixed: 0.8.19
Upgrade mozjpeg to 0.8.19
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for mozjpeg

How to Check if You Are Affected

To determine whether your application is affected by GHSA-v8gq-5grq-9728, inspect your project dependencies for mozjpeg DecompressScanlines:

inspect dependencies for mozjpeg

Analyze the terminal output to locate any version of mozjpeg DecompressScanlines in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.8.19), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In mozjpeg DecompressScanlines, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

This issue and vector is similar to [RUSTSEC-2020-0029] of `rgb` crate which `mozjpeg` depends on. Affected versions of `mozjpeg` crate allow creating instances of any type `T` from bytes, and do not correctly constrain `T` to the types for which it is safe to do so. Examples of safety violation possible for a type `T`: * `T` contains a reference type, and it constructs a pointer to an invalid, arbitrary memory address. * `T` requires a safety and/or validity invariant for its construction that may be violated. The issue was fixed in 0.8.19 by using safer types and involving `rgb` dependency bump. [RUSTSEC-2020-0029]: https://rustsec.org/advisories/RUSTSEC-2020-0029.html

GHSA-v8gq-5grq-9728 Affected mozjpeg DecompressScanlines Versions

1 component(s)
Fixed Versions:
0.8.19
Product / Package Ecosystem Affected Versions Fixed Version
mozjpeg
crates.io
< 0.8.19
0.8.19

References

Frequently Asked Questions

What is GHSA-v8gq-5grq-9728?
GHSA-v8gq-5grq-9728 is a security vulnerability in mozjpeg DecompressScanlines involving :read_scanlines is Unsound under General Security Weakness.
Which mozjpeg DecompressScanlines versions are affected?
Affected versions include releases prior to 0.8.19 across affected packages: mozjpeg.
What version fixes GHSA-v8gq-5grq-9728?
Upgrading to 0.8.19 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mozjpeg affected?
Yes, mozjpeg is affected in releases prior to 0.8.19. Upgrade your dependency to 0.8.19 or later.
What CWE is associated with GHSA-v8gq-5grq-9728?
GHSA-v8gq-5grq-9728 is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-v8gq-5grq-9728?
Run the dependency tree command: 'inspect dependencies for mozjpeg'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-v8gq-5grq-9728",
  "modified" : "2022-09-16T21:03:43Z",
  "published" : "2022-09-16T21:03:43Z",
  "aliases" : [ ],
  "summary" : "mozjpeg DecompressScanlines::read_scanlines is Unsound",
  "details" : "This issue and vector is similar to [RUSTSEC-2020-0029] of `rgb` crate which `mozjpeg` depends on.\n\nAffected versions of `mozjpeg` crate allow creating instances of any type `T` from bytes,\nand do not correctly constrain `T` to the types for which it is safe to do so.\n\nExamples of safety violation possible for a type `T`:\n\n* `T` contains a reference type, and it constructs a pointer to an invalid, arbitrary memory address.\n* `T` requires a safety and/or validity invariant for its construction that may be violated.\n\nThe issue was fixed in 0.8.19 by using safer types and involving `rgb` dependency bump.\n\n[RUSTSEC-2020-0029]: https://rustsec.org/advisories/RUSTSEC-2020-0029.html\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "mozjpeg"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.8.19"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ImageOptim/mozjpeg-rust/issues/10"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ImageOptim/mozjpeg-rust"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2020-0165.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-09-16T21:03:43Z",
    "nvd_published_at" : null
  }
}