CVE-2025-48379: Pillow Vulnerable to Write Buffer Overflow on BCn encoding
Pillow is a Python imaging library. In versions 11.2.0 to before 11.3.0, there is a heap buffer overflow when writing a sufficiently large (>64k encoded with default settings) image in the DDS format due to writing into a buffer without checking for available space. This only affects users who save untrusted data as a compressed DDS image. This issue has been patched in version 11.3.0.
Other sources
Pillow is a Python imaging library. In versions 11.2.0 to before 11.3.0, there is a heap buffer overflow when writing a sufficiently large (64k encoded with default settings) image in the DDS format due to writing into a buffer without checking for available space. This only affects users who save untrusted data as a compressed DDS image. This issue has been patched in version 11.3.0.
— IBM
There is a heap buffer overflow when writing a sufficiently large (>64k encoded with default settings) image in the DDS format due to writing into a buffer without checking for available space.
This only affects users who save untrusted data as a compressed DDS image.
Unclear how large the potential write could be. It is likely limited by process segfault, so it's not necessarily deterministic. It may be practically unbounded. Unclear if there's a restriction on the bytes that could be emitted. It's likely that the only restriction is that the bytes would be emitted in chunks of 8 or 16.
This was introduced in Pillow 11.2.0 when the feature was added.
— GitHub
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/pillowto a version that resolves this vulnerability.Fixed in 11.3.0 - Upgrade
Upgrade
Pillowto a version that resolves this vulnerability.Fixed in 11.3.0 - Configuration
Avoid using Pillow to save untrusted data as a compressed DDS image (the overflow affects saving sufficiently large DDS images with default settings).
Pillow (DDS saving) DDS write of untrusted data (compressed DDS) = Do not save untrusted data as compressed DDS images - Compensating control
If you must process DDS inputs, isolate the process that calls Pillow (e.g., run it in a sandbox/container with limited permissions) to reduce impact of a potential segfault from the heap buffer overflow.
Event History
Frequently Asked Questions
What is the severity of CVE-2025-48379?
CVE-2025-48379 has a critical severity level due to the potential for a heap buffer overflow.
How do I fix CVE-2025-48379?
To fix CVE-2025-48379, upgrade to pillow version 11.3.0 or later.
Which versions of pillow are affected by CVE-2025-48379?
CVE-2025-48379 affects pillow versions between 11.2.0 and 11.2.0 inclusive.
What types of data are vulnerable in CVE-2025-48379?
CVE-2025-48379 is exploitative when saving untrusted data as compressed DDS images.
What is the underlying cause of CVE-2025-48379?
CVE-2025-48379 is caused by a heap buffer overflow due to insufficient space checks when writing large DDS images.