Skip to main content

Pillow CVE-2026-42311

HIGH
Integer Overflow or Wraparound (CWE-190)
2026-05-04 https://github.com/python-pillow/Pillow GHSA-pwv6-vv43-88gr
8.6
CVSS 4.0 · GitHub Advisory
Share

Severity by source

GitHub Advisory PRIMARY
8.6 HIGH
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Primary rating from GitHub Advisory · only source for this CVE.

CVSS VectorGitHub Advisory

CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
X

Lifecycle Timeline

5
Analysis Updated
May 09, 2026 - 06:28 vuln.today
v2 (cvss_changed)
Re-analysis Queued
May 09, 2026 - 06:22 vuln.today
cvss_changed
CVSS changed
May 09, 2026 - 06:22 NVD
8.6 (HIGH)
Source Code Evidence Fetched
May 04, 2026 - 21:02 vuln.today
Analysis Generated
May 04, 2026 - 21:02 vuln.today

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 333 pypi packages depend on pillow (278 direct, 59 indirect)

Ecosystem-wide dependent count for version 10.3.0.

DescriptionGitHub Advisory

Impact

Processing a malicious PSD file could lead to memory corruption, potentially resulting in a crash or arbitrary code execution.

Patches

Patched version: 12.2.0

Pillow 12.1.1 addressed CVE-2026-25990 by adding checks for tile extents in PSD image decoding/encoding to prevent an out-of-bounds write. However, the bounds checks computed tile extent sums using types susceptible to integer overflow, meaning a PSD image with carefully chosen tile dimensions could produce values that wrap around and bypass the checks, still triggering an out-of-bounds write in src/decode.c and src/encode.c. The fix avoids adding extents together before comparison.

Workarounds

Use any version but affected versions: >= 10.3.0, < 12.2.0

Resources

  • Fix: https://github.com/python-pillow/Pillow/pull/9520
  • Original issue: CVE-2026-25990 (Pillow 12.1.1)

AnalysisAI

Integer overflow in Pillow 10.3.0 through 12.1.1 bypasses bounds checks during PSD tile extent validation, enabling memory corruption and arbitrary code execution when processing malicious PSD files. This vulnerability (CVE-2026-42311) exploits an incomplete fix for CVE-2026-25990, where the original patch added tile extent validation but used overflow-prone integer types. Attackers craft PSD images with tile dimensions that wrap around during extent sum calculations, defeating the bounds checks and triggering out-of-bounds writes in decode.c and encode.c. Pillow 12.2.0 patches this by avoiding extent addition before comparison. No active exploitation confirmed (not in CISA KEV); publicly available exploit code exists via proof-of-concept test images in the patch commit.

Technical ContextAI

Pillow is a Python Imaging Library (PIL) fork providing comprehensive image processing capabilities. The vulnerability stems from CWE-190 (Integer Overflow or Wraparound) in the PSD (Adobe Photoshop Document) codec implementation. When processing PSD files, Pillow validates tile extents by computing sums of tile coordinates and dimensions to ensure they remain within image bounds. The flawed implementation in versions 10.3.0-12.1.1 used integer types susceptible to overflow when adding tile extents (e.g., xoff + xsize, yoff + ysize). Carefully chosen tile dimensions cause these sums to wrap around to small positive values or negative values that pass bounds checks, while the actual memory access attempts to write beyond allocated buffer boundaries in the C-level decode.c and encode.c modules. The affected package identifier is pkg:pip/pillow, impacting Python environments where Pillow handles untrusted PSD image input. The fix in PR #9520 restructures the validation logic to compare tile coordinates and sizes separately rather than computing potentially overflowing sums.

RemediationAI

Upgrade immediately to Pillow 12.2.0 or later, released with commit 58f9a1d166dcb0c274807d4423522d205b0c35ea applying the integer overflow fix from PR #9520 at https://github.com/python-pillow/Pillow/pull/9520. For Python environments, execute: pip install --upgrade pillow>=12.2.0 or update requirements.txt/pyproject.toml dependencies. Vendor advisory available at https://github.com/python-pillow/Pillow/security/advisories/GHSA-cfh3-3jmp-rvhc and related GHSA-pwv6-vv43-88gr. If immediate upgrade is blocked by compatibility constraints, implement defense-in-depth compensating controls: (1) Use Image.open() with formats parameter to explicitly exclude PSD format (formats=['PNG', 'JPEG', 'GIF'] whitelist approach), trading PSD functionality for security. (2) Validate file magic bytes before processing and reject PSD headers (38 42 50 53 hex signature) at ingress points, though this prevents legitimate PSD usage. (3) Run Pillow image processing in sandboxed containers with restricted memory and no network access, limiting RCE impact but not preventing crashes. (4) Implement file size limits (reject PSD files >10MB) to constrain exploit delivery, though small crafted files may still trigger overflow. Note: Pillow versions 10.0.0-10.2.0 are NOT vulnerable to this specific integer overflow but may be vulnerable to the original CVE-2026-25990. Versions <10.3.0 predate the flawed tile extent validation code entirely. All workarounds sacrifice PSD format support; upgrade remains the only complete mitigation.

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2026-55255 HIGH POC
8.4 Jun 19

Cross-user flow execution in Langflow (< 1.9.1) lets any authenticated API-key holder run another user's flow by passing

Share

CVE-2026-42311 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy