{"description":"Trending threats, MITRE ATT\u0026CK coverage, and detection metadata. Fed continuously.","favicon":"https://feed.craftedsignal.io/favicon-32x32.png","feed_url":"https://feed.craftedsignal.io/cpes/cpe2.3apython_pillowpillow/feed.json","home_page_url":"https://feed.craftedsignal.io/","icon":"https://feed.craftedsignal.io/apple-touch-icon.png","items":[{"_cs_actors":[],"_cs_cpes":["cpe:2.3:a:python_pillow:pillow:*:*:*:*:*:*:*:*"],"_cs_cves":[{"id":"CVE-2026-112403"}],"_cs_exploited":false,"_cs_has_poc":true,"_cs_poc_references":["https://sploitus.com/exploit?id=79817203-79D8-5F7D-8F84-E8EF827B1B5C\u0026utm_source=rss\u0026utm_medium=rss"],"_cs_products":["Pillow (\u003c 13.0.0)"],"_cs_severities":["high"],"_cs_tags":["image-processing","memory-corruption","heap-overflow"],"_cs_type":"advisory","_cs_vendors":["python-pillow"],"content_html":"\u003cp\u003ePillow contains a heap-based buffer overflow vulnerability within the \u003ccode\u003eImagingJpegDecode\u003c/code\u003e function. The issue arises when the library processes lossless (SOF3) JPEG images while performing downscaling, such as when calling \u003ccode\u003eImage.thumbnail()\u003c/code\u003e or \u003ccode\u003eJpegImageFile.draft()\u003c/code\u003e. When these methods request a scaled output, Pillow shrinks the internal decode buffer to match the expected scaled dimensions. However, the underlying libjpeg-turbo implementation ignores the scaling request for lossless (SOF3) streams and writes full-width scanlines into the undersized buffer.\u003c/p\u003e\n\u003cp\u003eAn attacker can exploit this by providing a maliciously crafted, standards-compliant 8-bit grayscale lossless JPEG. The buffer overflow occurs because there is no geometry validation comparing the libjpeg output dimensions against the allocated \u003ccode\u003estate-\u0026gt;buffer\u003c/code\u003e. Depending on the image dimensions and requested scaling factors, this can result in writing attacker-controlled pixel data past the end of the heap-allocated buffer. While the library ultimately throws an \u003ccode\u003eOSError\u003c/code\u003e due to geometry mismatches, the memory corruption occurs during the decompression process.\u003c/p\u003e\n\u003ch2 id=\"attack-chain\"\u003eAttack Chain\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eAttacker crafts a standards-compliant 8-bit grayscale lossless (SOF3) JPEG image file.\u003c/li\u003e\n\u003cli\u003eAttacker hosts or delivers the file to a target system utilizing a vulnerable version of Pillow.\u003c/li\u003e\n\u003cli\u003eThe victim application calls \u003ccode\u003eImage.open()\u003c/code\u003e on the malicious file, which is parsed successfully by Pillow's SOF parser.\u003c/li\u003e\n\u003cli\u003eThe application calls \u003ccode\u003eImage.thumbnail()\u003c/code\u003e or \u003ccode\u003eJpegImageFile.draft()\u003c/code\u003e on the image object, triggering a scaling request (e.g., scale factor s \u0026gt;= 2).\u003c/li\u003e\n\u003cli\u003ePillow computes expected scaled dimensions and allocates a \u003ccode\u003estate-\u0026gt;buffer\u003c/code\u003e using \u003ccode\u003ecalloc\u003c/code\u003e based on the reduced size.\u003c/li\u003e\n\u003cli\u003eThe \u003ccode\u003eImagingJpegDecode\u003c/code\u003e function calls \u003ccode\u003ejpeg_start_decompress\u003c/code\u003e and proceeds to \u003ccode\u003ejpeg_read_scanlines\u003c/code\u003e without validating the actual JPEG output dimensions.\u003c/li\u003e\n\u003cli\u003elibjpeg-turbo writes the full-width pixel scanlines into the undersized buffer, causing an out-of-bounds heap write of \u003ccode\u003e(W - ceil(W/s)) x components\u003c/code\u003e bytes.\u003c/li\u003e\n\u003cli\u003eThe overflow corrupts heap memory with attacker-controlled pixel values.\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"impact\"\u003eImpact\u003c/h2\u003e\n\u003cp\u003eSuccessful exploitation allows for memory corruption on systems using Pillow to process user-supplied images. This can lead to application crashes or potentially arbitrary code execution depending on the heap layout and the ability to influence memory state through crafted pixel data. This vulnerability affects any system or service that automatically generates thumbnails or processes image uploads using Pillow with standard library defaults.\u003c/p\u003e\n\u003ch2 id=\"recommendation\"\u003eRecommendation\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eIdentify and inventory all applications within the environment that utilize the Pillow library for image processing.\u003c/li\u003e\n\u003cli\u003eImplement strict input validation or sanitization for JPEG files to detect or reject lossless (SOF3) images if the functionality is not explicitly required.\u003c/li\u003e\n\u003cli\u003eMonitor internal application logs for \u003ccode\u003eOSError\u003c/code\u003e exceptions originating from \u003ccode\u003ePIL.JpegImagePlugin\u003c/code\u003e or \u003ccode\u003elibImaging\u003c/code\u003e during image processing, as these may indicate attempted exploitation.\u003c/li\u003e\n\u003cli\u003eApply patches provided by the Pillow project as soon as they become available for the affected versions.\u003c/li\u003e\n\u003c/ol\u003e\n","date_modified":"2026-10-23T11:37:05Z","date_published":"2026-10-20T23:53:08Z","id":"https://feed.craftedsignal.io/briefs/2026-10-pillow-heap-overflow/","summary":"A heap-based buffer overflow in Pillow’s ImagingJpegDecode function occurs when processing lossless (SOF3) JPEG files, leading to out-of-bounds memory writes during scanline decompression.","title":"Pillow: Heap buffer overflow in ImagingJpegDecode","url":"https://feed.craftedsignal.io/briefs/2026-10-pillow-heap-overflow/"}],"language":"en","title":"CraftedSignal Threat Feed - Cpe:2.3:a:python_pillow:pillow:*:*:*:*:*:*:*:*","version":"https://jsonfeed.org/version/1.1"}