
Cloud Vulnerability DB
A community-led vulnerabilities database
CVE-2026-59197 is a heap out-of-bounds write vulnerability in Pillow's ImageFilter.RankFilter API, caused by an integer overflow in ImagingExpand. All versions of Pillow prior to 12.3.0 are affected, including the entire version history from 1.0 through 12.2.0. The vulnerability was disclosed on July 7, 2026 via a GitHub Security Advisory, with CVE assignment on July 14, 2026. It carries a CVSS v3.1 base score of 8.2 (High) (GitHub Advisory, Red Hat Bugzilla).
The root cause is a combination of CWE-190 (Integer Overflow or Wraparound) and CWE-787 (Out-of-bounds Write). ImageFilter.RankFilter.filter() calls image.expand(size // 2, size // 2) before validating the filter size; when a very large odd value such as 4294967295 (0xFFFFFFFF) is supplied, the expansion margin becomes 2147483647 (INT_MAX). The native C function ImagingExpand() in src/libImaging/Filter.c then computes output image dimensions using unchecked signed integer arithmetic, causing the result to wrap to a tiny allocation (e.g., 1×1 pixels). The subsequent border-expansion loop iterates using the original huge margin, writing far past the allocated buffer. The vulnerability is reachable through documented public classes — RankFilter, MedianFilter, MinFilter, and MaxFilter — without requiring any private API, ctypes, or custom Python objects (GitHub Advisory, Fix Commit).
Successful exploitation causes a native heap buffer overflow write in Pillow's C extension, which can crash the application (denial of service) or potentially enable arbitrary code execution through heap memory corruption. In mode L images, 1-byte out-of-bounds stores occur; in modes I and F, 4-byte stores occur, and if the image is also attacker-supplied, the value written out of bounds can be attacker-influenced. Applications that accept untrusted filter size parameters or process user-supplied images with rank-filter operations are directly at risk (GitHub Advisory).
A public proof-of-concept (PoC) is available in the official GitHub Security Advisory, consisting of minimal Python code that triggers an ASAN-confirmed heap-buffer-overflow crash. The vulnerability requires no authentication, no privileges, and no user interaction, and NVD has classified it as automatable. There is no evidence of active in-the-wild exploitation at this time, and it has not been added to the CISA KEV catalog. The EPSS score is approximately 0.397% (GitHub Advisory, Feedly).
MedianFilter, MinFilter, MaxFilter, or RankFilter) with a very large odd integer size such as 4294967295.from PIL import Image, ImageFilter
im = Image.new("L", (3, 3), 128)
im.filter(ImageFilter.MedianFilter(4294967295))ImagingExpand() causes a tiny heap allocation followed by a massive out-of-bounds write loop, corrupting adjacent heap memory and crashing the process or potentially enabling code execution.I image with attacker-controlled pixel values to influence the bytes written out of bounds, potentially enabling heap exploitation techniques for code execution (GitHub Advisory).ImagingExpand, Filter.c, or _imaging.c; ASAN output containing heap-buffer-overflow WRITE in ImagingExpand.4294967295) as filter size parameters in API calls or multipart form data.core.*) in the application working directory following crashes of Pillow-based services.Upgrade Pillow to version 12.3.0 or later, which validates the rank-filter size before calling image.expand() and adds an overflow check in ImagingExpand() in the C layer (Pillow 12.3.0 Release, Fix Commit). Red Hat has addressed this in RHSA-2026:48021 for Red Hat Enterprise Linux 8, and SUSE has issued SUSE-SU-2026:3084-1 and SUSE-SU-2026:3268-1 (Red Hat Bugzilla). As a temporary workaround if upgrading is not immediately possible, implement input validation in application code to reject filter size values where size * size * 4 > (2**31 - 1) before passing them to any Pillow rank-filter API.
Red Hat triaged the issue as high severity and issued a security errata (RHSA-2026:48021) for RHEL 8 within approximately two weeks of disclosure. SUSE issued two separate security updates covering affected distributions. The vulnerability was detected by Nessus and Qualys scanners shortly after disclosure, and coverage appeared across Linux security news outlets including LinuxSecurity.com and Pro-Linux.de (Red Hat Bugzilla).
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."