CVE-2021-25290: Out-of-bounds Write in Pillow
Summary
CVE-2021-25290: Out-of-bounds Write in Pillow. Affects pillow versions < 8.1.1. Fixed in 8.1.1. How to fix ↓
Also tracked for
- pillow · Bitnami
- py3-pillow · Alpine:v3.14
The same CVE-2021-25290 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, a vulnerability has been discovered in versions before 8.1.1 that can lead to an out-of-bounds write in the TiffDecode.c file. This vulnerability can be exploited to perform unauthorized write operations with an invalid size.
Vulnerability Detail
The vulnerability (CVE-2021-25290) in Pillow arises from a negative-offset memcpy operation with an invalid size in the TiffDecode.c file. An attacker can exploit this flaw to overwrite memory beyond the intended boundaries, potentially leading to a crash or arbitrary code execution. The severity of this vulnerability is rated as HIGH with a CVSS score of 7.5. It is important to note that this vulnerability has been reviewed and confirmed by GitHub.
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.1
This is the first release that contains the fix.
pip install --upgrade "pillow==8.1.1"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no known workaround for this vulnerability. It is essential to upgrade to the fixed version of Pillow to eliminate the risk of exploitation.
Conclusion
In conclusion, the vulnerability (CVE-2021-25290) in Pillow can lead to an out-of-bounds write, potentially resulting in a crash or arbitrary code execution. It is crucial to upgrade to version 8.1.1 or later to mitigate this vulnerability. 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 can be exploited to perform unauthorized write operations with an invalid size, potentially leading to a crash or arbitrary code execution.
The severity of this vulnerability is rated as HIGH with a CVSS score of 7.5.
Yes, this vulnerability has been reviewed and confirmed by GitHub.
No, there is no known workaround for this vulnerability. It is recommended to upgrade to the fixed version of Pillow.
References
Related vulnerabilities
Recent vulnerabilities recorded for pillow.