CVE-2025-48379: Pillow vulnerability can cause write buffer overflow on BCn encoding
(updated )
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.
References
- github.com/advisories/GHSA-xg8h-j46f-w952
- github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2025-61.yaml
- github.com/python-pillow/Pillow
- github.com/python-pillow/Pillow/commit/ef98b3510e3e4f14b547762764813d7e5ca3c5a4
- github.com/python-pillow/Pillow/pull/9041
- github.com/python-pillow/Pillow/releases/tag/11.3.0
- github.com/python-pillow/Pillow/security/advisories/GHSA-xg8h-j46f-w952
- nvd.nist.gov/vuln/detail/CVE-2025-48379
Code Behaviors & Features
Detect and mitigate CVE-2025-48379 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →