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-42309

CVE-2026-42309: Python Pillow Buffer Overflow Vulnerability

CVE-2026-42309 is a heap buffer overflow flaw in Python Pillow that occurs when nested lists are passed as coordinates to imaging APIs. This article covers the technical details, affected versions, impact, and mitigation.

Published: May 18, 2026

CVE-2026-42309 Overview

CVE-2026-42309 is a heap buffer overflow [CWE-122] in the Python Pillow imaging library. The flaw affects versions from 11.2.1 up to but not including 12.2.0. Passing nested lists as coordinates to APIs such as ImagePath.Path, ImageDraw.ImageDraw.polygon, and ImageDraw.ImageDraw.line causes Pillow to recursively unpack the nested structure beyond the allocated buffer. The result is a heap memory corruption condition triggered through standard drawing operations on attacker-influenced input. Maintainers addressed the issue in version 12.2.0 by validating that coordinate lists contain exactly two numeric values.

Critical Impact

Applications that pass untrusted or programmatically constructed coordinate data to Pillow drawing APIs can experience heap memory corruption, leading to process crashes or potential local code execution.

Affected Products

  • Python Pillow versions 11.2.1 through 12.1.x
  • Applications embedding Pillow for image generation, drawing, or path operations
  • Python services that accept user-controlled coordinate input for image rendering

Discovery Timeline

  • 2026-05-09 - CVE-2026-42309 published to NVD
  • 2026-05-12 - Last updated in NVD database
  • Patch released - Fixed in Pillow version 12.2.0

Technical Details for CVE-2026-42309

Vulnerability Analysis

The vulnerability resides in Pillow's coordinate parsing logic used by drawing primitives. When functions such as ImagePath.Path, ImageDraw.ImageDraw.polygon, and ImageDraw.ImageDraw.line receive coordinates, the library iterates over the supplied sequence to copy numeric pairs into a fixed-size heap buffer. The buffer is sized based on the top-level length of the sequence and the expected two values per coordinate.

When a caller supplies nested lists instead of flat numeric pairs, Pillow recursively unpacks the inner sequences. The recursion expands the number of values written without re-sizing the destination buffer. Writes continue past the allocated region, producing a heap buffer overflow categorized as [CWE-122].

The attack surface depends on whether an application exposes Pillow drawing APIs to untrusted input. Web services rendering charts, PDF generators, and image processing pipelines that accept structured coordinate data are typical exposure points.

Root Cause

The coordinate parser did not validate the structure of each coordinate entry. It assumed each element contained exactly two numeric values but did not reject nested sequences. Recursive unpacking allowed the iterator to emit more values than the allocated buffer could hold.

Attack Vector

Exploitation requires local delivery of crafted input to a process invoking Pillow drawing functions. An attacker supplies a coordinate argument containing nested lists, for example [[1, [2, 3]], [4, 5]], to a vulnerable API. The recursive unpacking writes adjacent heap data, corrupting allocator metadata or neighboring objects.

No verified public proof-of-concept code is associated with this CVE. Refer to the GitHub Security Advisory GHSA-5xmw-vc9v-4wf2 for maintainer-provided detail.

Detection Methods for CVE-2026-42309

Indicators of Compromise

  • Unexpected crashes or SIGSEGV signals in Python processes loading the PIL module during drawing operations
  • Heap corruption traces in core dumps referencing ImagePath, ImageDraw.polygon, or ImageDraw.line
  • Anomalous coordinate payloads containing nested sequences submitted to image-rendering endpoints

Detection Strategies

  • Inventory installed Pillow versions across Python environments and flag any release between 11.2.1 and 12.1.x
  • Apply software composition analysis to identify direct and transitive dependencies on vulnerable Pillow builds
  • Inspect application logs for malformed coordinate input passed to image-generation routes

Monitoring Recommendations

  • Monitor process telemetry for repeated crashes of Python workers that use Pillow drawing APIs
  • Alert on changes to requirements.txt, Pipfile.lock, or poetry.lock that pin Pillow below 12.2.0
  • Track inbound request payloads for image-rendering APIs and validate structural conformance

How to Mitigate CVE-2026-42309

Immediate Actions Required

  • Upgrade Pillow to version 12.2.0 or later in every Python environment
  • Audit code for calls to ImagePath.Path, ImageDraw.ImageDraw.polygon, and ImageDraw.ImageDraw.line that accept external input
  • Add input validation that rejects nested sequences before passing coordinates to Pillow

Patch Information

The Pillow maintainers patched the vulnerability in version 12.2.0. The fix validates that each coordinate contains exactly two numeric values and rejects nested lists. Release notes and source changes are available in the GitHub Pillow Release 12.2.0 and the GitHub Security Advisory GHSA-5xmw-vc9v-4wf2.

Workarounds

  • Flatten coordinate inputs to a sequence of (x, y) tuples before invoking Pillow drawing APIs
  • Validate that every coordinate element is a two-item sequence of numeric scalars and reject anything else
  • Restrict who can submit coordinate data to image-rendering services through authentication and authorization
bash
# Upgrade Pillow to the patched release
pip install --upgrade "Pillow>=12.2.0"

# Verify the installed version
python -c "import PIL; print(PIL.__version__)"

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

  • Vulnerability Details
  • TypeBuffer Overflow

  • Vendor/TechPython Pillow

  • SeverityMEDIUM

  • CVSS Score5.1

  • EPSS Probability0.01%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/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
  • AvailabilityLow
  • CWE References
  • CWE-122
  • Technical References
  • GitHub Pillow Release 12.2.0
  • Vendor Resources
  • GitHub Security Advisory GHSA-5xmw-vc9v-4wf2
  • Related CVEs
  • CVE-2026-42308: Python Pillow Buffer Overflow Vulnerability

  • CVE-2024-28219: Python Pillow Buffer Overflow Vulnerability

  • CVE-2025-48379: Python Pillow Buffer Overflow Vulnerability

  • CVE-2022-22816: 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