Executive brief
Pillow, a widely used Python library for image processing, is vulnerable to a denial-of-service attack when processing specially crafted EPS image files. An attacker can provide a malicious file that causes the application to enter an infinite loop, consuming 100% of the CPU and making the service unresponsive. This affects any application that uses Pillow to open or validate uploaded images, such as web servers or background processing workers.
Technical details
A vulnerability exists in the EPS parser (PIL/EpsImagePlugin.py) of Pillow versions 12.0.0 through 12.2.0. The parser fails to validate the byte count provided in the %%BeginBinary directive before passing it to a relative seek operation (self.fp.seek). By providing a negative value, an attacker can force the file pointer to seek backwards to the same directive, causing the parser to re-process the same line indefinitely. This results in an infinite loop and CPU exhaustion during the Image.open() call. The exploit does not require Ghostscript or the Image.load() method to be called. The issue is resolved in version 12.3.0.
Affected products
- python-pillow Pillow >= 12.0.0, < 12.3.0
Timeline
- 2026-07-07: disclosed: Initial report to maintainers
- 2026-07-14: advisory: NVD publication
- 2026-07-20: patched: GitHub Advisory published and fix confirmed in 12.3.0
References
- https://api.github.com/users/jiagongzheng-stack
- https://github.com/jiagongzheng-stack
- https://api.github.com/users/jiagongzheng-stack/gists%7B/gist_id%7D
- https://api.github.com/users/jiagongzheng-stack/repos
- https://avatars.githubusercontent.com/u/239149280?v=4
- https://api.github.com/users/jiagongzheng-stack/events%7B/privacy%7D