CVE-2026-112402

Pillow: Double free in ImagingScaleAffine on calloc failure via Image.transform

Published Oct 19, 2026 CVSS 4.0 · 8.7 High EPSS < 1% KEV · Not listed
Description
Pillow is a Python imaging library. Prior to 13.0.0, Pillow can double free image memory when ImagingScaleAffine encounters a selective allocation failure. The affected fast path handles Transform.EXTENT or pure scale-and-translate Transform.AFFINE operations with the default NEAREST resampling. The output image allocation must succeed while the additional per-column lookup allocation fails, after which the error path deletes image storage that later cleanup releases again. An attacker who can drive such a large Image.transform() operation under memory pressure may trigger the failure. This can crash the process and may corrupt memory. This issue is fixed in version 13.0.0.

Analysis

AI-generated

Technical impact

Pillow, a Python imaging library, contains a double‑free bug in the ImagingScaleAffine function. When an Image.transform() operation performs a large transform with the default NEAREST resampling, a secondary memory allocation may fail after a first successful allocation. The error path then frees the image storage twice, corrupting the heap. The result can be a crash or memory corruption, but the CVE description does not indicate any code execution capability.

Affected Systems

Any installation of Pillow prior to version 13.0.0 is affected. Python applications that perform transform operations such as Transform.EXTENT or pure scale‑and‑translate Transform.AFFINE with NEAREST resampling may trigger the flaw. The bug is fixed in Pillow 13.0.0 and later.

Risk and Exploitability

The CVSS base score of 8.7 signals high impact. EPSS is not available, so exploitation probability is unknown. The vulnerability is not listed in the CISA KEV catalog. The attack requires an attacker to be able to influence the size of image data processed by a Python process under memory pressure; successful exploitation results in process termination or heap corruption, potentially creating a denial‑of‑service condition.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Pillow to version 13.0.0 or later; this fixes the use‑after‑free flaw identified as CWE‑416.
  • Implement application‑level validations to restrict image dimensions and prevent allocation failures that could trigger a double‑free (CWE‑1341).
  • Add graceful handling for allocation failures to avoid attempts to free already released memory and mitigate potential denial‑of‑service conditions.

Generated by OpenCVE AI on October 20, 2026 at 06:58 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-7mwm-ghpf-9vrm Pillow: Double free in ImagingScaleAffine on calloc failure via Image.transform
Ubuntu USN Ubuntu USN USN-9064-2 Pillow regression
History
Type Values Removed Values Added
First Time appeared Python
Python pillow
CPEs cpe:2.3:a:python:pillow:*:*:*:*:*:*:*:*
Vendors & Products Python
Python pillow
Type Values Removed Values Added
Weaknesses CWE-1341
References
Metrics threat_severity

None

cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H'}

threat_severity

Important

Type Values Removed Values Added
First Time appeared Python-pillow
Python-pillow pillow
Vendors & Products Python-pillow
Python-pillow pillow
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description Pillow is a Python imaging library. Prior to 13.0.0, Pillow can double free image memory when ImagingScaleAffine encounters a selective allocation failure. The affected fast path handles Transform.EXTENT or pure scale-and-translate Transform.AFFINE operations with the default NEAREST resampling. The output image allocation must succeed while the additional per-column lookup allocation fails, after which the error path deletes image storage that later cleanup releases again. An attacker who can drive such a large Image.transform() operation under memory pressure may trigger the failure. This can crash the process and may corrupt memory. This issue is fixed in version 13.0.0.
Title Pillow: Double free in ImagingScaleAffine on calloc failure via Image.transform
Weaknesses CWE-416
References
Metrics cvssV4_0

{'score': 8.7, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N'}

Weaknesses
  • CWE-1341

    Multiple Releases of Same Resource or Handle

  • CWE-416

    Use After Free

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Oct 19, 2026, 9:37 PM
Reserved
Oct 19, 2026, 4:58 PM
Status
Analyzed
Published
Oct 19, 2026, 10:17 PM
Modified
Oct 27, 2026, 9:03 PM
Severity
Important
Public date
Oct 19, 2026, 9:18 PM