pillow@2.2.1 vulnerabilities

Python Imaging Library (Fork)

Direct Vulnerabilities

Known vulnerabilities in the pillow package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • H
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) when using arbitrary strings as text input and the number of characters passed into PIL.ImageFont.ImageFont.getmask() is over a certain limit. This can lead to a system crash.

How to fix Denial of Service (DoS)?

Upgrade pillow to version 10.2.0 or higher.

[,10.2.0)
  • H
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) if the size of individual glyphs extends beyond the bitmap image, when using PIL.ImageFont.ImageFont function. Exploiting this vulnerability could lead to a system crash.

How to fix Denial of Service (DoS)?

Upgrade pillow to version 10.2.0 or higher.

[,10.2.0)
  • H
Eval Injection

Affected versions of this package are vulnerable to Eval Injection via the PIL.ImageMath.eval function when an attacker has control over the keys passed to the environment argument.

How to fix Eval Injection?

Upgrade pillow to version 10.2.0 or higher.

[,10.2.0)
  • H
Uncontrolled Resource Consumption ('Resource Exhaustion')

Affected versions of this package are vulnerable to Uncontrolled Resource Consumption ('Resource Exhaustion') when the ImageFont truetype in an ImageDraw instance operates on a long text argument. An attacker can cause the service to crash by processing a task that uncontrollably allocates memory.

How to fix Uncontrolled Resource Consumption ('Resource Exhaustion')?

Upgrade pillow to version 10.0.0 or higher.

[,10.0.0)
  • C
Heap-based Buffer Overflow

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Heap-based Buffer Overflow when the ReadHuffmanCodes() function is used. An attacker can craft a special WebP lossless file that triggers the ReadHuffmanCodes() function to allocate the HuffmanCode buffer with a size that comes from an array of precomputed sizes: kTableSize. The color_cache_bits value defines which size to use. The kTableSize array only takes into account sizes for 8-bit first-level table lookups but not second-level table lookups. libwebp allows codes that are up to 15-bit (MAX_ALLOWED_CODE_LENGTH). When BuildHuffmanTable() attempts to fill the second-level tables it may write data out-of-bounds. The OOB write to the undersized array happens in ReplicateValue.

Notes:

This is only exploitable if the color_cache_bits value defines which size to use.

This vulnerability was also published on libwebp CVE-2023-5129

Changelog:

2023-09-12: Initial advisory publication

2023-09-27: Advisory details updated, including CVSS, references

2023-09-27: CVE-2023-5129 rejected as a duplicate of CVE-2023-4863

2023-09-28: Research and addition of additional affected libraries

2024-01-28: Additional fix information

How to fix Heap-based Buffer Overflow?

Upgrade Pillow to version 10.0.1 or higher.

[,10.0.1)
  • M
Denial of Service (DoS)

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Denial of Service (DoS) due to a missing GIF decompression bomb check.

How to fix Denial of Service (DoS)?

Upgrade Pillow to version 9.2.0 or higher.

[,9.2.0)
  • M
Denial of Service (DoS)

Affected versions of this package are vulnerable to Denial of Service (DoS) due to a missing GIF decompression bomb check.

How to fix Denial of Service (DoS)?

Upgrade pillow to version 9.2.0 or higher.

[,9.2.0)
  • M
Improper Input Validation

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Improper Input Validation. When the path to the temporary directory on Linux or macOS contained a space, this would break removal of the temporary image file after im.show() (and related actions), and potentially remove an unrelated file.

How to fix Improper Input Validation?

Upgrade Pillow to version 9.0.1 or higher.

[,9.0.1)
  • M
Buffer Over-read

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Buffer Over-read via the path_getbbox method in path.c during initialization of ImagePath.Path.

How to fix Buffer Over-read?

Upgrade Pillow to version 9.0.0 or higher.

[,9.0.0)
  • M
Improper Initialization

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Improper Initialization of ImagePath.Path in path_getbbox at path.c.

How to fix Improper Initialization?

