GHSA-4fx9-vc88-q2xc: Pillow Infinite Loop Vulnerability

LOW
CWE-400
Published
Advisory Summary

GHSA-4fx9-vc88-q2xc is a LOW infinite loop vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Pillow libraries in the PyPI ecosystem. The issue involves infinite loop in pillow. Remediation is available by upgrading affected packages to version 9.0.0.

GHSA-4fx9-vc88-q2xc at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-4fx9-vc88-q2xc
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Pillow
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix GHSA-4fx9-vc88-q2xc

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

Pillow fixed: 9.0.0
pip install Pillow>=9.0.0
Verify Direct and Transitive Dependencies

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

pip show Pillow

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-4fx9-vc88-q2xc, inspect your installed packages using pip:

pip show Pillow

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

Note: The pip show Pillow command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Pillow, 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

JpegImagePlugin may append an EOF marker to the end of a truncated file, so that the last segment of the data will still be processed by the decoder. If the EOF marker is not detected as such however, this could lead to an infinite loop where JpegImagePlugin keeps trying to end the file.

GHSA-4fx9-vc88-q2xc Affected Pillow Versions

1 component(s)
Fixed Versions:
9.0.0
Product / Package Ecosystem Affected Versions Fixed Version
Pillow
PyPI
< 9.0.0
9.0.0

References

Frequently Asked Questions

What is GHSA-4fx9-vc88-q2xc?
GHSA-4fx9-vc88-q2xc is a security vulnerability in Pillow involving Infinite loop in Pillow under CWE-400: Uncontrolled Resource Consumption.
Which Pillow versions are affected?
Affected versions include releases prior to 9.0.0 across affected packages: Pillow.
What version fixes GHSA-4fx9-vc88-q2xc?
Upgrading to 9.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Pillow affected?
Yes, Pillow is affected in releases prior to 9.0.0. Upgrade your dependency to 9.0.0 or later.
What CWE is associated with GHSA-4fx9-vc88-q2xc?
GHSA-4fx9-vc88-q2xc is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check PyPI dependencies for GHSA-4fx9-vc88-q2xc?
Run the dependency tree command: 'pip show Pillow'. 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-4fx9-vc88-q2xc",
  "modified" : "2022-03-11T23:39:27Z",
  "published" : "2022-03-11T23:39:27Z",
  "aliases" : [ ],
  "summary" : "Infinite loop in Pillow",
  "details" : "JpegImagePlugin may append an EOF marker to the end of a truncated file, so that the last segment of the data will still be processed by the decoder.\n\nIf the EOF marker is not detected as such however, this could lead to an infinite loop where JpegImagePlugin keeps trying to end the file.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Pillow"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "9.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/python-pillow/Pillow/commit/baae9ec4b67c68e3adaf1208cf54e8de5e38a6fd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/python-pillow/Pillow"
  }, {
    "type" : "WEB",
    "url" : "https://pillow.readthedocs.io/en/stable/releasenotes/9.0.0.html#ensure-jpegimageplugin-stops-at-the-end-of-a-truncated-file"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-03-11T23:39:27Z",
    "nvd_published_at" : null
  }
}