CVE-2016-0740: Pillow Pillow Buffer Overflow Vulnerability

MODERATE
Advisory Identifier: GHSA-hggx-3h72-49ww
CVSS 6.5
CWE-119
Published
Advisory Summary

CVE-2016-0740 is a MODERATE (CVSS 6.5) pillow buffer overflow vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting Pillow libraries in the PyPI ecosystem. The issue involves pillow buffer overflow in imaginglibtiffdecode. Remediation is available by upgrading affected packages to version 3.1.1.

CVE-2016-0740 at a Glance

CVE Identifier CVE-2016-0740
GHSA Identifier GHSA-hggx-3h72-49ww
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
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.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N).

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

How to Fix CVE-2016-0740

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: 3.1.1
pip install pillow>=3.1.1
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-2016-0740, 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 3.1.1), 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-119: Improper Restriction of Operations within the Bounds of a Memory Buffer, where the product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. this may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data. 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

Buffer overflow in the `ImagingLibTiffDecode` function in `libImaging/TiffDecode.c` in Pillow before 3.1.1 allows remote attackers to overwrite memory via a crafted TIFF file.

CVE-2016-0740 Affected Pillow Versions

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

References

Frequently Asked Questions

What is CVE-2016-0740?
CVE-2016-0740 is a security vulnerability in Pillow involving Pillow Buffer overflow in ImagingLibTiffDecode under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer.
Which Pillow versions are affected?
Affected versions include releases prior to 3.1.1 across affected packages: pillow.
What version fixes CVE-2016-0740?
Upgrading to 3.1.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pillow affected?
Yes, pillow is affected in releases prior to 3.1.1. Upgrade your dependency to 3.1.1 or later.
What is the CVSS score of CVE-2016-0740?
CVE-2016-0740 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2016-0740?
CVE-2016-0740 is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer (The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.).
How can I check PyPI dependencies for CVE-2016-0740?
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-hggx-3h72-49ww",
  "modified" : "2024-10-09T19:42:52Z",
  "published" : "2018-07-24T20:03:51Z",
  "aliases" : [ "CVE-2016-0740" ],
  "summary" : "Pillow Buffer overflow in ImagingLibTiffDecode",
  "details" : "Buffer overflow in the `ImagingLibTiffDecode` function in `libImaging/TiffDecode.c` in Pillow before 3.1.1 allows remote attackers to overwrite memory via a crafted TIFF file.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pillow"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.1.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-0740"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/python-pillow/Pillow/commit/6dcbf5bd96b717c58d7b642949da8d323099928e"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-hggx-3h72-49ww"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2016-5.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/python-pillow/Pillow"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/python-pillow/Pillow/blob/c3cb690fed5d4bf0c45576759de55d054916c165/CHANGES.rst"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/201612-52"
  }, {
    "type" : "WEB",
    "url" : "http://www.debian.org/security/2016/dsa-3499"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:40:09Z",
    "nvd_published_at" : null
  }
}