Junglewise Threat Intelligence

CVE-2026-28231: pillow-heif integer overflow in encode path buffer validation

CVE-2026-28231 · Severity: medium · CVSS 4 · Published 2026-07-20

Vendors: PyPI.

Executive brief

A vulnerability in the pillow-heif library, which is used to process HEIF and AVIF images in Python, could allow an attacker to crash a server or steal sensitive information. By providing specially crafted large image dimensions, an attacker can bypass security checks during the image encoding process. This could result in the server leaking private data from its memory into the generated image or causing the application to stop working entirely.

Technical details

An integer overflow exists in the `_pillow_heif.c` component within the `_CtxWriteImage_add_plane`, `_CtxWriteImage_add_plane_la`, and `_CtxWriteImage_add_plane_l` functions. The vulnerability is caused by using 32-bit signed integer multiplication (`stride_in * height`) to validate if an input buffer is large enough for the requested image dimensions. When the product exceeds `INT_MAX`, it wraps to a small or negative value, bypassing the `buffer.len` check. This leads to a heap out-of-bounds read during the subsequent `memcpy` loop. Attackers can exploit this to leak sensitive heap memory (information disclosure) or cause a segmentation fault (denial of service). The issue is fixed in version 1.3.0 by casting operands to `Py_ssize_t` before multiplication.

Affected products

  • bigcat88 pillow-heif < 1.3.0
  • bigcat88 pi-heif < 1.3.0

Timeline

  • 2026-02-27: disclosed
  • 2026-02-27: patched: Fixed in version 1.3.0
  • 2026-07-20: advisory

References