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

- Priority: **Prioritise**
- Reason: Public exploit (GitHub, Date unknown)
- Next step: Check applicability: affected before 12.3.0 (CNA); fix release not confirmed
- Status: published
- Published: 2026-07-14 · Modified: 2026-07-21
- Aliases: GHSA-xj96-63gp-2gmr, BIT-pillow-2026-59197, PYSEC-2026-3454, UBUNTU-CVE-2026-59197, DEBIAN-CVE-2026-59197, CGA-25g8-jm2p-3v4x, CGA-268j-pg99-2g6v, CGA-57j4-r35v-qg2p, CGA-777w-jpwq-j63c, CGA-7ghw-g455-84f3, CGA-chhm-4ch3-w555, CGA-ff3f-hqch-8mq7, CGA-h96j-7hh7-9549, CGA-hmh4-77gg-mf4p, CGA-rj28-h356-9vc6, CGA-rj54-65v6-rgf9, CGA-v5rj-7rmm-h4c5, CGA-w7pq-8jr8-8x6h, CGA-xfxj-2j52-94qw, CGA-xrqw-94rv-p7xq, CGA-2rf8-ghg7-gf82, CGA-32q5-qx2w-35c7, CGA-474r-88mf-9rw8, CGA-48w3-h543-959m, CGA-4m6j-3wgx-6rwr, CGA-8q86-9jwh-g2mr, CGA-8qvv-2q5p-cw94, CGA-9rcm-8rcj-hx6v, CGA-j5q9-h8qw-6vfr, CGA-j8jh-2jf6-j926, CGA-jf3w-4h52-4fpf, CGA-qgq5-x6jh-4xj3, CGA-r5hj-5vmj-3x5m, CGA-rcgj-7xfw-82c5, CGA-v4wv-7q22-r4hv, CGA-xp4f-49q7-9fgx
- Record: https://cvemate.com/vulnerability/CVE-2026-59197 · JSON: https://cvemate.com/vulnerability/CVE-2026-59197/json

## Description

```text
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.
```

## Signals

- CVSS: 8.2 high (v3.1, CVE.org) CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H
- EPSS: 0.445%, percentile 40.473%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 1 (github)

## Affected (first 20 of 26)

- chainguard label-studio (Chainguard): \< 1.23.0-r11
- chainguard lmcache-cuda-12.8 (Chainguard): \< 0.5.3-r0
- chainguard mlflow (Chainguard): \< 3.16.0-r0 \| \< 3.14.0-r2
- chainguard open-webui (Chainguard): \< 0.10.2-r1 \| All versions (No fix recorded) \| \< 0.11.0-r0
- chainguard openstack-horizon-2025.2 (Chainguard): \< 25.5.2\_git20260617-r4
- chainguard openstack-horizon-2025.2-fips (Chainguard): \< 25.5.2\_git20260617-r5
- chainguard openstack-horizon-2026.1 (Chainguard): \< 25.7.3\_git20260630-r2
- chainguard openstack-horizon-2026.1-fips (Chainguard): \< 25.7.3\_git20260630-r2
- chainguard superset-6.0 (Chainguard): \< 6.0.0-r13
- chainguard superset-6.1 (Chainguard): \< 6.1.0-r6
- chainguard superset-6.1-iamguarded-compat (Chainguard): All versions (No fix recorded)
- chainguard superset-fips-6.1 (Chainguard): \< 6.1.0-r5
- chainguard tensorflow-gpu-jupyter (Chainguard): \< 2.21.0-r7
- chainguard text-generation-inference (Chainguard): \< 3.3.7-r20
- chainguard tritonserver-backend-vllm-cuda-13.0 (Chainguard): \< 25.11-r11
- wolfi mlflow (Wolfi): \< 3.16.0-r0 \| \< 3.14.0-r2
- wolfi open-webui (Wolfi): \< 0.10.2-r1 \| All versions (No fix recorded) \| \< 0.11.0-r0
- wolfi superset-6.0 (Wolfi): \< 6.0.0-r13
- wolfi superset-6.1 (Wolfi): \< 6.1.0-r6
- wolfi superset-6.1-iamguarded-compat (Wolfi): All versions (No fix recorded)

## References

- <https://github.com/python-pillow/Pillow/security/advisories/GHSA-xj96-63gp-2gmr>
- <https://github.com/python-pillow/Pillow/pull/9695>
- <https://github.com/python-pillow/Pillow/commit/cce3bdb867c77a3420261ed1bfdb6b0787ec8fc1>
- <https://github.com/python-pillow/Pillow/releases/tag/12.3.0>
- <https://nvd.nist.gov/vuln/detail/CVE-2026-59197>
- <https://github.com/python-pillow/Pillow>
- <https://ubuntu.com/security/CVE-2026-59197>
- <https://www.cve.org/CVERecord?id=CVE-2026-59197>
- <https://security-tracker.debian.org/tracker/CVE-2026-59197>
- <https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59197.json>
- <https://ubuntu.com/security/notices/USN-8999-1>

---

Data as of 2026-12-05T04:45:14.328Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