Upgrade Pillow to version 9.0.0 or higher.

[,9.0.0)
  • C
Arbitrary Code Execution

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Arbitrary Code Execution via PIL.ImageMath.eval which allows evaluation of arbitrary expressions, such as ones that use the Python exec method.

How to fix Arbitrary Code Execution?

Upgrade Pillow to version 9.0.0 or higher.

[,9.0.0)
  • M
Denial of Service (DoS)

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Denial of Service (DoS). The 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, this can lead to an infinite loop where JpegImagePlugin keeps trying to end the file.

How to fix Denial of Service (DoS)?

Upgrade Pillow to version 9.0.0 or higher.

[,9.0.0)
  • M
Buffer Overflow

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Buffer Overflow. It allowed parameters passed into a convert function to trigger buffer overflow in Convert.c.

How to fix Buffer Overflow?

Upgrade Pillow to version 8.3.0 or higher.

[1.0,8.3.0)
  • H
Denial of Service (DoS)

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Denial of Service (DoS). Improper checks in BlpImagePlugin may result in the decoder running over empty data.

How to fix Denial of Service (DoS)?

Upgrade Pillow to version 8.2.0 or higher.

[,8.2.0)
  • H
Denial of Service (DoS)

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Denial of Service (DoS). This is due to improper checks in FliDecode that may result in an infinite loop.

How to fix Denial of Service (DoS)?

Upgrade Pillow to version 8.2.0 or higher.

[,8.2.0)
  • H
Denial of Service (DoS)

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Denial of Service (DoS). The readline in EPS use an accidentally quadratic method of accumulating lines while looking for a line ending. A malicious EPS file can use this to perform a DoS in the open phase, before an image is accepted for opening.

How to fix Denial of Service (DoS)?

Upgrade Pillow to version 8.2.0 or higher.

[,8.2.0)
  • H
Denial of Service (DoS)

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Denial of Service (DoS). Improper checks in PSDImagePlugin may result in a DoS when calling Image.open.

How to fix Denial of Service (DoS)?

Upgrade Pillow to version 8.2.0 or higher.

[,8.2.0)
  • H
Heap-based Buffer Overflow

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Heap-based Buffer Overflow insufficent fix for CVE-2020-35654 due to incorrect error checking in TiffDecode.c.

How to fix Heap-based Buffer Overflow?

Upgrade Pillow to version 8.1.1 or higher.

[,8.1.1)
  • H
Insufficient Validation

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Insufficient Validation. In TiffDecode.c, there is a negative-offset memcpy with an invalid size.

How to fix Insufficient Validation?

Upgrade Pillow to version 8.1.1 or higher.

[,8.1.1)
  • H
Denial of Service (DoS)

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Denial of Service (DoS). This can happen in the ICNS container format where the reported size of the contained image is not properly checked. These images can cause arbitrarily large memory allocations.

How to fix Denial of Service (DoS)?

Upgrade Pillow to version 8.1.2 or higher.

[,8.1.2)
  • H
Denial of Service (DoS)

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Denial of Service (DoS). This can happen in the ICO container format where the reported size of the contained image is not properly checked. These images can cause arbitrarily large memory allocations.

How to fix Denial of Service (DoS)?

Upgrade Pillow to version 8.1.2 or higher.

[,8.1.2)
  • H
Denial of Service (DoS)

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Denial of Service (DoS). This can happen in the BLP container format where the reported size of the contained image is not properly checked. These images can cause arbitrarily large memory allocations.

How to fix Denial of Service (DoS)?

Upgrade Pillow to version 8.1.2 or higher.

[,8.1.2)
  • H
Out-of-bounds Read

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Out-of-bounds Read due to invalid tile boundaries lead.

How to fix Out-of-bounds Read?

Upgrade Pillow to version 8.1.1 or higher.

[,8.1.1)
  • H
Regular Expression Denial of Service (ReDoS)

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via next_object_id.

How to fix Regular Expression Denial of Service (ReDoS)?

