Inefficient Algorithmic Complexity Affecting pillow package, versions [,13.0.0)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.29% (21st percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-PILLOW-21277726
  • published20 Oct 2026
  • disclosed19 Oct 2026
  • creditUnknown

Introduced: 19 Oct 2026

NewCVE-2026-112894  (opens in a new tab)
CWE-407  (opens in a new tab)

How to fix?

Upgrade pillow to version 13.0.0 or higher.

Overview

Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity via the next_object_id function in src/PIL/PdfParser.py when saving a multi-frame image as a multi-page PDF using im.save(fp, "PDF", save_all=True). The function computes the next PDF object ID by calling max() over the full set of all previously reserved object IDs on every reservation, causing CPU time to grow proportional to the square of the frame count. An attacker can trigger this quadratic behavior by supplying an image with a large declared frame count, such as an APNG whose acTL chunk declares a high num_frames value, without requiring any actual frame pixel data to be present.

Note: This is only exploitable when the caller saves with save_all=True targeting PDF output; for APNG inputs, the num_frames value from the acTL chunk is used directly and frames need not exist, subject only to the constraint that num_frames is non-zero and below 0x80000000.

CVSS Base Scores

version 4.0
version 3.1