CVE-2016-9190
High · 7.8CVSS
7.8
EPSS
1.9%
Published
Nov 4, 2016
CISA due date
—
Cloudanix analysis
A flaw in a common image processing tool could allow an attacker to take control of a server simply by tricking it into opening a malicious image file.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The vulnerability is an insecure sign extension issue in the Pillow library's `ImagingNew` function. When processing a specially crafted image file, this flaw can be triggered to cause memory corruption, allowing an attacker to write data outside of its intended boundaries. This can be leveraged to overwrite critical memory structures, such as function pointers or stack return addresses, to hijack the application's control flow and achieve arbitrary code execution in the context of the process handling the image.
Why it matters to the business
An attacker who successfully exploits this vulnerability can take full control of the affected application or server. This could lead to the theft of sensitive data, unauthorized modification of system files and data, or complete service disruption (denial of service). For any business using software that processes images with the vulnerable library, this poses a high risk of system compromise, data breach, reputational damage, and operational downtime, especially for public-facing services that accept user-uploaded images.
How an attack unfolds
An attacker crafts a malicious image file containing data that specifically targets the insecure sign extension flaw in the Pillow library. The attacker then delivers this file to a target application, typically by uploading it through a feature like a profile picture updater or a document submission form. When the application's backend attempts to process the image using the vulnerable library, the flaw is triggered, causing a memory corruption. By carefully structuring the malicious image, the attacker can control the content and location of the memory write, allowing them to overwrite a return address on the stack or a function pointer. This redirects the program's execution to a payload, often embedded within the image file itself, granting the attacker arbitrary code execution with the privileges of the application user.
How to fix it
Upgrade the Pillow library to version 3.3.2 or later. For the specific affected product `kubernetes-csi-livenessprobe-2.10 (Chainguard)`, the fixed version is `2.10.0-r12`. If an immediate upgrade is not feasible, consider temporary mitigations such as disabling image upload features from untrusted sources or implementing a sandboxed environment for image processing to isolate the library from the main application.
How to confirm the fix worked
To validate the fix, use a software composition analysis (SCA) tool or package manager commands (e.g., `pip list | grep Pillow`) to ensure that all instances of the Pillow library are version 3.3.2 or newer. To identify exposure, audit all applications to find which ones process images and check if they use the Pillow library and its version. In a controlled test environment, processing a known proof-of-concept (PoC) image file for this vulnerability should not cause an application crash or unexpected behavior on a patched system.
Typical attack path
- The attacker creates a specially crafted image file to trigger the memory corruption.
- The attacker identifies a web application or service that uses a vulnerable version of the Pillow library for image processing.
- The attacker uploads the malicious image file to the target application.
- The application's backend processes the uploaded image, triggering the vulnerability in the Pillow library.
- Memory is corrupted, allowing the attacker to hijack the application's control flow.
- The attacker's payload is executed, resulting in a full compromise of the application server.
How to detect it
Detecting past exploitation requires forensic analysis. Security teams should investigate application servers that use vulnerable versions of the Pillow library for signs of compromise. Look for unexpected application crashes (e.g., segmentation faults) in system logs (`/var/log/syslog`, `dmesg`, or application-specific logs) that correlate with image processing events. Monitor for suspicious processes being spawned by the application process that handles images, such as shells (`/bin/sh`, `bash`) or network utilities (`nc`, `netcat`), which could indicate a successful post-exploitation payload execution.
- log_message: segfault
- log_message: segmentation fault
- process_ancestry: <image_processing_app> -> /bin/sh
- process_ancestry: <image_processing_app> -> /bin/bash
What your security team should do
- Prioritize patching systems running vulnerable versions of the Pillow library, especially public-facing web applications that process user-supplied images.
- Use software composition analysis (SCA) tools to perform a comprehensive scan of all applications and container images to identify and inventory all instances of the Pillow library.
- If patching is not immediately possible, implement strict input validation to reject malformed images before they are processed by the library, though this is a less reliable mitigation.
The record
Pillow before 3.3.2 allows context-dependent attackers to execute arbitrary code by using the "crafted image file" approach, related to an "Insecure Sign Extension" issue affecting the ImagingNew in Storage.c component.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| PyPI | pillow | 0 | 3.3.2 |
| Debian:11 | pillow | 0 | 3.4.2-1 |
| Debian:12 | pillow | 0 | 3.4.2-1 |
| Debian:13 | pillow | 0 | 3.4.2-1 |
| Debian:7 | python-imaging | 0 | 1.1.7-4+deb7u3 |
| Debian:8 | pillow | 0 | 2.6.1-2+deb8u3 |
| Mageia:5 | python-pillow | 0 | 2.6.2-2.6.mga5 |
| SUSE:Enterprise Storage 4 | python-Pillow | 0 | 2.8.1-4.3.2 |
| SUSE:Enterprise Storage 5 | python-Pillow | 0 | 2.8.1-3.3.1 |
| SUSE:OpenStack Cloud 6 | python-Pillow | 0 | 2.7.0-4.3.1 |
| SUSE:OpenStack Cloud 7 | python-Pillow | 0 | 2.8.1-4.3.2 |
| Ubuntu:14.04:LTS | pillow | 0 | 2.3.0-1ubuntu3.4 |
| Ubuntu:16.04:LTS | pillow | 0 | 3.1.2-0ubuntu1.1 |
Related vulnerabilities
- CVE-2026-25990 Pillow is a Python imaging library. Also affects pillow
- CVE-2025-48379 Pillow is a Python imaging library. Also affects pillow
- CVE-2024-28219 In _imagingcms.c in Pillow before 10.3.0, a buffer overflow exists because strcpy is used… Also affects pillow
- GHSA-4fx9-vc88-q2xc Infinite loop in Pillow Also affects pillow
- GHSA-jgpv-4h4c-xhw3 Uncontrolled Resource Consumption in pillow Also affects pillow
- CVE-2016-3076 Heap-based buffer overflow in the j2k_encode_entry function in Pillow 2.5.0 through 3.1.1… Also affects pillow
- CVE-2016-9189 Pillow before 3.3.2 allows context-dependent attackers to obtain sensitive information by… Also affects pillow
- CVE-2016-4009 Integer overflow in the ImagingResampleHorizontal function in libImaging/Resample.c in… Also affects pillow