CVE-2021-25289 Out of bounds write in Pillow
Heap-based buffer overflow in Pillow's TiffDecode allows attackers to execute arbitrary code or cause denial of service via crafted YCbCr files.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-25289?
CVE-2021-25289 is a critical memory corruption vulnerability in Python Pillow, published on 19 Mar 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
An issue was discovered in Pillow before 8.1.1. TiffDecode has a heap-based buffer overflow when decoding crafted YCbCr files because of certain interpretation conflicts with LibTIFF in RGBA mode. NOTE: this issue exists because of an incomplete fix for CVE-2020-35654.
Weakness: CWE-787
Which versions are affected by CVE-2021-25289?
4 open source packages ship an affected version, including pillow. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
pillow Bitnami | All versions | 8.1.1 |
pillow PyPI | All versions | 8.1.1 |
pillow PyPI | All versions | 8.1.1 |
pillow PyPI | All versions | 8.1.1 |
Products include Python Pillow.
How do I fix CVE-2021-25289?
Upgrade pillow to 8.1.1 or later.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is CVE-2021-25289 being exploited?
There is no known exploitation of CVE-2021-25289 in the wild and no public exploit code.
Other vulnerabilities in Python Pillow
- CVE-2014-3007 Pillow command injection
- CVE-2026-96639 Pillow multi-frame loaders can reuse stale native image storage after mode transitions
- CVE-2022-30595 Buffer over-flow in Pillow
- CVE-2016-4009 Pillow Integer overflow in ImagingResampleHorizontal
- CVE-2026-112393 Pillow: Heap buffer overflow in _tiffWriteProc when saving TIFF to BytesIO
Sources
Also known as ALPINE-CVE-2021-25289, BIT-pillow-2021-25289, DEBIAN-CVE-2021-25289, GHSA-57h3-9rgr-c24m, PYSEC-2021-35, UBUNTU-CVE-2021-25289.