CVE-2019-16865: Pillow Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-j7mj-748x-7p78
CVSS 7.5
CWE-770
Published
Advisory Summary

CVE-2019-16865 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting Pillow libraries in the PyPI ecosystem. The issue involves dos attack in pillow when processing specially crafted image files. Remediation is available by upgrading affected packages to version 6.2.0.

CVE-2019-16865 at a Glance

CVE Identifier CVE-2019-16865
GHSA Identifier GHSA-j7mj-748x-7p78
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product Pillow
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.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:N/A:H).

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 None (I:N)
Availability High (A:H)

How to Fix CVE-2019-16865

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: 6.2.0
pip install pillow>=6.2.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-2019-16865, 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 6.2.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-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. 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

An issue was discovered in Pillow before 6.2.0. When reading specially crafted invalid image files, the library can either allocate very large amounts of memory or take an extremely long period of time to process the image.

CVE-2019-16865 Affected Pillow Versions

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

References

NVD — CVE-2019-16865 NVD
https://nvd.nist.gov/vuln/detail/CVE-2019-16865
Pillow Source Repository REPOSITORY
https://github.com/python-pillow/Pillow/issues/4123
Security Fix Commit FIX COMMIT
https://github.com/python-pillow/Pillow/commit/ab52630d0644e42a75eb88b78b9a9d7438a6fbeb
Pillow Security Information SECURITY
https://www.debian.org/security/2020/dsa-4631
usn.ubuntu.com/4272-1 WEB
https://usn.ubuntu.com/4272-1
Pillow Security Information SECURITY
https://ubuntu.com/security/notices/USN-4272-1
Pillow Release RELEASE
https://pillow.readthedocs.io/en/latest/releasenotes/6.2.0.html
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LYDXD7EE4YAEVSTNIFZKNVPRVJX5ZOG3
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/EMJBUZQGQ2Q7HXYCQVRLU7OXNC7CAWWU
Pillow Source Repository REPOSITORY
https://github.com/python-pillow/Pillow
Pillow Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2019-110.yaml
GitHub Advisory / Wiki ADVISORY
https://github.com/advisories/GHSA-j7mj-748x-7p78
access.redhat.com/errata/rhsa-2020:06... WEB
https://access.redhat.com/errata/RHSA-2020:0694
access.redhat.com/errata/rhsa-2020:06... WEB
https://access.redhat.com/errata/RHSA-2020:0683
access.redhat.com/errata/rhsa-2020:06... WEB
https://access.redhat.com/errata/RHSA-2020:0681
access.redhat.com/errata/rhsa-2020:05... WEB
https://access.redhat.com/errata/RHSA-2020:0580
access.redhat.com/errata/rhsa-2020:05... WEB
https://access.redhat.com/errata/RHSA-2020:0578
access.redhat.com/errata/rhsa-2020:05... WEB
https://access.redhat.com/errata/RHSA-2020:0566

Frequently Asked Questions

What is CVE-2019-16865?
CVE-2019-16865 is a security vulnerability in Pillow involving DOS attack in Pillow when processing specially crafted image files under CWE-770: Allocation of Resources Without Limits or Throttling.
Which Pillow versions are affected?
Affected versions include releases prior to 6.2.0 across affected packages: pillow.
What version fixes CVE-2019-16865?
Upgrading to 6.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pillow affected?
Yes, pillow is affected in releases prior to 6.2.0. Upgrade your dependency to 6.2.0 or later.
What is the CVSS score of CVE-2019-16865?
CVE-2019-16865 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2019-16865?
CVE-2019-16865 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check PyPI dependencies for CVE-2019-16865?
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-j7mj-748x-7p78",
  "modified" : "2024-10-09T21:07:19Z",
  "published" : "2019-10-22T14:40:42Z",
  "aliases" : [ "CVE-2019-16865" ],
  "summary" : "DOS attack in Pillow when processing specially crafted image files",
  "details" : "An issue was discovered in Pillow before 6.2.0. When reading specially crafted invalid image files, the library can either allocate very large amounts of memory or take an extremely long period of time to process the image.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pillow"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-16865"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/python-pillow/Pillow/issues/4123"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/python-pillow/Pillow/commit/ab52630d0644e42a75eb88b78b9a9d7438a6fbeb"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2020/dsa-4631"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/4272-1"
  }, {
    "type" : "WEB",
    "url" : "https://ubuntu.com/security/notices/USN-4272-1"
  }, {
    "type" : "WEB",
    "url" : "https://pillow.readthedocs.io/en/latest/releasenotes/6.2.0.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LYDXD7EE4YAEVSTNIFZKNVPRVJX5ZOG3"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/EMJBUZQGQ2Q7HXYCQVRLU7OXNC7CAWWU"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/python-pillow/Pillow"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2019-110.yaml"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-j7mj-748x-7p78"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2020:0694"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2020:0683"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2020:0681"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2020:0580"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2020:0578"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2020:0566"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2019-10-17T17:43:21Z",
    "nvd_published_at" : null
  }
}