CVE-2025-48379

7.1 HIGH

📋 TL;DR

This CVE describes a heap buffer overflow vulnerability in the Python Pillow library when saving large DDS format images. Attackers could potentially execute arbitrary code or crash applications by providing malicious DDS images. Only users who save untrusted data as compressed DDS images are affected.

💻 Affected Systems

Products:
  • Python Pillow (PIL Fork)
Versions: 11.2.0 to 11.2.99 (all versions before 11.3.0)
Operating Systems: All operating systems running Python
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects users who save untrusted data as compressed DDS images. Other image formats are not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, or persistent backdoor installation.

🟠

Likely Case

Application crashes (denial of service) or memory corruption leading to unstable behavior.

🟢

If Mitigated

No impact if untrusted DDS images are not processed or if proper input validation is implemented.

🌐 Internet-Facing: MEDIUM - Requires processing untrusted DDS images, which is not a common web application workflow.
🏢 Internal Only: LOW - Most internal systems don't process untrusted DDS images from external sources.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires crafting a malicious DDS image >64k when encoded with default settings. No public exploits have been reported.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 11.3.0

Vendor Advisory: https://github.com/python-pillow/Pillow/security/advisories/GHSA-xg8h-j46f-w952

Restart Required: No

Instructions:

1. Update Pillow using pip: 'pip install --upgrade pillow==11.3.0' 2. Verify installation with: 'pip show pillow' 3. Restart any running Python applications using Pillow.

🔧 Temporary Workarounds

Disable DDS format processing

all

Modify code to reject or skip DDS format images from untrusted sources

# In Python code, add validation before processing:
if image_format == 'DDS':
    raise ValueError('DDS format not allowed from untrusted sources')

Size limit on DDS images

all

Implement file size validation for DDS images before processing

# Check file size before processing DDS:
if os.path.getsize(dds_file) > 65536:  # 64KB limit
    raise ValueError('DDS file too large')

🧯 If You Can't Patch

  • Implement strict input validation to reject DDS images from untrusted sources
  • Deploy application-level firewalls or WAFs to block DDS file uploads

🔍 How to Verify

Check if Vulnerable:

Run 'pip show pillow' and check if version is between 11.2.0 and 11.2.99

Check Version:

pip show pillow | grep Version

Verify Fix Applied:

Run 'pip show pillow' and confirm version is 11.3.0 or higher

📡 Detection & Monitoring

Log Indicators:

  • Application crashes when processing DDS images
  • Memory access violation errors in application logs
  • Unusual Python process termination

Network Indicators:

  • Large DDS file uploads (>64KB) to web applications
  • Multiple failed DDS processing attempts

SIEM Query:

source="application.logs" AND ("DDS" OR "pillow") AND ("crash" OR "segmentation fault" OR "buffer overflow")

🔗 References

📤 Share & Export