---
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-09-10'
sourceUpdated: '2026-09-10T03:51:04.701007027Z'
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/python-pillow/Pillow'
  - url: 'https://github.com/python-pillow/Pillow/releases/tag/12.2.0'
tags:
  - osv
  - pip
epss: 0.00182
epssPercentile: 0.06948
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`
