---
id: CVE-2026-42309
aliases:
  - GHSA-5xmw-vc9v-4wf2
  - BIT-pillow-2026-42309
  - PYSEC-2026-2251
title: Pillow has a heap buffer overflow with nested list coordinates
summary: Pillow has a heap buffer overflow with nested list coordinates
severity: medium
cvss: 5.5
cvssVector: 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H'
vendor: pillow
product: pillow
ecosystem: pip
affected:
  - 'pillow >= 11.2.1, < 12.2.0'
patched:
  - pillow 12.2.0
published: '2026-05-04'
updated: '2026-10-19'
sourceUpdated: '2026-10-19T20:00:04.709097863Z'
source: OSV
sourceUrl: 'https://osv.dev/vulnerability/GHSA-5xmw-vc9v-4wf2'
references:
  - url: >-
      https://github.com/python-pillow/Pillow/security/advisories/GHSA-5xmw-vc9v-4wf2
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2026-42309'
  - url: >-
      https://github.com/designcomputer/mysql_mcp_server/commit/a96549f4a4d65443fd6e9c7f2324fba9a5c80a82
  - url: >-
      https://github.com/python-pillow/Pillow/commit/cf6de8ca9b23e714aa5310e1c791eda66fc0b670
  - url: >-
      https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2251.yaml
  - url: 'https://github.com/python-pillow/Pillow'
  - url: 'https://github.com/python-pillow/Pillow/releases/tag/12.2.0'
  - url: 'https://github.com/advisories/GHSA-5xmw-vc9v-4wf2'
  - url: >-
      https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-42309.json
  - url: 'https://access.redhat.com/security/cve/CVE-2026-42309'
  - url: 'https://bugzilla.redhat.com/show_bug.cgi?id=2468458'
  - url: 'https://www.cve.org/CVERecord?id=CVE-2026-42309'
  - url: 'https://access.redhat.com/errata/RHSA-2026:16008'
  - url: 'https://access.redhat.com/errata/RHSA-2026:16030'
  - url: 'https://access.redhat.com/errata/RHSA-2026:16009'
  - url: 'https://access.redhat.com/errata/RHSA-2026:57387'
tags:
  - osv
  - pip
  - ghsa
  - csaf
  - vex
  - red-hat
epss: 0.00133
epssPercentile: 0.02785
cwe:
  - CWE-122
  - CWE-131
scores:
  osv: 5.5
  ghsa: 5.5
  vendor: 5.1
ingestedAt: '2026-07-13T18:57:53.526Z'
---

## Overview

Passing nested lists as coordinates to APIs that accept coordinates such as `ImagePath.Path`, `ImageDraw.ImageDraw.polygon` and `ImageDraw.ImageDraw.line` could cause a heap buffer overflow, as nested lists were recursively unpacked beyond the allocated buffer. Coordinate lists are now validated to contain exactly two numeric coordinates. This was introduced in Pillow 11.2.1.

## Affected packages

- `pillow >= 11.2.1, < 12.2.0`

## Remediation

Upgrade to a patched release:

- `pillow 12.2.0`

## Vendor advisories

- **RHSA-2026:16008** · Red Hat · fixed in: Red Hat AI Inference Server 3.3 · released 2026-05-11 · [advisory](https://access.redhat.com/errata/RHSA-2026:16008)
- **RHSA-2026:16030** · Red Hat · fixed in: Red Hat AI Inference Server 3.3 · released 2026-05-11 · [advisory](https://access.redhat.com/errata/RHSA-2026:16030)
- **RHSA-2026:16009** · Red Hat · fixed in: Red Hat AI Inference Server 3.3 · released 2026-05-11 · [advisory](https://access.redhat.com/errata/RHSA-2026:16009)
- **RHSA-2026:57387** · Red Hat · fixed in: Red Hat AI Inference Server 3.4 · released 2026-08-20 · [advisory](https://access.redhat.com/errata/RHSA-2026:57387)
- **Red Hat VEX** · Moderate · affected: Exploit Intelligence, OpenShift Lightspeed, Pen Drive Powered by Red Hat Lightspeed, Red Hat AI Inference Server, Red Hat Ansible Automation Platform 2, Red Hat Enterprise Linux 7, … · no fix planned: Exploit Intelligence, OpenShift Lightspeed, Pen Drive Powered by Red Hat Lightspeed, Red Hat AI Inference Server, … · updated 2026-10-09 · [vex](https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-42309.json)
