CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-59197

CVE-2026-59197: Heap Out-of-Bounds Write and Division-by-Zero in Pillow libImaging

Alon Barad
Alon Barad
Software Engineer

Jul 21, 2026·3 min read·43 visits

Executive Summary (TL;DR)

Integer overflow in Pillow image expansion leads to heap out-of-bounds write. Initial patch introduces a division-by-zero crash.

A heap out-of-bounds write vulnerability exists in Pillow prior to version 12.3.0 due to an integer overflow during image expansion calculations. The subsequent patch introduced a division-by-zero regression causing denial of service.

Vulnerability Overview

Pillow is a Python Imaging Library that provides image processing capabilities. The vulnerability exists within the native C extension libImaging, specifically in the image expansion and filtering code paths.\n\nAn attacker can trigger this vulnerability by providing an extremely large filter size parameter to ranking filters. This input flows from the Python layer into native C functions without sufficient prior validation.\n\nThe resulting calculation causes a signed integer overflow. This leads to severe memory corruption or application crashes.

Root Cause Analysis

The root cause lies in src/libImaging/Filter.c within the ImagingExpand function. When an application initializes a filter, the Python layer calculates the margin parameter using floor division.\n\nFor extremely large filter sizes, this division yields a margin value close to INT_MAX. When passed to the C library, the output dimensions are computed via addition and multiplication.\n\nSpecifically, the formula imIn->xsize + 2 * margin overflows the 32-bit signed integer limits. This mathematical wraparound results in a very small dimension value.\n\nConsequently, the library allocates an undersized destination buffer. However, the subsequent copying loop still uses the original large margin, resulting in an out-of-bounds write.

Code Analysis

The vulnerable calculation path computes the destination buffer size based on the overflowed dimensions.\n\nc\n/* Vulnerable dimension calculation */\nint xsize = imIn->xsize + 2 * margin;\nint ysize = imIn->ysize + 2 * margin;\n\n/* Allocation of undersized buffer */\nimOut = ImagingNewDirty(imIn->mode, xsize, ysize);\n\n\nThe loop then iterates using the un-overflowed margin to copy pixels.\n\nc\n/* Out-of-bounds copy loop */\nfor (y = 0; y < margin; y++) {\n for (x = 0; x < margin; x++) {\n imOut->image[y][x] = imIn->image[...];\n }\n}\n\n\nThe patch attempted to check bounds but introduced a division-by-zero error.\n\nc\n/* Patched boundary check introducing regression */\nif (margin > INT_MAX / (margin * (int)sizeof(FLOAT32))) {\n return (Imaging)ImagingError_ValueError(\"filter size too large\");\n}\n

Exploitation and Impact

An attacker can exploit this flaw by submitting images or filter size parameters designed to trigger the overflow. This allows sequential overwriting of heap data with pixel values derived from the input image.\n\nControl over pixel values enables targeted heap corruption. This can lead to remote code execution in contexts where untrusted input dictates filter dimensions.\n\nAdditionally, the patch regression allows a straightforward denial of service attack. Passing a filter size of 1 translates to a margin of 0, triggering the division-by-zero trap.

Remediation and Patches

Users should upgrade to Pillow version 12.3.0 or later to resolve the heap out-of-bounds write. This release contains validation checks that prevent large values from reaching the C execution layer.\n\nFor systems where upgrading is not immediately possible, strict input validation should be enforced. Applications should restrict filter size parameters to reasonable boundaries.\n\nFurthermore, the division-by-zero issue can be mitigated by ensuring that the margin parameter is non-zero before invoking the expansion functions.

Technical Appendix

CVSS Score
8.2/ 10

Affected Systems

Pillow (Python Imaging Library) versions prior to 12.3.0

Affected Versions Detail

Product
Affected Versions
Fixed Version
Pillow
Pillow
< 12.3.012.3.0
AttributeDetail
CWE IDCWE-190, CWE-787
Attack VectorNetwork
CVSS v3.1 Score8.2
ImpactHeap Out-of-Bounds Write / Denial of Service
Exploit StatusPoC Available

MITRE ATT&CK Mapping

T1203Exploitation for Client Execution
Execution

Vulnerability Timeline

CVE Published
2026-07-14

References & Sources

  • [1]GitHub Advisory
  • [2]Fix Commit
  • [3]Pull Request

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•2 days ago•CVE-2026-107844
5.3

CVE-2026-107844: Path Traversal Vulnerability in Contao ImagesController

A path traversal vulnerability (CWE-22) in Contao CMS allows unauthenticated remote attackers to bypass directory boundary restrictions in ImagesController and access files within the project directory.

Amit Schendel
Amit Schendel
8 views•5 min read
•2 days ago•CVE-2026-107848
3.5

CVE-2026-107848: Cross-Site Request Forgery (CSRF) in Contao Backend Actions via GET Requests

Contao Open Source CMS versions 4.0.0 through 5.3.49 and 5.4.0-RC1 through 5.7.11 contain a Cross-Site Request Forgery (CSRF) vulnerability in backend parameter handling. The `RequestTokenListener` component validates anti-CSRF tokens solely for HTTP POST requests, while GET-based declarative guards run only when an `act` parameter is present in the query string. Consequently, custom backend actions dispatched via alternative parameters such as `key=` can execute without CSRF token verification when triggered by an authenticated user.

Amit Schendel
Amit Schendel
8 views•5 min read
•2 days ago•CVE-2026-107843
5.3

CVE-2026-107843: Unthrottled Activation Email Resend and Account Enumeration in Contao CMS

Contao CMS versions 4.1.0 through 5.3.49 and 5.4.0-RC1 through 5.7.11 fail to validate form submission tokens and enforce rate limiting when processing activation email resend requests via HTTP POST, enabling resource exhaustion and account state enumeration.

Amit Schendel
Amit Schendel
9 views•4 min read
•2 days ago•CVE-2026-107842
5.3

CVE-2026-107842: Information Disclosure via Stale Indexing in Contao Search Module

An information disclosure vulnerability in Contao CMS allows unauthenticated site visitors to view protected page titles, URLs, and text excerpts through search queries when protected page indexing is disabled after previously being enabled.

Amit Schendel
Amit Schendel
10 views•4 min read
•2 days ago•GHSA-G38J-7V97-X298
6.5

GHSA-G38J-7V97-X298: Missing Authorization Check in Vikunja CalDAV Task Relation Creation

In Vikunja prior to version 2.6.0, relation creation via the CalDAV endpoint fails to invoke the TaskRelation.CanCreate authorization check. This missing access control allows an authenticated user to establish unauthorized relationships and perform write operations against any task, provided its unique identifier (UID) is known.

Alon Barad
Alon Barad
12 views•5 min read
•2 days ago•GHSA-3HC7-R24J-RPWC
6.8

GHSA-3hc7-r24j-rpwc: Cross-Project Task Disclosure via Subtask Expansion in Vikunja

A cross-project information disclosure vulnerability in Vikunja allows authenticated users with read access to one project to view private task details from unauthorized projects via subtask expansion parameters.

Alon Barad
Alon Barad
9 views•5 min read