CVE-2016-10145

9.8 CRITICAL

📋 TL;DR

CVE-2016-10145 is an off-by-one buffer overflow vulnerability in ImageMagick's WPG image format decoder. This allows remote attackers to execute arbitrary code or cause denial of service by tricking a user or application into processing a specially crafted WPG image file. Any system using vulnerable versions of ImageMagick to process untrusted image files is affected.

💻 Affected Systems

Products:
  • ImageMagick
Versions: Versions before 6.9.7-4 and 7.0.4-4
Operating Systems: All platforms running vulnerable ImageMagick versions
Default Config Vulnerable: ⚠️ Yes
Notes: Any application using ImageMagick to process WPG images is vulnerable. This includes web applications, document processors, and image conversion tools.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution with the privileges of the ImageMagick process, potentially leading to full system compromise.

🟠

Likely Case

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

🟢

If Mitigated

If proper input validation and sandboxing are in place, impact may be limited to denial of service.

🌐 Internet-Facing: HIGH - Image processing applications accepting user uploads are directly exposed.
🏢 Internal Only: MEDIUM - Internal systems processing images from untrusted sources remain vulnerable.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires the victim to process a malicious WPG file. Public proof-of-concept code demonstrates the vulnerability.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: ImageMagick 6.9.7-4 and 7.0.4-4

Vendor Advisory: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851483

Restart Required: No

Instructions:

1. Update ImageMagick using your system's package manager. 2. For Debian/Ubuntu: sudo apt-get update && sudo apt-get install imagemagick. 3. For source installations: Download latest version from imagemagick.org and recompile.

🔧 Temporary Workarounds

Disable WPG format support

linux

Remove or disable the WPG coder module to prevent processing of WPG files.

sudo mv /etc/ImageMagick-6/policy.xml /etc/ImageMagick-6/policy.xml.backup
echo '<policymap><policy domain="coder" rights="none" pattern="WPG" /></policymap>' | sudo tee /etc/ImageMagick-6/policy.xml

🧯 If You Can't Patch

  • Implement strict input validation to reject WPG files at application level
  • Run ImageMagick in a sandboxed/containerized environment with minimal privileges

🔍 How to Verify

Check if Vulnerable:

Check ImageMagick version: convert --version | head -1. If version is below 6.9.7-4 or 7.0.4-4, system is vulnerable.

Check Version:

convert --version | head -1

Verify Fix Applied:

After update, verify version is 6.9.7-4 or higher (6.x) or 7.0.4-4 or higher (7.x).

📡 Detection & Monitoring

Log Indicators:

  • ImageMagick process crashes with segmentation faults
  • Error messages related to WPG file processing

Network Indicators:

  • Unusual WPG file uploads to web applications
  • Image processing requests for WPG files

SIEM Query:

process_name:"convert" AND (event_type:crash OR error_message:"WPG")

🔗 References

📤 Share & Export