VYPR
High severityNVD Advisory· Published Jun 2, 2021· Updated Aug 3, 2024

CVE-2021-25288

CVE-2021-25288

Description

An issue was discovered in Pillow before 8.2.0. There is an out-of-bounds read in J2kDecode, in j2ku_gray_i.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Pillow versions before 8.2.0 have an out-of-bounds read in the J2kDecode function when processing JPEG 2000 images with multiple bands of differing widths.

Vulnerability

An out-of-bounds (OOB) read vulnerability exists in the J2kDecode function of Pillow (Python Imaging Library fork) before version 8.2.0. The issue is triggered when decoding JPEG 2000 images (J2k format) that contain multiple bands with different widths for each band — for example, 1 byte for luminance (L) and 4 bytes for alpha (A). This behavior has been present since Pillow 2.4.0 [1][4].

Exploitation

An attacker can craft a J2k image file with bands of varying widths to trigger the OOB read. The attack requires no special network position or authentication; it is a classic file‑based vulnerability where the victim only needs to open the malicious image using Pillow’s J2kDecode. The vulnerability was discovered via OSS‑Fuzz, indicating that a specially crafted file is sufficient to reproduce the read beyond the allocated buffer [1][2].

Impact

Successful exploitation results in an out‑of‑bounds read, which may lead to information disclosure (leaking adjacent memory contents) or a denial‑of‑service (crash) if the read accesses unmapped memory. The attacker does not gain code execution or elevated privileges; the impact is limited to reading memory that should not be accessible or causing a segmentation fault [1][2].

Mitigation

Pillow version 8.2.0, released on 2021‑04‑01, contains the fix for this vulnerability [1]. All users should upgrade to Pillow >= 8.2.0. There is no known workaround for older versions; users unable to upgrade should avoid processing untrusted JPEG 2000 images. The vulnerability is not listed in CISA’s Known Exploited Vulnerabilities (KEV) catalog [3].

AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
pillowPyPI
>= 2.4.0, < 8.2.08.2.0

Affected products

11

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

9

News mentions

0

No linked articles in our index yet.