CVE-2025-66628

7.5 HIGH

📋 TL;DR

ImageMagick's TIM image parser contains an integer overflow vulnerability that allows attackers to trigger out-of-bounds memory reads by providing specially crafted TIM images. This affects ImageMagick versions 7.1.2-9 and earlier, particularly on 32-bit systems where size_t is 32-bit. Applications that process untrusted TIM images are vulnerable to potential information disclosure or denial of service.

💻 Affected Systems

Products:
  • ImageMagick
  • Magick.NET
  • Any software using vulnerable ImageMagick libraries
Versions: 7.1.2-9 and earlier
Operating Systems: All operating systems, but primarily impacts 32-bit systems
Default Config Vulnerable: ⚠️ Yes
Notes: Most vulnerable on 32-bit architectures where size_t is 32-bit; 64-bit systems may be less affected but still vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Information disclosure through memory leaks leading to sensitive data exposure, or denial of service through application crashes.

🟠

Likely Case

Application crashes or instability when processing malicious TIM images, potentially causing denial of service.

🟢

If Mitigated

Limited impact if proper input validation and sandboxing are implemented, though risk remains for unpatched systems.

🌐 Internet-Facing: MEDIUM - Web applications processing user-uploaded images could be exploited, but requires specific TIM format usage.
🏢 Internal Only: LOW - Requires local access or internal systems processing TIM images from untrusted sources.

🎯 Exploit Status

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

Exploitation requires crafting specific TIM images with large dimensions; no public exploit code known at this time.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 7.1.2-10

Vendor Advisory: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-6hjr-v6g4-3fm8

Restart Required: No

Instructions:

1. Update ImageMagick to version 7.1.2-10 or later. 2. For Linux: Use package manager (apt-get update && apt-get upgrade imagemagick). 3. For Windows: Download latest installer from imagemagick.org. 4. Rebuild any applications using ImageMagick libraries.

🔧 Temporary Workarounds

Disable TIM format processing

linux

Remove or disable TIM format support in ImageMagick policy.xml

Edit /etc/ImageMagick-7/policy.xml and add: <policy domain="coder" rights="none" pattern="TIM" />

Sandbox image processing

all

Run ImageMagick in restricted environment with limited memory access

Use Docker containers with limited capabilities: docker run --security-opt=no-new-privileges --cap-drop=ALL -it imagemagick

🧯 If You Can't Patch

  • Implement strict input validation to reject TIM images with dimensions exceeding safe thresholds
  • Deploy web application firewalls (WAF) to block malicious TIM image uploads

🔍 How to Verify

Check if Vulnerable:

Check ImageMagick version: convert --version | grep Version

Check Version:

convert --version | grep 'Version: ImageMagick'

Verify Fix Applied:

Verify version is 7.1.2-10 or later and test with sample TIM images

📡 Detection & Monitoring

Log Indicators:

  • ImageMagick segmentation faults
  • Memory allocation errors in application logs
  • Failed TIM image processing

Network Indicators:

  • Unusual TIM image uploads to web applications
  • Large TIM files with specific dimensions

SIEM Query:

source="*imagemagick*" AND ("segmentation fault" OR "out of bounds" OR "memory error")

🔗 References

📤 Share & Export