CVE-2021-28677: Uncontrolled Resource Consumption in Pillow
Summary
CVE-2021-28677: Uncontrolled Resource Consumption in Pillow. Affects pillow versions < 8.2.0. Fixed in 8.2.0. How to fix ↓
Also tracked for
- pillow · Bitnami
- py3-pillow · Alpine:v3.14
The same CVE-2021-28677 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Pillow is a popular Python imaging library that provides support for opening, manipulating, and saving many different image file formats. It is widely used in various applications for image processing and manipulation. However, versions of Pillow before 8.2.0 are vulnerable to an uncontrolled resource consumption issue.
Vulnerability Detail
The vulnerability, identified as CVE-2021-28677, exists in the EPSImageFile component of Pillow. The readline implementation used in EPSImageFile does not handle different combinations of line endings properly. This results in an accidentally quadratic method of accumulating lines while searching for a line ending. An attacker can exploit this vulnerability by crafting a malicious EPS file that triggers this inefficient line accumulation process. By sending a specially crafted EPS file, an attacker can cause a denial-of-service (DoS) condition in Pillow during the open phase, before an image is accepted for opening.
How To Fix
Latest published version: 13.0.0 as of 22 Oct 2026
pip install --upgrade "pillow==13.0.0"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
8.2.0
This is the first release that contains the fix.
pip install --upgrade "pillow==8.2.0"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Conclusion
In conclusion, the vulnerability (CVE-2021-28677) in Pillow allows an attacker to perform a denial-of-service attack by exploiting an uncontrolled resource consumption issue. It is crucial to update Pillow to version 8.2.0 or later to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for pillow →
FAQ
Pillow is a Python imaging library that provides support for opening, manipulating, and saving various image file formats.
This vulnerability allows an attacker to perform a denial-of-service attack on applications using vulnerable versions of Pillow. By sending a specially crafted EPS file, an attacker can cause the application to consume excessive resources, leading to a DoS condition.
Versions of Pillow before 8.2.0 are affected by this vulnerability.
Currently, there is no known workaround for this vulnerability. It is recommended to upgrade to the latest version of Pillow to mitigate the risk.
You can update Pillow to the fixed version (8.2.0 or later) by running the command 'pip install --upgrade pillow'.
References
Related vulnerabilities
Recent vulnerabilities recorded for pillow.