Uncontrolled Resource Consumption in pillow
Summary
GHSA-jgpv-4h4c-xhw3: Uncontrolled Resource Consumption in pillow. Affects pillow versions < 8.1.2. Fixed in 8.1.2. How to fix ↓
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, a vulnerability has been discovered in versions prior to 8.1.1 that allows attackers to cause a denial of service (memory consumption) due to improper size checking of a contained image in a BLP container. This can lead to excessive memory allocation and potential resource exhaustion.
Vulnerability Detail
The vulnerability, identified as CVE-2021-27921, affects Pillow versions before 8.1.1. When processing specially crafted invalid image files, the library fails to properly check the reported size of a contained image in a BLP container. As a result, an attempted memory allocation can be very large, leading to a denial of service condition. This can be exploited by an attacker to consume excessive memory resources, potentially causing the system to become unresponsive or crash. The severity of this vulnerability is rated as MODERATE with a CVSS score of 7.5.
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.1.2
This is the first release that contains the fix.
pip install --upgrade "pillow==8.1.2"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no specific workaround mentioned for this vulnerability. However, users can mitigate the risk by avoiding the processing of untrusted or specially crafted image files using Pillow.
Conclusion
In conclusion, the vulnerability in Pillow versions prior to 8.1.1 allows attackers to consume excessive memory resources, leading to a denial of service condition. It is recommended to update to version 8.1.2 or later to fix this vulnerability. Users should also exercise caution when processing untrusted or specially crafted image files. 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.
The vulnerability allows attackers to cause a denial of service by consuming excessive memory resources, potentially leading to system instability or crashes.
Versions of Pillow prior to 8.1.1 are affected by this vulnerability.
Yes, updating Pillow to version 8.1.2 or later will fix this vulnerability.
While there is no specific workaround mentioned, users can mitigate the risk by avoiding the processing of untrusted or specially crafted image files using Pillow.
References
Related vulnerabilities
Recent vulnerabilities recorded for pillow.