The fix is the same for all of them, Pillow 13.0.0. Below are the five most serious flaws and what you need to do.
Five critical flaws
Heap overflow in JPEG decoding (CVE-2026-112403). Image.thumbnail() calls JpegImageFile.draft() behind the scenes and asks for a scaled-down output. Given a lossless (SOF3) JPEG, libjpeg-turbo 3.x ignores the scaling and returns full-width rows, while Pillow's buffer is sized for the reduced width. Each row writes decoded pixel values past the end of the buffer. Versions 12.3.0 and earlier are affected.
Argument injection in the Ghostscript call (CVE-2026-112900). The EPS plugin puts the file path into the Ghostscript command line without sanitizing it. A file whose name starts with - reaches Ghostscript as an option. This can be chained into RCE, and having -dSAFER on does not stop it. Versions 2.6.0 through 12.x are affected.
Heap overflow when saving TIFF (CVE-2026-112393). When a TIFF is saved to an in-memory target such as io.BytesIO instead of a file, the write callback grows the buffer using the wrong calculation. It writes past the end of the buffer and copies leftover heap memory from the process into the saved file. A crash has been shown and code execution has not. Versions 2.0.0 through 12.x are affected.
Heap overflow in FlashPix JPEG decoding (CVE-2026-112398). If the optional olefile package is installed, Image.open() recognizes the file from its OLE2 signature regardless of extension, and a single crafted file can run a command. The researcher demonstrated this on Pillow 12.2.0. Versions 12.3.0 and earlier are affected.
Stale memory in multi-frame loaders (CVE-2026-96639). In multi-frame formats like PSD and MPO, when a later frame switches to a wider mode, Pillow keeps using the old, narrower buffer and writes out of bounds. Command execution has been shown through the MPO/JPEG path. Versions 11.0.0 through 12.x are affected.
The remaining 25 or so records are mostly denial of service and memory reads. Examples include infinite loops, quadratic time and unbounded memory in the TIFF, GIF, APNG, PDF and MSP formats. There is also a record about a known heap overflow in libopenjp2 2.5.4 (OSV-2025-219), which has shipped in the wheels since 11.1.0.
How to fix it
pip show Pillow | grep -i '^version'
pip install -U "Pillow>=13.0.0"
python -c "import PIL; print(PIL.__version__)"
If you pinned Pillow in requirements.txt, pyproject.toml or Pipfile.lock, change it there too. Pillow wheels carry their own libraries, so updating operating system packages does not close these flaws. With Docker, rebuild the image. If another package brings Pillow in, look at the "Required-by" line in the pip show Pillow output.
13.0.0 is a major version jump, so run your tests after the update and skim the release notes for removed features.
If you cannot update right away
These are not Pillow's recommendations, just what we would try. None of them replaces the update.
from PIL import Image
# open only the formats you need, which leaves EPS and FPX out
img = Image.open(path, formats=["JPEG", "PNG", "WEBP"])
- Generate the file name of user uploads yourself. A user-supplied name should never reach Ghostscript.
- Uninstall
olefileif you do not use it, which closes the FlashPix path. - Do image processing in a separate process or container with restricted privileges, not in the main application.
Sources
- GHSA-8g5g-8vmr-9782, JPEG
- GHSA-w889-685w-c8fh, Ghostscript
- GHSA-332p-7hrc-92wf, TIFF
- GHSA-5x8w-8jj5-q52h, FlashPix
- GHSA-v9pv-5gc8-w2m6, multi-frame loaders
Related posts
Written by sheduxdev.