CVE-2021-28675
Description
An issue was discovered in Pillow before 8.2.0. PSDImagePlugin.PsdImageFile lacked a sanity check on the number of input layers relative to the size of the data block. This could lead to a DoS on Image.open prior to Image.load.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Pillow before 8.2.0 lacks a sanity check in PSD image parsing, allowing denial-of-service via crafted PSD files.
Vulnerability
The vulnerability resides in PsdImagePlugin.PsdImageFile._open() in Pillow before version 8.2.0. The code did not validate that the number of input layers (read from the file header) is consistent with the size of the layer data block. This allows an attacker to craft a PSD file with a large layer count but a small data block, causing excessive processing or memory allocation during Image.open(). The issue has been present since the PIL fork. [1][2]
Exploitation
An attacker needs to supply a specially crafted PSD file to a Pillow application that calls Image.open(). The file is parsed during the open() call, and the missing sanity check leads to a denial-of-service condition. No authentication or special privileges are required; the attack vector is network-based if the application processes user-uploaded images. [1][2]
Impact
Successful exploitation results in a denial-of-service (DoS) on the open() call, potentially causing high CPU or memory consumption, crashing the application, or making it unresponsive. No data disclosure or code execution is reported. [1][2]
Mitigation
The issue is fixed in Pillow 8.2.0, released on 2021-04-01. The fix adds a sanity check in _layerinfo() to ensure the layer block is long enough for the claimed number of layers. Users should upgrade to Pillow 8.2.0 or later. No workaround is available for older versions. [2][4]
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
pillowPyPI | < 8.2.0 | 8.2.0 |
Affected products
11- Pillow/Pillowdescription
- osv-coords10 versionspkg:bitnami/pillowpkg:pypi/pillowpkg:rpm/almalinux/python3-pillowpkg:rpm/opensuse/python-Pillow&distro=openSUSE%20Leap%2015.5pkg:rpm/suse/python-Pillow&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/python-Pillow&distro=SUSE%20OpenStack%20Cloud%207pkg:rpm/suse/python-Pillow&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/python-Pillow&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/python-Pillow&distro=SUSE%20OpenStack%20Cloud%20Crowbar%208pkg:rpm/suse/python-Pillow&distro=SUSE%20OpenStack%20Cloud%20Crowbar%209
< 8.2.0+ 9 more
- (no CPE)range: < 8.2.0
- (no CPE)range: < 8.2.0
- (no CPE)range: < 5.1.1-16.el8
- (no CPE)range: < 7.2.0-150300.3.12.1
- (no CPE)range: < 4.2.1-3.14.1
- (no CPE)range: < 2.8.1-4.22.1
- (no CPE)range: < 4.2.1-3.14.1
- (no CPE)range: < 5.2.0-3.8.1
- (no CPE)range: < 4.2.1-3.14.1
- (no CPE)range: < 5.2.0-3.8.1
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
8- github.com/advisories/GHSA-g6rj-rv7j-xwp4ghsaADVISORY
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/MQHA5HAIBOYI3R6HDWCLAGFTIQP767FL/mitrevendor-advisoryx_refsource_FEDORA
- nvd.nist.gov/vuln/detail/CVE-2021-28675ghsaADVISORY
- security.gentoo.org/glsa/202107-33ghsavendor-advisoryx_refsource_GENTOOWEB
- github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2021-139.yamlghsaWEB
- github.com/python-pillow/Pillow/pull/5377/commits/22e9bee4ef225c0edbb9323f94c26cee0c623497ghsaWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MQHA5HAIBOYI3R6HDWCLAGFTIQP767FLghsaWEB
- pillow.readthedocs.io/en/stable/releasenotes/8.2.0.htmlghsax_refsource_MISCWEB
News mentions
0No linked articles in our index yet.