On this page (7 sections)
Three vulnerabilities in Pillow, the widely used Python imaging library, are fixed in version 12.3.0. One is an out-of-bounds read triggered by a crafted McIdas AREA image. The other two involve font handling, where crafted font data can force very large memory allocations.
If your website or backend processes images or font files with Pillow (thumbnailers, converters, font previews, document pipelines), check your installed version and upgrade. Only one independent publisher covers this story so far, so the technical facts below come from the upstream Pillow advisories, commits and release notes.
What was fixed
The Pillow 12.3.0 release notes list a long set of security fixes. This article covers three of them: one memory-safety bug and two memory exhaustion bugs. The same release notes list other CVEs fixed in 12.3.0 (for example in PDF, EPS, JPEG2000 and ImageCms handling), so upgrading closes more than these three.
| CVE | Weakness | Component | CVSS |
|---|---|---|---|
| CVE-2026-54058 | Out-of-bounds read (CWE-125) | McIdas AREA image loading via memory mapping | 8.3 |
| CVE-2026-54059 | Excessive allocation (CWE-789) | PcfFontFile, PCF font loading | 7.5 |
| CVE-2026-54060 | Excessive allocation (CWE-789) | FontFile.compile() | 7.5 |
Technical details in plain terms
CVE-2026-54058: out-of-bounds read in McIdas images
According to the GitHub advisory, when Pillow opens an uncompressed image from a filename, it can memory-map the file. The McIdas AREA plugin takes the row stride, offset and image size straight from header values in the file. The code checked that the total size fit in the mapped buffer, but never checked that the stride was at least as large as one full row of pixels. A stride that is too small makes each row read run past the mapped region.
Reading those pixels (for example through tobytes, getpixel, convert or save) can then expose adjacent process memory or crash the process with a fault. The advisory describes this as information disclosure or denial of service. The upstream fix makes sure the stride is never smaller than a full row. The pull request says the problem is reachable from Image.open() on a crafted McIdas file opened from a path, which engages the memory-mapped fast path.
CVE-2026-54059 and CVE-2026-54060: font decompression bombs
Pillow has a decompression bomb check, a guard against small files that expand into huge images. According to the advisories, the font code paths did not call it. In the PCF advisory, glyph dimensions read from a PCF font were passed to Image.frombytes() without that check, so a tiny crafted font could trigger a large allocation. In the FontFile advisory, FontFile.compile() combined glyphs into one bitmap with no check either. That advisory says the method is the base class shared by BdfFontFile and PcfFontFile and runs when a loaded font is converted to an ImageFont or saved.
The advisories describe the impact as denial of service through memory exhaustion, for example in a service that previews or renders uploaded fonts. The fix commit adds decompression bomb checks to the font code paths.
Who may be exposed
The advisories do not enumerate affected deployments, so treat the following as general guidance for assessing your own exposure rather than findings from the sources.
- Applications that pass user-supplied images to Pillow by file path. The advisory says the memory-mapped path used by CVE-2026-54058 is engaged when an image is opened from a filename.
- Services that load, preview or convert user-supplied font files, such as font preview tools or text rendering pipelines. The advisory names uploads to a web font preview as one example scenario.
- Python applications where Pillow is a dependency of something else (an image field, thumbnail library or document generator). You may be running Pillow without having installed it directly, so check every environment.
- Docker images and virtual environments that pin an older Pillow, even if other parts of the host have been updated.
How to check your version
Run this inside the same Python environment your application uses (the virtualenv or container, not just the host). It prints the installed Pillow version, and the Required-by line lists packages that depend on it. Anything below 12.3.0 is affected.
python -m pip show pillowIf Pillow came from your operating system's package manager rather than pip, the upstream version number may not tell the whole story, because distributions can backport fixes without changing it. Check your vendor's security notices for the fixed package version for your release.
What to do now
- Find every environment that runs Pillow: virtualenvs, containers, CI images and system Python.
- Upgrade pip-installed Pillow to 12.3.0 or later.
- If you use a distribution package, apply the update from your vendor's security notice.
- Rebuild and redeploy container images so they pick up the new version.
- Restart application workers after upgrading so the old library is not still loaded in memory.
- Run your image and font handling tests after the upgrade.
- Review where untrusted files reach Pillow and add limits on upload size, file type and processing time.
For pip-managed environments, this command upgrades Pillow in the active environment. Afterwards, rerun the version check above and confirm it reports 12.3.0 or higher.
python -m pip install --upgrade "pillow>=12.3.0"If you pin dependencies, update the pin in requirements.txt, poetry.lock or your equivalent so a later install does not quietly bring back an older version.
Hardening and monitoring afterwards
- Avoid processing uploaded files in the same process or account as your main web application where you can. A crash or memory spike from a hostile file then stays contained.
- Set memory and CPU limits (container limits, ulimit or worker recycling) so one crafted file cannot take down the whole host.
- Accept only the file formats you actually need. If you never handle McIdas, PCF or BDF files, reject them before they reach Pillow.
- Watch for repeated worker crashes, out-of-memory kills or sudden memory spikes in image-handling services, and treat them as a prompt to review recent uploads.
- Run a dependency audit in CI so outdated libraries are flagged early.
The Webforta scanner runs read-only checks on websites you verify, and the WordPress plugin vulnerability guide explains how to track vulnerable components in a similar way. Neither replaces patching the library itself.
What is still unclear
Only one independent publisher has covered this story so far, and the facts here come from the upstream Pillow advisories, commits and release notes. The research does not include any distribution-specific security notices, so fixed package versions for specific operating systems are not stated here. Exploitation status is unconfirmed. The CVE records show publication dates in July 2026.
Sources
This article is based on the public sources below. Details can change as vendors and researchers publish more; check the original advisories before acting on version numbers.
- CVE-2026-54058 - GitHub Advisory Database
- Ensure map stride is at least one full row of pixels (#9719) · python-pillow/Pillow@6a8de89
- Ensure map stride is at least one full row of pixels by radarhere · Pull Request #9719 · python-pillow/Pillow
- CVE-2026-54059 - GitHub Advisory Database
- Pillow/docs/releasenotes/12.3.0.rst at main · python-pillow/Pillow
- Add decompression bomb checks to FontFile classes (#9711) · python-pillow/Pillow@0a263e6
- CVE-2026-54060 - GitHub Advisory Database
