CVE-2026-112395: Pillow tiled-TIFF decoder reads past tile buffer in copy4 (Unpack.c:1290)

Published Oct 19, 2026
·
Updated

Summary

Pillow's libImaging decodeTile decoder, used to decode tiled TIFF images, allocates a per-tile buffer using realloc(state->buffer, TIFFTileSize(tiff)). After each TIFFReadTile it then iterates tiley from 0 up to currenttilelength and calls the configured row unpacker (here copy4) with the source pointer state->buffer + tiley rowbytesize. When libtiff returns a tilebytessize smaller than the worst-case rowbytesize tilelength, the inner stride-and-copy loop walks past the realloc'd region and copy4 performs a 1024-byte memcpy that reads up to (tilelength-1) rowbytesize + rowbytesize bytes from a buffer sized only to tilebytessize. The supplied PoC TIFF triggers a 1024-byte over-read exactly 0 bytes past a 196608-byte allocation. An attacker who can convince a Pillow-using application to decode a crafted TIFF can trigger a process crash (DoS) and may cause adjacent heap memory to be copied into the decoded pixel buffer.

Details

Pillow's TIFF decoder, when libtiff reports the file is tiled, takes the decodeTile path. The function:

1. Asks libtiff for TIFFTileSize(tiff) (the bytes-per-tile) and TIFFTileRowSize(tiff) (the bytes per row as stored by libtiff). 2. Reallocates state->buffer to exactly tilebytessize. 3. For each tile origin (x, y) and each plane, calls TIFFReadTile into state->buffer, then walks the tile row by row, calling the configured ImagingShuffler (here copy4) on each row's worth of source bytes.

The validation done before the loop is:

c if (tilebytessize > ((tilelength state->bits / planes + 7) / 8) tilewidth) { state->errcode = IMAGINGCODECBROKEN; return -1; }

This rejects oversized libtiff tiles, but it does not reject undersized ones — i.e. the case where libtiff returns a tilebytessize strictly less than rowbytesize tilelength. The loop body, however, indexes into the buffer assuming the buffer is at least rowbytesize tilelength bytes long.

Vulnerable Code

c // src/libImaging/TiffDecode.c:446-490 — decodeTile newdata = realloc(state->buffer, state->bytes); // bytes = tilebytessize if (!newdata) { ... } state->buffer = newdata;

