# CVE-2026-59197: Pillow: Heap out-of-bounds write in Pillow `ImageFilter.RankFilter` via integer overflow in `ImagingExpand`

- Severity: High 8.2 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.45%, higher than 40% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-07-14T16:25:23.520Z
- Modified: 2026-10-24T21:10:00.130Z
- Also known as: GHSA-xj96-63gp-2gmr, BIT-PILLOW-2026-59197, PYSEC-2026-3454
- Weaknesses: CWE-190, CWE-787
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial
- Assigned by: GitHub_M

## Description

Pillow is a Python imaging library. Prior to 12.3.0, Pillow's public rank-filter API can trigger a native heap out-of-bounds write when given a very large odd filter size because ImageFilter.RankFilter.filter() calls image.expand(size // 2, size // 2) before rank-filter size validation and ImagingExpand() computes output dimensions with unchecked signed int arithmetic. This issue is fixed in version 12.3.0.

(As written by CVE List.)

## Affected

- python-pillow Pillow: < 12.3.0
- pillow (PyPI): before 12.3.0
- python pillow: before 12.3.0
- pillow (Bitnami): before 12.3.0

## Every score

- GitHub_M: CVSS:3.1 8.2 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H`
- GitHub: CVSS:3.1 8.2 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H`
- PyPA Advisory Database: CVSS:3.1 8.2 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H`
- Bitnami Vulnerability Database: rating High

## References

- <https://github.com/python-pillow/Pillow/security/advisories/GHSA-xj96-63gp-2gmr> (exploit, advisory, evidence, vendor-advisory, web)
- <https://github.com/python-pillow/Pillow/pull/9695> (fix, issue-tracking, patch, web)
- <https://github.com/python-pillow/Pillow/commit/cce3bdb867c77a3420261ed1bfdb6b0787ec8fc1> (fix, patch, web)
- <https://github.com/python-pillow/Pillow/releases/tag/12.3.0> (advisory, article, release-notes, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-59197> (advisory, web)
- <https://github.com/python-pillow/Pillow> (package)

## Sources

- CVE List: [CVE-2026-59197](https://www.cve.org/CVERecord?id=CVE-2026-59197), CVE Terms of Use, modified 2026-07-21
- GitHub Advisory Database: [GHSA-xj96-63gp-2gmr](https://github.com/advisories/GHSA-xj96-63gp-2gmr), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2026-59197](https://nvd.nist.gov/vuln/detail/CVE-2026-59197), Public domain, modified 2026-10-24
- PyPA Advisory Database: [PYSEC-2026-3454](https://osv.dev/vulnerability/PYSEC-2026-3454), CC-BY-4.0, modified 2026-07-22
- Bitnami Vulnerability Database: [BIT-PILLOW-2026-59197](https://osv.dev/vulnerability/BIT-PILLOW-2026-59197), Apache-2.0, modified 2026-09-08

---

Page: https://cve.day/CVE-2026-59197 · Whole record: https://cve.day/CVE-2026-59197.json · Rebuilt by cve.day 2026-11-25T22:59:27.997Z