Upgrade Pillow to version 8.1.1 or higher.

[0,8.1.1)
  • H
Out-of-bounds Read

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Out-of-bounds Read. The PCX image decoder uses the reported image stride to calculate the row buffer, rather than calculating it from the image size.

How to fix Out-of-bounds Read?

Upgrade Pillow to version 8.1.0 or higher.

[,8.1.0)
  • C
Command Injection

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Command Injection in filenames that contain single quotes via load_djpeg.

How to fix Command Injection?

Upgrade Pillow to version 2.5.0 or higher.

[,2.5.0)
  • M
Buffer Overflow

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Buffer Overflow. Two Buffer Overflows exist in libImaging/TiffDecode.c.

How to fix Buffer Overflow?

Upgrade Pillow to version 7.1.0 or higher.

[,7.1.0)
  • M
Out-of-bounds Read

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Out-of-bounds Read. In libImaging/SgiRleDecode.c a number of out-of-bounds reads exist in the parsing of SGI image files.

How to fix Out-of-bounds Read?

Upgrade Pillow to version 7.1.0 or higher.

[0,7.1.0)
  • M
Out-of-bounds Read

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Out-of-bounds Read. In libImaging/Jpeg2KDecode.c there are multiple out-of-bounds reads via a crafted JP2 file.

How to fix Out-of-bounds Read?

Upgrade Pillow to version 7.1.0 or higher.

[0,7.1.0)
  • M
Out-of-bounds Read

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Out-of-bounds Read. In libImaging/PcxDecode.c, an out-of-bounds read can occur when reading PCX files where state->shuffle is instructed to read beyond state->buffer.

How to fix Out-of-bounds Read?

Upgrade Pillow to version 7.1.0 or higher.

[,7.1.0)
  • M
Out-of-Bounds

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Out-of-Bounds. Multiple out-of-bounds reads exist in libImaging/FliDecode.c.

How to fix Out-of-Bounds?

Upgrade Pillow to version 7.1.0 or higher.

[,7.1.0)
  • H
Integer Overflow

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Integer Overflow in libImaging/TiffDecode.c when decoding TIFF files.

How to fix Integer Overflow?

Upgrade Pillow to version 6.2.2 or higher.

[,6.2.2)
  • H
Buffer Overflow

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Buffer Overflow in libImaging/SgiRleDecode.c.

How to fix Buffer Overflow?

Upgrade Pillow to version 6.2.2 or higher.

[,6.2.2)
  • H
Buffer Overflow

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Buffer Overflow in libImaging/PcxDecode.c.

How to fix Buffer Overflow?

Upgrade Pillow to version 6.2.2 or higher.

[,6.2.2)
  • H
Buffer Overflow

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Buffer Overflow. in libImaging/FliDecode.c.

How to fix Buffer Overflow?

Upgrade Pillow to version 6.2.2 or higher.

[,6.2.2)
  • M
Denial of Service (DoS)

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Denial of Service (DoS). FpxImagePlugin.py calls the range function on an unvalidated 32-bit integer if the number of bands is large. On Windows running 32-bit Python, this results in an OverflowError or MemoryError due to the 2 GB limit. However, on Linux running 64-bit Python this results in the process being terminated by the OOM killer.

How to fix Denial of Service (DoS)?

Upgrade Pillow to version 6.2.2 or higher.

[,6.2.2)
  • M
Allocation of Resources Without Limits or Throttling

Pillow is a PIL (Python Imaging Library) fork.

Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling. 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.

How to fix Allocation of Resources Without Limits or Throttling?

Upgrade Pillow to version 6.2.0 or higher.

[,6.2.0)
  • C
Denial of Service (DoS)

Affected versions of pillow are vulnerable to Denial of Service (Dos) attack.

Integer overflow in the ImagingResampleHorizontal function in libImaging/Resample.c in Pillow before 3.1.1 allows remote attackers to have unspecified impact via negative values of the new size, which triggers a heap-based buffer overflow.

