CVE-2026-42309
Heap Buffer Overflow in Pillow Image Processing Library
Publication date: 2026-05-09
Last updated on: 2026-05-09
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| python | pillow | From 11.2.1 (inc) to 12.2.0 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-122 | A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc(). |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
CVE-2026-42309 is a heap buffer overflow vulnerability in the Python Pillow imaging library affecting versions 11.2.1 to before 12.2.0.
The issue occurs when nested lists are passed as coordinates to certain Pillow APIs such as ImagePath.Path, ImageDraw.ImageDraw.polygon, and ImageDraw.ImageDraw.line. These nested lists were recursively unpacked beyond the allocated buffer size, causing a heap buffer overflow.
This vulnerability was introduced in version 11.2.1 and has been fixed in version 12.2.0 by validating that coordinate lists contain exactly two numeric coordinates.
How can this vulnerability impact me? :
This heap buffer overflow vulnerability can lead to memory corruption when processing images with Pillow using the affected functions.
Memory corruption issues like this can cause application crashes, unexpected behavior, or potentially allow an attacker to execute arbitrary code or escalate privileges depending on the context in which Pillow is used.
Since Pillow is widely used for image processing in Python applications, exploiting this vulnerability could compromise the stability and security of applications that process untrusted image data.
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, upgrade the Python Pillow library to version 12.2.0 or later.
This version includes a patch that validates coordinate lists to contain exactly two numeric coordinates, preventing the heap buffer overflow caused by nested lists.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
The provided information does not specify any direct impact of this vulnerability on compliance with common standards and regulations such as GDPR or HIPAA.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability affects Python Pillow library versions from 11.2.1 up to 12.1.0. To detect if your system is vulnerable, you should check the installed Pillow version.
You can run the following Python command to check the Pillow version installed on your system:
- python -c "import PIL; print(PIL.__version__)"
If the version is between 11.2.1 and before 12.2.0, your system is vulnerable to this heap buffer overflow issue.
There are no specific network detection commands or signatures mentioned for this vulnerability, as it is a local library issue triggered by passing nested lists as coordinates in certain Pillow API calls.
To mitigate or confirm the fix, upgrade Pillow to version 12.2.0 or later, where the vulnerability has been patched.