CVE-2026-42309: Pillow: Heap buffer overflow with nested list coordinates
Last updated 8 June 2026
Other sources
Passing nested lists as coordinates to APIs that accept coordinates such as ImagePath.Path, ImageDraw.ImageDraw.polygon and ImageDraw.ImageDraw.line could cause a heap buffer overflow, as nested lists were recursively unpacked beyond the allocated buffer. Coordinate lists are now validated to contain exactly two numeric coordinates. This was introduced in Pillow 11.2.1.
— GitHub
Pillow is a Python imaging library. From version 11.2.1 to before version 12.2.0, passing nested lists as coordinates to APIs that accept coordinates such as ImagePath.Path, ImageDraw.ImageDraw.polygon and ImageDraw.ImageDraw.line could cause a heap buffer overflow, as nested lists were recursively unpacked beyond the allocated buffer. Coordinate lists are now validated to contain exactly two numeric coordinates. This issue has been patched in version 12.2.0.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/pillowto a version that resolves this vulnerability.Fixed in 12.2.0 - Upgrade
Upgrade
debian/pillowto a version that resolves this vulnerability.Fixed in 8.1.2+dfsg-0.3+deb11u2Fixed in 8.1.2+dfsg-0.3+deb11u3Fixed in 9.4.0-1.1+deb12u1Fixed in 11.1.0-5+deb13u2Fixed in 12.2.0-1 - Upgrade
Upgrade
Pillowto a version that resolves this vulnerability.Fixed in 12.2.0
Event History
Frequently Asked Questions
What is the severity of CVE-2026-42309?
CVE-2026-42309 is rated as a high severity vulnerability due to its potential to cause a heap buffer overflow.
How do I fix CVE-2026-42309?
To fix CVE-2026-42309, upgrade the Pillow package to version 12.2.0 or higher.
What software is affected by CVE-2026-42309?
CVE-2026-42309 affects versions of the Pillow library between 11.2.1 and 12.2.0.
What are the potential consequences of exploiting CVE-2026-42309?
Exploitation of CVE-2026-42309 could lead to arbitrary code execution due to a heap buffer overflow.
How can I avoid triggering CVE-2026-42309?
To avoid triggering CVE-2026-42309, ensure that nested lists used as coordinates are properly validated before passing them to the Pillow APIs.