How to fix Denial of Service (DoS)?

Upgrade pillow to version 3.1.1 or higher.

[,3.1.1)
  • M
Information Exposure

pillow is a Python Imaging Library (Fork).

Pillow before 3.3.2 allows context-dependent attackers to obtain sensitive information by using the "crafted image file" approach, related to an "Integer Overflow" issue affecting the Image.core.map_buffer in map.c component.

[,3.3.2)
  • H
Arbitrary Code Execution

pillow is a Python Imaging Library (Fork).

Pillow before 3.3.2 allows context-dependent attackers to execute arbitrary code by using the "crafted image file" approach, related to an "Insecure Sign Extension" issue affecting the ImagingNew in Storage.c component.

[,3.3.2)
  • M
Denial of Service (DoS)

pillow is a Python Imaging Library (Fork).

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.

[,3.1.1)
  • M
Denial of Service (DoS)

pillow is a Python Imaging Library (Fork).

Buffer overflow in the ImagingFliDecode function in libImaging/FliDecode.c in Pillow before 3.1.1 allows remote attackers to cause a denial of service (crash) via a crafted FLI file.

[,3.1.1)
  • M
Denial of Service (DoS)

pillow is a Python Imaging Library (Fork).

Buffer overflow in the ImagingPcdDecode function in PcdDecode.c in Pillow before 3.1.1 and Python Imaging Library (PIL) 1.1.7 and earlier allows remote attackers to cause a denial of service (crash) via a crafted PhotoCD file.

[,3.1.1)
  • M
Denial of Service (DoS)

pillow is a Python Imaging Library (Fork).

PIL/IcnsImagePlugin.py in Python Imaging Library (PIL) and Pillow before 2.3.2 and 2.5.x before 2.5.2 allows remote attackers to cause a denial of service via a crafted block size.

[,2.3.2) [2.5,2.5.2)
  • M
Denial of Service (DoS)

pillow is a Python Imaging Library (Fork).

The Jpeg2KImagePlugin plugin in Pillow before 2.5.3 allows remote attackers to cause a denial of service via a crafted image.

[,2.5.3)
  • M
Denial of Service (DoS)

pillow is a Python Imaging Library (Fork).

Pillow before 2.7.0 allows remote attackers to cause a denial of service via a compressed text chunk in a PNG image that has a large size when it is decompressed.

[,2.7.0)
  • C
Arbitrary Command Execution

Pillow is a Python Imaging Library (Fork).

Affected versions of this package are vulnerable to Pillow: metacharacter injection issue attacks. Python Image Library (PIL) 1.1.7 and earlier and Pillow 2.3 might allow remote attackers to execute arbitrary commands via shell metacharacters in unspecified vectors related to CVE-2014-1932, possibly JpegImagePlugin.py.

How to fix Arbitrary Command Execution?

Upgrade to version 2.5.0 or greater.

[,2.5.0)
  • M
Symlink Attack

Pillow is a Python Imaging Library (Fork).

Affected versions of this package are vulnerable to Symlink attacks due to insecurely creating temporary files. The (1) load_djpeg function in JpegImagePlugin.py, (2) Ghostscript function in EpsImagePlugin.py, (3) load function in IptcImagePlugin.py, and (4) copy function in Image.py do not properly create temporary files, which allow local users to overwrite arbitrary files and obtain sensitive information via a symlink attack on the temporary file.

How to fix Symlink Attack?

Upgrade to version 2.3.1 or greater.

[,2.3.1)
  • M
Symlink Attack

Pillow is a Python Imaging Library (Fork).

Affected versions of this package are vulnerable to Symlink attacks due to insecurely creating temporary files. The (1) JpegImagePlugin.py and (2) EpsImagePlugin.py scripts use the names of temporary files on the command line, which makes it easier for local users to conduct symlink attacks by listing the processes.

How to fix Symlink Attack?

Upgrade to version 2.3.1 or greater.

[,2.3.1)