CVE-2020-5310: Integer overflow in Pillow
Summary
CVE-2020-5310: Integer overflow in Pillow. Affects pillow versions < 6.2.2. Fixed in 6.2.2. How to fix ↓
Also tracked for
- pillow · Bitnami
- py3-pillow · Alpine:v3.12
The same CVE-2020-5310 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 and frameworks for image processing and manipulation. However, an integer overflow vulnerability has been discovered in Pillow versions prior to 6.2.2.
Vulnerability Detail
The vulnerability, identified as CVE-2020-5310, exists in the libImaging/TiffDecode.c file of Pillow. It is caused by a TIFF decoding integer overflow issue that is related to realloc. An attacker could exploit this vulnerability by providing a specially crafted TIFF image file, leading to an integer overflow during the decoding process. This could result in memory corruption or arbitrary code execution, potentially compromising the affected system.
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
6.2.2
This is the first release that contains the fix.
pip install --upgrade "pillow==6.2.2"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Conclusion
In conclusion, the integer overflow vulnerability in Pillow versions prior to 6.2.2 could allow an attacker to execute arbitrary code or cause memory corruption. It is crucial to upgrade to the fixed version to mitigate the risk. For further support on vulnerability remediation, you can reach out to 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 could allow an attacker to execute arbitrary code or cause memory corruption on systems using vulnerable versions of Pillow.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your Pipfile.lock and it will provide real-time alerts for open-source vulnerabilities.
No specific workaround has been provided for this vulnerability. It is recommended to upgrade to the fixed version of Pillow.
The CVSS score of this vulnerability is 8.8, indicating a high severity level.
Related vulnerabilities
Recent vulnerabilities recorded for pillow.