Heap-based Buffer Overflow Affecting pillow package, versions [,13.0.0)


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.53% (44th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-PILLOW-21277801
  • published20 Oct 2026
  • disclosed19 Oct 2026
  • creditNicholas Carlini, Tomer Fichman

Introduced: 19 Oct 2026

NewCVE-2026-112393  (opens in a new tab)
CWE-122  (opens in a new tab)

How to fix?

Upgrade pillow to version 13.0.0 or higher.

Overview

Affected versions of this package are vulnerable to Heap-based Buffer Overflow via _tiffWriteProc in src/libImaging/TiffDecode.c when saving a TIFF image to a BytesIO object. The buffer size calculation uses state->size instead of the current write location (state->loc) when determining whether reallocation is needed, so when libtiff seeks past the end of the allocated buffer (for example, when writing the TIFF directory), the computed to_write value becomes negative and the subsequent _TIFFmemcpy writes beyond the allocated heap region. An attacker who can supply an image that is saved as a TIFF to an in-memory buffer can trigger the overflow, achieving arbitrary heap corruption with potential for remote code execution.

Note: Exploitation requires that an attacker-controlled out-of-line tag value (such as ImageDescription, DocumentName, XMP, or an embedded ICC profile) reaches libtiff during the save operation, and that the application saves the result into a non-file object such as BytesIO.

CVSS Base Scores

version 4.0
version 3.1