Uncontrolled Resource Consumption in pillow

pillow Updated 02 Oct 2025

Summary

23/04/2021
MODERATE
Yes i
Moderate
7.5

GHSA-jgpv-4h4c-xhw3: Uncontrolled Resource Consumption in pillow. Affects pillow versions < 8.1.2. Fixed in 8.1.2. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

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 →

Share this vulnerability

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.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback