CVE-2024-25269

7.5 HIGH

📋 TL;DR

A memory leak vulnerability in libheif's JpegEncoder::Encode function allows attackers to cause denial of service by exhausting system memory. This affects all applications using vulnerable versions of libheif to process HEIF/HEIC images. The impact is limited to DoS rather than code execution.

💻 Affected Systems

Products:
  • libheif
  • Applications using libheif library
Versions: <= 1.17.6
Operating Systems: Linux, Windows, macOS, BSD
Default Config Vulnerable: ⚠️ Yes
Notes: Any application linking against vulnerable libheif versions is affected when processing HEIF/HEIC images

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system unavailability due to memory exhaustion, potentially affecting all services on the same host

🟠

Likely Case

Application crashes or becomes unresponsive when processing malicious HEIF/HEIC images

🟢

If Mitigated

Limited to single application crash if proper memory limits and isolation are in place

🌐 Internet-Facing: MEDIUM - Web applications processing user-uploaded HEIF/HEIC images could be targeted
🏢 Internal Only: LOW - Requires processing of malicious images, less likely in controlled environments

🎯 Exploit Status

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

Exploitation requires only a malicious HEIF/HEIC image file, no authentication needed

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.17.7 or later

Vendor Advisory: https://github.com/strukturag/libheif/issues/1073

Restart Required: Yes

Instructions:

1. Update libheif to version 1.17.7 or later. 2. Rebuild/reinstall applications using libheif. 3. Restart affected services.

🔧 Temporary Workarounds

Disable HEIF/HEIC processing

all

Configure applications to reject HEIF/HEIC image formats

Memory limit enforcement

linux

Set memory limits on applications using libheif

ulimit -v [LIMIT] # Linux memory limit
docker run --memory=[LIMIT] # Container memory limit

🧯 If You Can't Patch

  • Implement strict input validation to reject suspicious HEIF/HEIC files
  • Deploy memory monitoring and alerting for applications using libheif

🔍 How to Verify

Check if Vulnerable:

Check libheif version: `libheif --version` or `ldconfig -p | grep libheif`

Check Version:

libheif --version 2>/dev/null || pkg-config --modversion libheif 2>/dev/null || echo 'libheif not found'

Verify Fix Applied:

Confirm version is 1.17.7 or later: `libheif --version | grep -q '1\.1[7-9]\.[7-9]'`

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with memory allocation errors
  • High memory usage spikes during image processing

Network Indicators:

  • Repeated uploads of HEIF/HEIC files to web applications

SIEM Query:

source="application.log" AND ("out of memory" OR "memory allocation failed") AND process="*libheif*"

🔗 References

📤 Share & Export