The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-42311

CVE-2026-42311: Python Pillow RCE Vulnerability

CVE-2026-42311 is a remote code execution flaw in Python Pillow that allows attackers to execute arbitrary code via malicious PSD files. This post explains its impact, affected versions, and mitigation steps.

Published: May 18, 2026

CVE-2026-42311 Overview

CVE-2026-42311 is an integer overflow vulnerability [CWE-190] in Pillow, the widely used Python imaging library. The flaw affects versions from 10.3.0 up to but not including 12.2.0. Processing a maliciously crafted Photoshop Document (PSD) file triggers memory corruption inside Pillow's image tile handling code. Successful exploitation can crash the host process or lead to arbitrary code execution in the context of the application using Pillow. The maintainers patched the issue in Pillow 12.2.0 by validating tile extents before they are passed to the native decoder.

Critical Impact

A malicious PSD file processed by an application using a vulnerable version of Pillow can corrupt memory and lead to arbitrary code execution within the affected Python process.

Affected Products

  • Python Pillow versions >=10.3.0 and <12.2.0
  • Applications and services that decode untrusted PSD images using Pillow
  • Python environments and containers bundling vulnerable Pillow wheels

Discovery Timeline

  • 2026-05-09 - CVE-2026-42311 published to NVD
  • 2026-05-14 - Last updated in NVD database

Technical Details for CVE-2026-42311

Vulnerability Analysis

The vulnerability resides in Pillow's PSD decoder path, where tile extent coordinates supplied by the image file are used to configure the C decoder state without sufficient bounds checking. When Pillow processes a PSD file, the parser reads tile coordinates (x0, y0, x1, y1) and forwards them to native code in src/decode.c. The pre-patch code computed xsize = x1 - x0 and ysize = y1 - y0 and trusted the results without verifying that the coordinates were within the image dimensions. A crafted PSD can specify extents that overflow integer arithmetic or exceed the underlying image buffer, causing the decoder to write outside the allocated pixel memory.

Root Cause

The root cause is missing validation of attacker-controlled tile boundaries before they are used in pointer arithmetic and buffer indexing. Because x1 - x0 and y1 - y0 were computed without checking signs or maximums, negative or oversized extents produced corrupted state values consumed by the C decoder. This classifies the issue as an integer overflow leading to out-of-bounds memory access.

Attack Vector

Exploitation requires the victim application to call Pillow on a PSD file supplied by the attacker. Common scenarios include image upload endpoints, thumbnail generators, document pipelines, and offline batch converters. The attack requires no privileges and no user interaction beyond the normal image processing workflow, but is scored as a local vector because the malicious file must be delivered to the processing host.

python
# Security patch in src/PIL/ImageFile.py - validate tile extents (#9520)
if extents:
    x0, y0, x1, y1 = extents

    if x0 < 0 or y0 < 0 or x1 > self.im.size[0] or y1 > self.im.size[1]:
        msg = "Tile cannot extend outside image"
        raise ValueError(msg)

    self.state.xoff = x0
    self.state.yoff = y0
    self.state.xsize = x1 - x0
# Source: https://github.com/python-pillow/Pillow/commit/58f9a1d166dcb0c274807d4423522d205b0c35ea
c
/* Security patch in src/decode.c - validate extents in native decoder (#9520) */
if (x0 < 0 || y0 < 0 || x1 <= x0 || y1 <= y0 || x1 > (int)im->xsize ||
    y1 > (int)im->ysize) {
    PyErr_SetString(PyExc_ValueError, "tile cannot extend outside image");
    return NULL;
}

decoder->im = im;
state = &decoder->state;
/* Source: https://github.com/python-pillow/Pillow/commit/58f9a1d166dcb0c274807d4423522d205b0c35ea */

Detection Methods for CVE-2026-42311

Indicators of Compromise

  • Python processes terminating with SIGSEGV or SIGABRT shortly after opening .psd files
  • Unexpected ValueError: tile cannot extend outside image exceptions after upgrade, indicating malformed PSD inputs
  • PSD uploads with tile coordinates that exceed the declared image canvas dimensions
  • Image-processing workers crashing or restarting when handling specific user-supplied files

Detection Strategies

  • Inventory installed Pillow versions across hosts and containers using pip show pillow or SBOM tooling, and flag any version >=10.3.0,<12.2.0.
  • Inspect PSD files at upload boundaries and reject those whose tile extents are negative or exceed the image header dimensions.
  • Monitor application logs and crash telemetry for repeated decoder faults associated with PSD inputs.

Monitoring Recommendations

  • Forward image-processing service crash dumps and stderr to a central logging platform for correlation.
  • Alert on file upload patterns where PSD files trigger worker restarts or memory faults.
  • Track dependency drift with software composition analysis to ensure Pillow stays on a patched release.

How to Mitigate CVE-2026-42311

Immediate Actions Required

  • Upgrade Pillow to version 12.2.0 or later in all production, staging, and developer environments.
  • Rebuild and redeploy container images that bundle Pillow so cached layers do not retain vulnerable versions.
  • Audit pipelines that accept PSD files from untrusted sources and quarantine any pending uploads until patched.

Patch Information

The fix is included in Pillow 12.2.0. The patch adds bounds checks in both src/PIL/ImageFile.py and src/decode.c so that tile extents outside the image are rejected before reaching the native decoder. Review the GitHub Security Advisory GHSA-pwv6-vv43-88gr, the upstream commit, and the Pillow 12.2.0 release notes.

Workarounds

  • Disable PSD ingestion in applications that cannot immediately upgrade, by filtering on file magic bytes and rejecting 8BPS headers.
  • Pre-validate PSD headers and refuse files whose declared tile extents fall outside the image canvas.
  • Run image decoding in a sandboxed, low-privilege worker process with strict resource and syscall limits to contain potential exploitation.
bash
# Configuration example: pin a patched Pillow version
pip install --upgrade 'Pillow>=12.2.0'

# Verify the installed version
python -c "import PIL, sys; print(PIL.__version__); sys.exit(0 if tuple(int(x) for x in PIL.__version__.split('.')[:2]) >= (12, 2) else 1)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechPython Pillow

  • SeverityHIGH

  • CVSS Score8.6

  • EPSS Probability0.02%

  • Known ExploitedNo
  • CVSS Vector
  • 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
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-190
  • Technical References
  • GitHub Release 12.2.0
  • Vendor Resources
  • GitHub Commit Update

  • GitHub Pull Request #9520

  • GitHub Security Advisory GHSA-pwv6-vv43-88gr
  • Related CVEs
  • CVE-2023-50447: Python Pillow RCE Vulnerability

  • CVE-2022-22817: Python Pillow RCE Vulnerability

  • CVE-2026-42309: Python Pillow Buffer Overflow Vulnerability

  • CVE-2026-42308: Python Pillow Buffer Overflow Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English