CVE-2022-22815: Pillow Improper Initialization Vulnerability

MODERATE
Advisory Identifier: GHSA-pw3c-h7wp-cvhx
CVSS 6.5
CWE-665
Published
Advisory Summary

CVE-2022-22815 is a MODERATE (CVSS 6.5) improper initialization vulnerability (CWE-665: Improper Initialization) affecting Pillow libraries in the PyPI ecosystem. The issue involves improper initialization in pillow. Remediation is available by upgrading affected packages to version 9.0.0.

CVE-2022-22815 at a Glance

CVE Identifier CVE-2022-22815
GHSA Identifier GHSA-pw3c-h7wp-cvhx
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-665: Improper Initialization
Affected Product Pillow
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2022-22815

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 CVE-2022-22815, 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-665: Improper Initialization, where the product does not initialize or incorrectly initializes a resource, which might leave the resource in an unexpected state when it is accessed or used. 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

Pillow is the friendly PIL (Python Imaging Library) fork. `path_getbbox` in `path.c` in Pillow before 9.0.0 improperly initializes `ImagePath.Path`.

CVE-2022-22815 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 CVE-2022-22815?
CVE-2022-22815 is a security vulnerability in Pillow involving Improper Initialization in Pillow under CWE-665: Improper Initialization.
Which Pillow versions are affected?
Affected versions include releases prior to 9.0.0 across affected packages: pillow.
What version fixes CVE-2022-22815?
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 is the CVSS score of CVE-2022-22815?
CVE-2022-22815 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L.
What CWE is associated with CVE-2022-22815?
CVE-2022-22815 is classified under CWE-665: Improper Initialization (The product does not initialize or incorrectly initializes a resource, which might leave the resource in an unexpected state when it is accessed or used.).
How can I check PyPI dependencies for CVE-2022-22815?
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-pw3c-h7wp-cvhx",
  "modified" : "2024-10-11T21:09:06Z",
  "published" : "2022-01-12T20:07:43Z",
  "aliases" : [ "CVE-2022-22815" ],
  "summary" : "Improper Initialization in Pillow",
  "details" : "Pillow is the friendly PIL (Python Imaging Library) fork. `path_getbbox` in `path.c` in Pillow before 9.0.0 improperly initializes `ImagePath.Path`.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pillow"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "9.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-22815"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/python-pillow/Pillow/pull/5920"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/python-pillow/Pillow/commit/1e092419b6806495c683043ab3feb6ce264f3b9c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/python-pillow/Pillow/commit/c48271ab354db49cdbd740bc45e13be4f0f7993c"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-pw3c-h7wp-cvhx"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2022-8.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/python-pillow/Pillow"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/python-pillow/Pillow/blob/c5d9223a8b5e9295d15b5a9b1ef1dae44c8499f3/src/path.c#L331"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/python-pillow/Pillow/blob/e8ab5640774716c5486d3cb05167f74f742ad6ef/CHANGES.rst?plain=1#L1187"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2022/01/msg00018.html"
  }, {
    "type" : "WEB",
    "url" : "https://pillow.readthedocs.io/en/stable/releasenotes/9.0.0.html#fixed-imagepath-path-array-handling"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2022/dsa-5053"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-665" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-01-11T18:02:06Z",
    "nvd_published_at" : "2022-01-10T14:12:00Z"
  }
}