for (y = state->yoff; y < state->ysize; y += tilelength) { for (plane = 0; plane < planes; plane++) { ImagingShuffler shuffler = unpackers[plane]; for (x = state->xoff; x < state->xsize; x += tilewidth) { if (TIFFReadTile(tiff, (tdatat)state->buffer, x, y, 0, plane) == -1) { ... }

currenttilewidth = min((INT32)tilewidth, state->xsize - x); currenttilelength = min((INT32)tilelength, state->ysize - y); for (tiley = 0; tiley < currenttilelength; tiley++) { shuffler( (UINT8 )im->image[tiley + y] + x im->pixelsize, state->buffer + tiley rowbytesize, // <-- OOB stride currenttilewidth ); } } } }

c // src/libImaging/Unpack.c:1288-1291 — copy4 (the crash site) static void copy4(UINT8 out, const UINT8 in, int pixels) { / RGBA, CMYK quadruples / memcpy(out, in, 4 pixels); // <-- ASAN-detected READ here }

The PoC's tile metadata yields tilewidth = tilelength = 256, rowbytesize = 1024 (4 bytes/pixel × 256 pixels), and tilebytessize = 196608 (which is 256·256·3 = three-channel-byte storage). The realloc'd buffer is 196608 bytes. The unpacker iterates tiley from 0 to 255 and for the highest rows the source pointer state->buffer + tiley 1024 already lies at or past offset 196608 — the very last row's memcpy(in=buffer+255·1024, 1024) reads 1024 bytes starting 260096 - 196608 = 63488 bytes past the allocation; ASAN flags the very first byte past the heap region (READ of size 1024 at … 0 bytes after 196608-byte region).

The mismatch is real: libtiff's TIFFTileSize returns the packed per-tile storage (which depends on the file's photometric/separation layout — it can legitimately be smaller than rowbytesize × tilelength), while the inner loop strides as if the buffer always equals rowbytesize × tilelength.

Attribution

This issue was found by Anthropic from using Claude to study security of open source projects, and I am from Ada Logics helping validate the found issues and report to maintainers. The data in this report has been reviewed manually.

Other sources

Pillow is a Python imaging library. From 8.2.0 until 13.0.0, Pillow's tiled-TIFF decoder can read past the tile buffer while copying four-byte pixels. In decodeTile, libtiff can return a tile allocation smaller than the required row stride multiplied by the tile length, and Pillow's stride-and-copy loop walks beyond that allocation. An attacker can supply a crafted tiled TIFF to an application that loads it. This can expose adjacent heap data in pixels or crash the process. This issue is fixed in version 13.0.0.

— Ubuntu

Affected Software

14 affected componentsFixes available
pypi/Pillow>=8.2.0<13.0.0
pip/pillow>=8.2.0<13.0.0
13.0.0
Python Pillow>=8.2.0<13.0.0
debian/pillow*
debian/pillow*
debian/pillow*
debian/pillow<=9.4.0-1.1+deb12u1, <=11.1.0-5+deb13u4, <=11.1.0-5+deb13u3, <=12.3.0-1
13.0.0-1
ubuntu/pillow-python2*
ubuntu/pillow*
ubuntu/pillow*
ubuntu/pillow*
ubuntu/pillow*
IBM App Connect Operator<=CD: 12.1.0 - 12.21.0 12.0 LTS: 12.0.0 - 12.0.28 13 LTS: 13.0.0 - 13.6.0
IBM App Connect EnterpriseCertified Containers Operands<=CD: 12.0.11.1-r1 - 12.0.12.5-r1, 13.0.1.0-r1 - 13.0.6.2-r1 12.0 LTS: 12.0.12-r1 - 12.0.12-r28 13 LTS: 13.0.7.0-r1 - 13.0.9.0-r1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/pillow to a version that resolves this vulnerability.

    Fixed in 13.0.0
  2. Upgrade

    Upgrade debian/pillow to a version that resolves this vulnerability.

    Fixed in 13.0.0-1
  3. Upgrade

    Upgrade Pillow to a version that resolves this vulnerability.

    Fixed in 13.0.0

Event History

Oct 19, 2026
CVE Published
via Ubuntu·12:00 AM
Data Sourced
via Ubuntu·12:00 AM
RemedyDescriptionSeverityAffected Software
CVE Published
via MITRE·08:59 PM
Data Sourced
via MITRE·08:59 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:17 PM
RemedyDescriptionSeverityWeaknessAffected Software
Oct 20, 2026
Advisory Published
via GitHub·08:49 PM
Data Sourced
via GitHub·08:49 PM
DescriptionSeverityWeaknessAffected Software
Nov 4, 2026
Data Sourced
via OSV·08:03 PM
Affected Software
Nov 9, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

Which deployments are exposed to this issue?

Applications using Pillow versions from 8.2.0 up to, but not including, 13.0.0 are affected when they load tiled TIFF images. The issue is triggered during decoding of attacker-supplied tiled TIFF content.

2

What does an attacker need to exploit it?

An attacker needs to provide a crafted tiled TIFF file to an application that loads it with Pillow. No privileges or user interaction are required according to the supplied vector.

3

What is the potential impact?

The out-of-bounds read can expose adjacent heap data through decoded pixels or crash the process. The provided severity vector indicates low confidentiality and availability impact, with no integrity impact.

4

How should this be remediated?

Upgrade Pillow to version 13.0.0, which fixes the issue. If an upgrade cannot happen immediately, avoid processing untrusted tiled TIFF files.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203